Visual explainer

How snapshots and forking work

A fresh sandbox forgets everything. Snapshots and forking let one save state, branch it, pause it, and rewind it. Follow a machine's state as it is frozen, thawed and cloned, one scroll at a time.

Scroll to begin
01/ 08
Every cold run starts from zero setup, paid every time boot install deps warm cache run thrown away after, so the next run repeats it Freeze the whole machine running sandbox memory CPU disk snapshot snapshot memory+CPU+disk Thaw it in a fraction of the time snapshot restore ready, already warm memory CPU disk skips boot, install and cache warming Branch it into many snapshot fork A fork B fork C one saved state, many live copies Why forks are cheap fork A writes fork B fork C shared memory + disk pages (read-only) only the changed pages cost extra Park it while it sits idle running compute: on pause parked state kept compute: 0 billing stops, the machine is kept Rewind an agent t1 t2 t3 t4 t5 fails roll back to the last good state snapshot before each step, fork to explore The fine print storage you pay to keep snapshots warm vs cold resume only helps when it is warm support not every sandbox can do it
STEP 01 · The problem

The real cost is starting over

Spin up a fresh sandbox and it knows nothing: it boots, installs your dependencies, and warms its caches before it runs a single useful line. Do that on every call and the setup, not the work, dominates the time and the bill. Snapshots exist to skip it.

STEP 02 · Snapshot

Freeze the whole machine

A snapshot captures the sandbox's entire state, its memory, CPU registers and disk, and writes it to storage. Not just the files: the running process, loaded libraries and warm caches are all frozen exactly as they were.

STEP 03 · Snapshot

Thaw it, warm, in a flash

Restoring loads that saved state back into a live machine. Because the environment is already set up and already warm, a restore skips the boot, the installs and the cache warming entirely, so it returns in a fraction of a cold start.

STEP 04 · Forking

Branch one state into many

A fork spins up a new live sandbox from a snapshot. One saved state can seed many forks at once, each an independent machine that begins from the identical, already-warm starting point.

STEP 05 · Forking

Copy-on-write makes it cheap

Forks do not each copy the whole machine. They share the parent's unchanged memory and disk pages and only store what they change. Ten forks of a 2 GB machine cost the shared 2 GB plus each fork's small set of writes, not 20 GB.

STEP 06 · In practice

Park it to stop the bill

The same freeze lets you pause an idle sandbox. Its state is kept, but compute billing stops while nothing runs, and you resume the exact machine later. On a long agent task, that turns dead thinking time into near-zero cost.

STEP 07 · In practice

Rewind an agent that fails

Snapshot before each risky step and a failed tool call is no longer fatal: roll back to the exact state just before it, instead of restarting the whole task. The same move, forking one state into many attempts, is how reinforcement-learning rollouts explore.

STEP 08 · In practice

What it costs you

Snapshots are not free. You pay to store them, a restore only helps when the snapshot is genuinely warm, and support varies: some sandboxes do full memory snapshots, some only disk, and some none at all. Match the feature to how often you actually branch or pause.

The short version

Keeping and branching a sandbox's state

A sandbox is disposable by design, but throwing everything away after every run is wasteful. Snapshots and forking are how modern sandboxes get the best of both: a clean, isolated machine, without paying the full setup cost each time. The idea is simple once you separate three moves, save, restore, and branch.

Snapshot and restore: skip the setup, not the isolation

A snapshot freezes a machine's full state, memory, CPU and disk, into storage. A restore loads it back into a live sandbox. Because the restored machine is already booted, already has your dependencies, and still holds its warm caches, it is ready far faster than a cold start that has to redo all of that. You keep the isolation of a fresh environment while skipping the part that was slow.

Forking and copy-on-write: why branching is cheap

A fork starts a new live sandbox from a snapshot, and you can start many at once. The reason this is not ruinously expensive is copy-on-write: the forks share the parent's unchanged memory and disk pages and only allocate space for what each one writes. That shared-page trick is what makes it practical to branch one warm state into dozens of parallel copies, which is exactly what a reinforcement-learning rollout or a parallel agent search needs.

What it unlocks: pausing and rewinding

Two payoffs fall out of the same machinery. Pausing freezes an idle sandbox so its state survives while compute billing stops, which matters on long agent tasks with a lot of think time between actions. Rewinding uses a snapshot taken before each step so a failed tool call rolls back to the last good state instead of restarting the whole run. Both turn "state" from something you rebuild into something you move around.

Who keeps state, and how Full benchmark →
SandboxStartIsolationState handling
Daytona 90ms Docker container Persistent workspaces, snapshots
E2B 150ms Firecracker microVM Pause/resume with memory state, snapshots
Fly.io Machines 300ms microVM Persistent ext4 filesystem, checkpoints
Vercel Sandbox 400ms Firecracker microVM Persistent by default
Runloop 400ms microVM Git-style disk snapshots + branching
CodeSandbox SDK 500ms Firecracker microVM Git-versioned filesystem, forking

Live from our vendor data, verified and dated on each vendor page. "State handling" is each provider's own description of persistence, snapshots and forking.

Frequently asked

What's the difference between a snapshot and a fork?

A snapshot is a frozen copy of a sandbox's full state, its memory, CPU and disk, saved to storage. A fork is a new live sandbox branched from a snapshot. One snapshot can spawn many forks, and each starts from the same saved point.

How is restoring from a snapshot faster than a cold start?

A cold start boots a kernel and then re-runs your setup: installing packages, warming caches. Restoring skips all of that. It loads a machine that is already set up and already warm, so the environment is ready in a fraction of the time a fresh boot would take.

Why are forks cheap to create?

Forks share the parent's unchanged memory and disk pages and only store what each one changes, an approach called copy-on-write. Ten forks of a 2 GB machine do not cost 20 GB; they cost the shared 2 GB plus each fork's small set of writes.

Can I stop paying while a sandbox sits idle?

On providers that support pausing, yes. Freeze the sandbox and its state is kept while compute billing stops, then resume the same machine later. E2B, for example, offers pause and resume with the memory state intact.

How does this help an AI agent?

An agent can snapshot before each risky step, then roll back to the exact state just before a failed tool call instead of restarting the whole task. The same trick powers reinforcement-learning rollouts, where one saved state is forked into many parallel attempts.

Which sandboxes support snapshots and forking?

In our dataset, E2B offers pause and resume with memory snapshots, Runloop does git-style disk snapshots with branching, CodeSandbox has a git-versioned forking filesystem, and Fly Machines keep checkpoints. Support and granularity vary, so check each vendor page.

The Sandbox Brief

What moved in the sandbox world, every Friday.

Pricing changes, new entrants, benchmark refreshes and one sharp take from Eve Harper. Read by engineers choosing where their agents and apps run. No fluff. Read the archive.

Free · unsubscribe anytime · no spam.