# What is a sandbox fork? A sandbox fork is a new sandbox copied from a running one, with its files, memory and running processes exactly as they were. **On Runtime one call makes 1 to 10 running copies, and the snapshot the fork takes for itself is free.** Copies are billed as new sandboxes of the same size, so a 2 vCPU, 4 GiB copy costs $0.03125 an hour while it waits and $0.08 with both CPUs busy ([pricing](/docs/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, a server is up. From there it 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, memory and processes included, so none repeats the setup and none 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 warmed cache, a shell halfway through a session, a running dev server. ## Runtime's forks in facts | Fact | Value | | ------------------- | -------------------------------------------------------------------------------- | | What is copied | Files, memory and running processes | | Copies per call | 1 to 10, all running when the call answers | | 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 moment the fork takes (about a second when fresh), then woken | | Where copies run | On the source's server | | Funding | `"trial"` or `"paid"`, as a create; without it, copies keep the source's funding | A sandbox created with `pausable: false` cannot be forked, because a fork pauses its source for a moment. If one copy fails, the error's `details.startedSandboxIds` names the copies that did start ([snapshots and forks](/docs/javascript#snapshots-and-forks)). ## Fork a prepared sandbox ```ts check import { 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 together await Promise.all([a!.stop(), b!.stop()]); ``` ```python check from withruntime import Runtime runtime = 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 sandbox fork --count 3`. Pass `keepSnapshot: true` to keep the fork's snapshot and start more copies later; it is then billed as [snapshot](/glossary/sandbox-snapshot) storage, $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_sandbox_fork` tool. ## Related - [What is a sandbox snapshot?](/glossary/sandbox-snapshot) - [RL environments](/use-cases/rl-environments) - [Agent evals and SWE-bench](/use-cases/agent-evals-and-swe-bench) - [A sandbox for a coding agent](/use-cases/coding-agent-sandbox) - [Pricing](/docs/pricing#snapshots-images-and-volumes) Facts on this page were checked on 25 September 2026.