Goals
- Understand what rollouts are and why you would record them.
- Record rollouts from an agent interacting with an OpenReward environment.
- Use provider-specific logging methods for OpenAI, Anthropic, Google Gemini, and OpenRouter.
- View recorded rollouts in the OpenReward dashboard.
Prerequisites
- An OpenReward account
- An OpenReward API key
- An API key and SDK for your model provider of choice (e.g. OpenAI, Anthropic, Google, OpenRouter)
- Familiarity with the Your First Environment tutorial
Setup
Install the OpenReward Python library:What are Rollouts?
A rollout is a recorded trace of an agent interacting with an environment. It captures every message exchange — user prompts, assistant responses, reasoning steps, tool calls, and tool results — along with associated rewards and metadata. Recording rollouts is useful for:- Debugging: Inspect exactly what your agent did step-by-step.
- Analysis: Compare performance across models, prompts, or environment configurations.
- Training data: Collect trajectories for supervised finetuning or midtraining.
- Collaboration: Your team can view runs on your organisation’s OpenReward page.
Key Concepts
Runs and Rollouts
A run groups related rollouts together under a single name (e.g."gpt-5.2-ctf-eval"). Each rollout within a run represents one episode or conversation with the environment.
Creating a Rollout
Logging Methods
The SDK provides these logging methods on aRollout object:
| Method | Provider | Input Type |
|---|---|---|
rollout.log_openai_response(message) | OpenAI (Responses API) | Response object or individual output items |
rollout.log_openai_completions(message) | OpenAI (Chat Completions) / OpenRouter | Chat message dicts |
rollout.log_anthropic_message(message) | Anthropic | Message dicts (Anthropic format) |
rollout.log_gdm_message(message) | Google Gemini | google.genai.types.Content objects |
rollout.log(message) | Generic | UserMessage, AssistantMessage, ToolCall, etc. |
reward(Optional[float]): Reward signal for this stepis_finished(Optional[bool]): Whether this step ends the episodemetadata(Optional[dict]): Arbitrary metadata for this step
Flushing Events
When you are done logging, callor_client.rollout.close() to ensure all pending events are flushed and uploaded:
Recording Rollouts by Provider
In this example we will sample theGeneralReasoning/CTF environment and record the full rollout trace to OpenReward.
- OpenAI
- Anthropic
- Google
- OpenRouter
- Other Models
Set your API keys
Make sure you have API keys for OpenReward and OpenAI, and set these as environment variables:
Viewing Rollouts
After running your code, head to OpenReward and your profile page. Go to the Runs tab to see your recorded runs:


Next Steps
Train with OpenReward
Use recorded rollouts as part of a reinforcement learning training pipeline.
Evaluate with OpenReward
Run systematic evaluations across environments and models.
Build your own environment
Create custom environments for your use case.
Using the AsyncClient
Record rollouts asynchronously for better performance.

