Skip to main content
Reward servers let you deploy custom grading logic as an external API that Adaptive Engine calls during training and evaluation. Use reward servers when your reward depends on external systems like databases, simulated environments, or sandboxes.

Building a Reward Server

Implement a subclass of RewardServer with two methods:
The score method receives:
  • request.turns - conversation history (list of role/content pairs)
  • request.metadata - metadata from dataset record
Returns:
  • reward - float score
  • metadata - optional dict with feedback or debug info

No Metadata

If your reward doesn’t need metadata, use EmptyMetadata:

SQL Execution Example

A more realistic example that executes SQL queries and compares results:

Testing Locally

Use RewardClient to test before deployment:

Deployment

Docker

Docker Compose

Access at http://sql-reward-server:50056 within the Docker network.

Kubernetes

Access at http://sql-reward-server:50056 (same namespace) or http://sql-reward-server.<namespace>.svc.cluster.local:50056.

Connecting to Adaptive Engine

Test connectivity:
Register as a grader:
List and delete graders: