Skip to main content
Before a new sandbox can do real work, it usually needs the same setup: clone the repository, install dependencies, download a model, start a server. If every sandbox does that from scratch, each one spends minutes of waiting, and of paid compute, before any real work starts. A snapshot removes that wait. You prepare one sandbox exactly the way you want it, take a snapshot of it, and then start new sandboxes from the snapshot. A snapshot keeps the sandbox’s whole state: its files, its running programs and their memory. Each new sandbox starts exactly where the snapshot was: the files are in place, the programs are running, and the data is already in memory. The setup happens once, and every sandbox after that is ready to work immediately. Here is the difference:

Take a snapshot

In this example, the snapshot is of a small app whose dependencies are installed and whose server is already running, with data loaded into memory.
1

Prepare a sandbox

Start a sandbox and do all the slow work you want to save your future sandboxes from: install, build, load data, start servers.
curl: install and start the app
response
2

Take the snapshot

response
Taking a snapshot does not stop the sandbox: it keeps running. Snapshot names can use lowercase letters, digits and -.
3

Start sandboxes from it

Now create sandboxes from the snapshot. Each one is a new, separate sandbox with its own ID, address and files, but it starts exactly as the snapshot was. This example creates three at once, one for each of three users:
curl: the server is already up
response
stdout holds the server’s answer, which looks like this:
stdout
Every new sandbox reports the same bootedAt time, which is the moment the snapshot’s server started. None of them ran npm install, started the server or built the catalog. They all began with that work already done.

What a new sandbox gets

A sandbox created from a snapshot shares some things with the snapshot and has others of its own:
When you create a sandbox from a snapshot, you can only set lifetime_sec, idle_timeout_sec and labels. Everything else comes from the snapshot. If you send another setting, the request is refused with 400 snapshot_fields_fixed.

Where snapshots fit

Snapshots help wherever many sandboxes need the same starting point:
  • A workspace per user. Keep one snapshot with your stack. Each user’s sandbox is created from it, and is ready the moment they sign in.
  • Agents in parallel. Keep one snapshot with the repository cloned and dependencies installed, and create one sandbox per task.
  • Evals and reinforcement learning. Every episode gets a fresh, identical environment, with nothing left over from the previous one.
  • Code interpreters. Keep a Python process with pandas and your libraries already imported, so the user’s first piece of code runs at once.
Put the slow, shared work in the snapshot, and the per-user work in each sandbox. Install and load before you take the snapshot, then add each user’s own data after their sandbox starts. When your dependencies change, take a new snapshot.

List and delete

You can list your snapshots, with what each one stores, and delete the ones you no longer need:
  • Deleting the sandbox you took a snapshot of does not delete the snapshot. The snapshot is kept separately.
  • A snapshot cannot be deleted while sandboxes created from it still exist. Delete those sandboxes first.
  • A snapshot is kept until you delete it. It does not expire.

What it costs

A snapshot is stored, so it counts towards your account’s storage for as long as you keep it. Every account includes 20 GB of storage, shared by your snapshots and your sleeping sandboxes, and storage beyond that costs $0.10 per GB per month. See pricing. Each snapshot tells you what it stores and what that size costs:
  • size_bytes: how much it stores, files, memory and running programs together.
  • monthly_cost_usd: what that size costs a month at the storage price. Your included 20 GB come first, so while your storage stays under it, you pay nothing for it.
Delete the snapshots you no longer need to stop paying for them.

Good to know

A few more details:

Errors

These are the errors you may see when working with snapshots. A snapshot of a vm sandbox is also refused while a command is still running in it, so wait for its commands to finish first.

Images and builds

Where a sandbox starts on day one: a registry image or one built from a Dockerfile.

Sleep and wake

The same memory-keeping that makes snapshots work.