synth_ai.data.rewards
Reward data structures.
This module defines pure data types for representing rewards in training
and evaluation contexts. These are actual data records, not API abstractions.
Synth AI uses two primary reward scopes:
-
Event Rewards: Fine-grained rewards attached to individual events within a session
(e.g., each tool call, each LLM response). Use
EventRewardRecordto annotate specific events with reward values. -
Outcome Rewards: Episode-level rewards that summarize the overall success of a
complete session. Use
OutcomeRewardRecordfor aggregate metrics.
- Event rewards SDK guide: /sdk/tracing/rewards/event-rewards
- Outcome rewards SDK guide: /sdk/tracing/rewards/outcome-rewards
Classes
OutcomeRewardRecord
Episode-level reward summary.
Aggregates reward information for a complete episode/session,
including total reward, achievements, and step counts. This is the
primary data structure for outcome rewards used in training.
Attributes:
session_id: Unique identifier linking to the SessionTrace.total_reward: Aggregate reward for the entire episode (typically 0.0-1.0).objective_key: Objective identifier for this reward (defaults to “reward”).achievements_count: Number of achievements/milestones reached.total_steps: Total number of steps in the episode.metadata: Task-specific metadata (e.g., {“task”: “code_gen”, “difficulty”: “hard”}).annotation: Human or evaluator annotations explaining the score.created_at: When this record was created.
EventRewardRecord
Event-level reward annotation.
Links a reward to a specific event in a trace, with optional
annotations and source information. Event rewards provide fine-grained
feedback on individual actions or decisions within a session.
Attributes:
event_id: Unique identifier of the event being rewarded.session_id: Session containing this event.reward_value: Reward for this specific event (typically 0.0-1.0).objective_key: Objective identifier for this reward (defaults to “reward”).reward_type: Category of reward (e.g., “tool_success”, “reasoning”, “progress”).key: Rubric criterion or achievement key this reward relates to.turn_number: Turn/step within the session where event occurred.source: Origin of the reward (“environment”, “evaluator”, “human”).annotation: Explanation or details about why this reward was given.created_at: When this record was created.