Skip to main content
Strands Agents is an AWS agent framework for building tool-using agents. Use the Osmosis Strands integration when you want Strands tools, Strands message handling, and a direct migration path from an existing strands.Agent. Install the strands extra when a rollout uses this integration: osmosis-ai[strands]>=0.3.0rc1,<0.4.

Integration Objects

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:
For most tool-using agents, one 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. Pass LiteLLM sampling options through params, matching the Strands LiteLLMModel configuration:
Construct OsmosisStrandsAgent inside AgentWorkflow.run() or another path where the execution backend has already installed an active RolloutContext. Constructing it at module import time will fail because no rollout context exists yet.

How Sample Collection Works

When constructed with an OsmosisRolloutModel, OsmosisStrandsAgent performs these steps:
1

Read the rollout context

It reads the active RolloutContext from the current execution scope and raises RuntimeError if none is available.
2

Resolve the model

It creates a LiteLLM model connected directly to the rollout-scoped Osmosis chat-completions URL.
3

Register the agent

It registers itself with the rollout context so the backend can collect the Strands message history as a RolloutSample.
4

Initialize Strands Agent

It delegates to the normal Strands Agent constructor with the resolved model. Tools, prompts, messages, and callbacks pass through unchanged.
The collected RolloutSample.messages preserves Strands’ native message history for graders. The integration separately performs a best-effort normalization for ATIF persistence; a normalization failure does not replace or discard the native sample. ATIF usage, model, and timestamp fields are included only when the source provides them.

Complete Example

Migrating from Strands Agent

If you already have a Strands agent, migrate it in four steps:
1

Replace the agent import

Replace from strands import Agent with:
2

Replace the model

Replace your fixed LiteLLM model with an Osmosis placeholder:
Drop the model_id; the training cluster decides which policy to serve.
3

Swap the agent class

Replace Agent(...) with OsmosisStrandsAgent(...). Keep tools, system prompt, messages, and callbacks the same.
4

Wrap in AgentWorkflow

Move the agent construction and await agent.invoke_async() call into AgentWorkflow.run().

Strands vs OpenAI Agents

See OpenAI Agents Integration for the OpenAI Agents SDK path.

Next Steps

AgentWorkflow

Review the shared workflow contract.

Grader

Score the sample produced by your Strands agent.

Evaluation

Submit an evaluation run for your Strands rollout.

OpenAI Agents Integration

Compare the OpenAI Agents SDK integration.
Last modified on August 10, 2026