On Runtime, one call makes 1 to 100 running copies. The snapshot that a fork takes for itself is free. Copies are billed as new sandboxes of the same size. A 2 vCPU, 4 GiB copy costs $0.03125 an hour while it waits, and $0.08 an hour with both CPUs busy (pricing).
Why AI agents fork
An agent often reaches a point worth branching from. The repository is cloned, the dependencies are installed, the tests have run once, and a server is up. From there, the agent may want to try three fixes, sample several model answers, or run many evaluation episodes. A fork gives each attempt its own copy of that moment, including its memory and processes. No attempt repeats the setup, and no attempt can disturb another.
A fork differs from a fresh sandbox built from an image. An image holds files. A fork also holds what was in memory: a loaded model, a warm cache, a shell partway through a session, and a running dev server.
Runtime's forks in facts
| Fact | Value |
|---|---|
| What is copied | Files, memory and running processes |
| Copies per call | 1 to 100 on prepaid credit, 1 to 4 without credit, all running when the call returns |
| Size | Each copy gets the source's vCPUs, memory, disk and CPU setting |
| Price | Each copy is billed as a create of that size would be |
| The fork's snapshot | Deleted when the fork ends and not billed, unless you keep it |
| Source sandbox | Paused for the capture, then woken before the fork returns |
| Where copies run | On the source's server while it has room; on another, the snapshot copied there first, when it is full |
| Funding | Accepted and ignored: copies run on what the account runs on |
If one copy fails, the error's
details.startedSandboxIds names the copies that did start
(snapshots and forks).
Fork a prepared sandbox
TypeScriptimport { Sandbox } from "withruntime";await using base = await Sandbox.create();await base.exec("pip install --quiet requests");const [a, b] = await base.fork({ count: 2 }); // both running, answered togetherawait Promise.all([a!.stop(), b!.stop()]);Pythonfrom withruntime import Runtimeruntime = Runtime()with runtime.sandboxes.create() as base: base.exec("pip install --quiet requests") for fork in base.fork(count=2): fork.stop()The CLI does the same with runtime sandboxes fork <id> --count 3. Pass
keepSnapshot: true to keep the fork's snapshot and start more copies later.
The kept snapshot is then billed as snapshot
storage, at $0.08 per decimal GB per 30-day month (rate in
force since 23 September 2026). An agent connected through MCP forks with the
runtime_sandboxes_fork tool.
Related
- What is a sandbox snapshot?
- RL environments
- Agent evals and SWE-bench
- A sandbox for a coding agent
- Pricing
Facts on this page were checked on 25 October 2026.