Core concepts
Sandbox
Section titled “Sandbox”A sandbox is a Linux microVM with its own kernel, file system, processes and network. Nothing it runs can reach another sandbox or the host. You size it when you create it (vCPUs, memory, disk) and give it a lifetime. You can label it with metadata, which you use later to find it.
Every sandbox has an id. Any process that knows the id can connect to it again, and the SDK fetches fresh access for that
connection.
Template
Section titled “Template”A template is the image a sandbox boots from. Start from:
| Template | What it has |
|---|---|
base (the default) |
Ubuntu with Python, Node.js, git, gh, tmux, ripgrep, jq and a compiler |
code-interpreter-all |
Kernels for run_code in every language |
code-interpreter-data |
The Python kernel with numpy, pandas, matplotlib and pyarrow, for charts and rich results |
browser |
Headless Chromium driven through accessibility-tree snapshots |
desktop |
An Xfce desktop with a noVNC stream, for computer-use agents |
| Your own | Built in code with the template builder |
A template list that comes back empty does not mean you have none to use: base is always available.
Control plane and data plane
Section titled “Control plane and data plane”The SDKs talk to two endpoints:
- The control plane (the API at
SVM_DOMAIN) creates, lists, pauses, resumes, snapshots and kills sandboxes. It also manages templates, volumes, secrets, teams and usage. It authenticates with your API key. - The data plane is a guest agent inside each sandbox. It runs commands, PTYs, file operations and the code interpreter. It authenticates with a short-lived access token that the API returns when you create, connect to or resume a sandbox.
The SDK keeps that token in memory and refreshes it before it expires. If another client replaced it, the SDK reconnects once. The token never appears in logs or errors.
Lifecycle
Section titled “Lifecycle”creating → running ⇄ paused → killed │ ↑ └─ timeout ┘ (when on_timeout = pause)| State | Meaning |
|---|---|
running |
Commands, files and code run. |
paused |
Memory and disk are kept (or only the disk, after a filesystem pause). It is not billed for CPU. connect or resume brings it back. |
| killed | The sandbox and its disk are gone. Snapshots and volumes you made survive it. |
A sandbox’s timeout is 300 seconds unless you set another; your plan caps it. When the timeout passes, the sandbox is killed,
or paused if you set on_timeout: pause. set_timeout moves the deadline.
Persistence
Section titled “Persistence”- Pause and resume keep one sandbox across idle periods.
- Snapshots capture a sandbox so that you can start new sandboxes from it later.
- Forks copy a running sandbox into one or more live children.
- Rollouts fork one sandbox many times, run a script in each, verify the results and keep the ones that passed.
- Volumes are disks that live apart from any sandbox and are mounted at create time.
One surface, five SDKs
Section titled “One surface, five SDKs”Python is the reference. Every method exists in each SDK under that language’s naming. Where a language has no such method, the reference says so.
| Python | TypeScript | Go | Ruby | Java |
|---|---|---|---|---|
Sandbox.create(template="base") |
Sandbox.create({ template: "base" }) |
client.CreateSandbox(ctx, …) |
SVM::Sandbox.create(template: "base") |
Sandbox.create(client, opts) |
sandbox.commands.run(cmd) |
sandbox.commands.run(cmd) |
sb.Commands().Run(ctx, cmd) |
sandbox.commands.run(cmd) |
sandbox.commands().run(cmd) |
sandbox.files.write(path, data) |
sandbox.files.write(path, data) |
sb.Files().Write(ctx, path, data) |
sandbox.files.write(path, data) |
sandbox.files().write(path, data) |
ApiError |
ApiError |
*APIError |
SVM::ApiError |
ApiException |