Documentation Index
Fetch the complete documentation index at: https://docs.osmosis.ai/llms.txt
Use this file to discover all available pages before exploring further.
When you submit a training run with
osmosis train submit, Osmosis provisions and runs your rollout for you — you don’t pick or configure a backend. This page is an SDK-level reference for the open source osmosis-ai package, useful when you want to drive rollouts yourself (e.g. custom local harnesses or self-hosted experimentation).AgentWorkflow and Grader run when you orchestrate them through the SDK directly. You can execute everything in the current Python process for simplicity, or isolate each execution inside a Docker container.
ExecutionBackend Interface
All backends implement theExecutionBackend abstract class:
| Method | Description |
|---|---|
execute() | Runs an AgentWorkflow (and optionally a Grader) for a single request |
max_concurrency | Maximum parallel executions. 0 means no limit. |
health() | Returns backend health status. Default implementation returns {"status": "ok"}. |
LocalBackend
Executes your AgentWorkflow and Grader directly in the current Python process. No additional infrastructure required.| Parameter | Type | Description | |
|---|---|---|---|
workflow | class or "module:attr" string | Your AgentWorkflow subclass or a colon-separated import path (e.g. "my_module:MyWorkflow") | |
workflow_config | `AgentWorkflowConfig | None` | Optional config passed to the workflow |
grader | class or "module:attr" string | Your Grader subclass or a colon-separated import path | |
grader_config | `GraderConfig | None` | Optional config passed to the grader |
Receive request
The backend receives an
ExecutionRequest containing the input prompt and reference answer for one dataset row.Run workflow
Creates an
AgentWorkflowContext, establishes a RolloutContext, and calls workflow.run(ctx).Collect samples
Collects all
RolloutSample objects from the RolloutContext after the workflow completes.Run grader
Creates a
GraderContext with the collected samples and that row’s reference answer, then calls grader.grade(ctx).AgentWorkflowConfig.concurrency.max_concurrent (default: 4). The backend uses a ConcurrencyLimiter to cap parallel workflow executions.
Error categorization: The LocalBackend maps exceptions to structured error types — TimeoutError becomes TIMEOUT, ValueError/TypeError become VALIDATION_ERROR, and all other exceptions become AGENT_ERROR.
HarborBackend
Executes your AgentWorkflow and Grader inside Docker containers via theharbor package. Each execution gets its own isolated container with an independent filesystem and process space.
- Pre-builds a Docker image at construction time
- Each execution runs in a fresh container
HarborAgentWorkflowContextextendsAgentWorkflowContextwith anenvironmentobject for container interaction —environment.exec(),environment.upload_file(), etc.
Comparison
| LocalBackend | HarborBackend | |
|---|---|---|
| Execution environment | Current Python process | Docker container |
| Isolation | None — shares process memory | Full — isolated filesystem and process |
| Startup speed | Instant | Requires Docker image build |
| Dependency management | Shared Python environment | Independent per container |
| Debugging | Direct — breakpoints, print statements | Container logs, trace files |
| Best for | Development, eval, simple deployments | Production, complex agents |
Choosing a Backend
osmosis eval run uses LocalBackend internally. If you embed osmosis-ai in your own harness, you can wire up either backend yourself.
Next Steps
Local Evaluation
Evaluate your rollout locally with
osmosis eval run, or use it as a pre-training smoke test.Strands Integration
Use the AWS Strands agent framework with Osmosis for training.