strands.Agent.
The osmosis-ai package includes strands-agents[litellm], so starter rollouts can use Strands without adding another dependency.
Integration Objects
| Object | Purpose |
|---|---|
OsmosisStrandsAgent | Drop-in replacement for Strands Agent that registers samples with the active rollout context |
OsmosisRolloutModel | Placeholder model that resolves to the current Osmosis policy at runtime |
OsmosisStrandsAgent preserves normal Strands constructor arguments such as tools, system_prompt, messages, and callback handlers.
Quick Example
ctx.prompt is already the ready-to-use input for the current sample. If your dataset row contains system_prompt and user_prompt, the SDK assembles those fields before your workflow runs.Tools
Define Strands tools normally with@tool, then pass them to OsmosisStrandsAgent:
invoke_async() call is enough because Strands handles the model-tool loop internally. Add an outer loop only when you need extra stopping conditions or a hard cap across repeated invocations.
OsmosisRolloutModel
OsmosisRolloutModel does not take a model_id. The SDK uses the placeholder model id openai/osmosis-rollout at runtime, and Osmosis routes it to the current policy.
Use the params dict for sampling options:
How Sample Collection Works
When constructed with anOsmosisRolloutModel, OsmosisStrandsAgent performs these steps:
Read the rollout context
It reads the active
RolloutContext from the current execution scope and raises RuntimeError if none is available.Resolve the model
It calls
model.for_sample(sample_id, rollout_ctx) to create a real LiteLLM model connected to the Osmosis chat completions endpoint.Register the agent
It registers itself with the rollout context so the backend can collect the Strands message history as a
RolloutSample.Complete Example
Migrating from Strands Agent
If you already have a Strands agent, migrate it in four steps:Replace the model
Replace your fixed LiteLLM model with an Osmosis placeholder:Drop the
model_id; the training cluster decides which policy to serve.Swap the agent class
Replace
Agent(...) with OsmosisStrandsAgent(...). Keep tools, system prompt, messages, and callbacks the same.Strands vs OpenAI Agents
| Choose Strands when | Choose OpenAI Agents when |
|---|---|
Your tools are already Strands @tool functions | Your workflow already uses Runner.run and OpenAI Agents SDK sessions |
You want Strands message traces in sample.messages | You want persisted Responses API-style session items in sample.messages |
You are migrating from strands.Agent | You are migrating from OpenAI Agents SDK Agent |
Next Steps
Building AgentWorkflows
Review the shared workflow contract.
Building Graders
Score the samples produced by your Strands agent.
Evaluation
Submit an evaluation run for your Strands rollout.
OpenAI Agents Integration
Compare the OpenAI Agents SDK integration.