Skip to main content
A snapshot captures the complete state of a running sandbox — memory contents, filesystem, and process state — and saves it to persistent storage. Snapshots can be restored to create new sandboxes that resume exactly where the original left off.

Create a snapshot

SnapshotInfo model

Restore from a snapshot

Pass a snapshot_id to Sandbox.create() to start a new sandbox that resumes from that state.

List snapshots

Lifecycle during snapshot

When create_snapshot() is called, the sandbox briefly pauses to capture a consistent memory image and then resumes automatically. The sandbox continues running after the snapshot completes. The snapshotting pause is typically under one second for sandboxes with 256 MB of RAM.

Use cases

Install heavy ML libraries once, snapshot the result, then create new sandboxes from that snapshot for every request. Eliminates the pip install torch overhead from every run.
Snapshot a sandbox mid-computation so you can restore it if the run fails.
Create multiple independent sandboxes from the same snapshot to explore different execution paths.
Snapshots capture the state of a single sandbox at a point in time. They do not capture external state such as in-flight network connections, database transactions, or changes to services outside the sandbox.