python sdk for coding agents
Build with your favorite coding agent
Run real coding agents against real repositories in real sandboxes.
Use Claude Code, Codex, OpenCode, or your own agent whenever you need it. Run the same agent in Docker for CI, Docker Sandboxes for local isolation, and future cloud backends for production.
sbx-agents is the missing SDK layer between autonomous coding agents and isolated execution environments.
Not another LLM app framework
OpenAI Agents SDK, Pydantic AI, LangGraph, and similar frameworks help orchestrate LLM calls, tool schemas, and chat workflows.
sbx-agents orchestrates coding agents that operate on repositories: edit files, run tests, use MCP, produce diffs, and return artifacts from isolated sandboxes.
| Need | LLM app frameworks | sbx-agents |
|---|---|---|
| Chat/tool graph | first-class | not the focus |
| Run Codex/OpenCode/Claude Code-style CLIs | awkward | first-class |
| Isolated repo workspace | external concern | core abstraction |
Collect git diff |
hand-roll | built in |
| Swap sandbox runtime | hand-roll | backend interface |
| Multi-agent coding workflows | hand-roll | core pattern |
Get started
Install the package:
$ uv add sbx-agents
$ pip install sbx-agents
Run Codex or OpenCode in Docker SBX:
from pathlib import Path
from sbx_agents import Agent, Runner
from sbx_agents.backends import Codex
from sbx_agents.sandboxes import DockerSbxSandbox
agent = Agent(name="fix-tests", backend=Codex(model="gpt-5-codex"))
result = Runner.run_sync(
agent,
sandbox=DockerSbxSandbox(workspace=Path("."), branch="agent/fix-tests"),
prompt="Fix the failing pytest suite.",
)
from pathlib import Path
from sbx_agents import Agent, Runner
from sbx_agents.backends import OpenCode
from sbx_agents.sandboxes import DockerSbxSandbox
agent = Agent(name="reviewer", backend=OpenCode(model="anthropic/claude-sonnet-4-5"))
result = Runner.run_sync(
agent,
sandbox=DockerSbxSandbox(workspace=Path("."), branch="agent/review"),
prompt="Review this repository and produce a risk-ranked report.",
)
See Get started for the full walkthrough.
Or define a reusable runner in Python and launch it from the terminal:
$ sbxa run main:runner "Fix failing tests."
What you can build
CI fixer agents
Fix failing tests and open PRs from isolated branches.
Review fleets
Compare Codex, OpenCode, and custom agents against same repo.
Agent products
Launch one sandboxed agent per issue, incident, or customer request.
Tenant isolation
Build FastAPI services with workspace-per-tenant execution.
Multi-agent workflows
Reviewer, fixer, and verifier cooperate in one sandbox.
Multi-sandbox workflows
Move selected artifacts between isolated environments.
Supported backends
| Type | Backends |
|---|---|
| Agents | Shell, Codex, OpenCode |
| Sandboxes | DockerSandbox, DockerSbxSandbox |
Learn more
- Agents — supported agent backends and config.
- Sandboxes — Docker, Docker SBX, workspace mounting, and cleanup.
- Running agents —
Runner,RunConfig, JSON events, and results. - File management — upload, download, list, delete, and copy files.
- Multi-step workflows — compose agents and sandboxes.
- FastAPI services — embed the SDK in APIs and isolate tenants.
- Security — trust boundaries, workspace trust, and production checks.
- Customize — skills, MCP, permissions, and backend-native config.
- Troubleshooting — common setup and runtime issues.