Episodes
An episode is a complete training interaction between your model and a simulated scenario. Episodes are the primary unit of training for multi-turn agents.Episode Lifecycle
Creating an Episode
To create an episode, POST to/api/v1/episodes with a collection and scenario ID. See the Quickstart for full code examples.
Response
Submitting Turns
Each turn represents one exchange in the conversation. POST to/api/v1/episodes/{episode_id}/turns with your messages. See the Quickstart for full code examples.
To include tool calls, attach them to the assistant message. See Tool Calls for details.
Response
The
scores field is optional and provides a breakdown of individual scoring dimensions. Dimension names vary by scenario.Episode Termination
Episodes end for one of these reasons:| Reason | Description |
|---|---|
completed | Model completed the scenario successfully |
error | Episode terminated due to an error |
max_turns_reached | Reached scenario’s turn limit |
client_terminated | Client explicitly requested episode termination |
Episode State
Each episode tracks internal state including:- Which objectives have been discovered
- Which goals have been achieved
- The scenario’s scoring criteria
Limits
| Limit | Value |
|---|---|
| Max turns per episode | 50 |
| Max message length | 10,000 characters |
Best Practices
One episode per training sample
One episode per training sample
Create a fresh episode for each training trajectory. Don’t reuse episode IDs.
Track conversation history locally
Track conversation history locally
The API returns only one message per turn—the simulated persona’s response. Your client is responsible for maintaining the full conversation history and passing all messages with each turn submission.
Handle rate limits gracefully
Handle rate limits gracefully
Check
X-RateLimit-Remaining headers and implement exponential backoff.