Use cases¶
A sandbox of Docker Sandboxes is a throw-away machine, with network rules and keys scoped to it. fastsandbox fits wherever a Python program needs to run code it does not want on the host, or to hand a repository to a coding agent without handing it the machine.
Checks in a throw-away machine¶
A test suite, a build or a linter run on a copy of a repository, in a sandbox with network rules of its own, deleted afterwards. The task states its kit, its network rules and its deadline; the report it returns is validated with Pydantic, and the same task runs from Python or from the command line.
Tasks · Host paths · Network rules
Coding agents, unattended¶
An agent works on a repository in its own sandbox: Claude Code, Codex, Copilot, Cursor, Devin, Docker Agent, Droid, Kiro or OpenCode. Its API key is given to the proxy of that sandbox only, and the tests run after it decide whether its work holds.
- A fix on the workspace. The repository is mounted as the workspace of the agent, which changes it in place.
- A patch from a private clone. With
WorkspaceDir(clone=True), the agent works on a clone that goes with the sandbox; its commits leave as a patch to review before anything reaches the host. - A review, step by step.
ctx.agent.stream(...)yields what the agent reports as it goes, for a log or a progress bar; leaving the loop stops the reading, and the agent stops when its sandbox is removed. - Several agents on one issue. Each in its own sandbox, on its own clone; the tests pick the patch that holds.
Working with repositories · Stream agent events · Run agents concurrently
Agents with tools¶
An agent gets the tools of MCP servers, registered in Claude Code, Copilot or
OpenCode by its task, without the sbx CLI: a server of the host, which tells
the sandbox of a run by the token drawn for it, a remote one, or a program the
agent starts in the sandbox. Through the MCP gateway of its sandbox, it gets a
local server loaded into the gateway, a remote one behind a token the gateway
injects, or a set chosen when the sandbox is created.
Sandboxes described as data¶
A job that launches many sandboxes alike, a fleet of reviewers or a batch of checks, describes them once: a sandbox spec holds the kit, the mounts, the network rules, the keys and the MCP servers, is checked before anything is created, and launches each sandbox in one call, the kit forged once for all of them through a kit cache. Its JSON form lets a program in another language write it.
Interactive sessions¶
A shell, or the agent of a kit, relayed to a terminal with its keys and its window size: a sandbox to explore by hand, opened from a program.
Tooling around the daemon¶
The client reaches every route of the daemon, so the tools around it are Python programs: a watcher on the event stream, an audit of the network policy and of what running sandboxes reached, a cleanup of old sandboxes and images, a report on disk usage.
Events and prompts · Network and policy · The daemon
Tests¶
The code that drives sandboxes is tested against a fake daemon that serves the
socket API in memory: no sbx, no image, no microVM, so the tests run in any
CI.