Skip to main content
Snapshots let you capture and duplicate box state. Use snapshots to save a point-in-time checkpoint you can restore later.

What’s included

A snapshot captures:
  • Filesystem: the disk state of the box at the time of the snapshot, including cloned repos and installed packages.
  • Box configuration: the agent model, runtime, and browser setting. The agent harness is taken from the source box.
A restored box does not inherit:
  • Agent API key: a key passed directly as apiKey is not stored in the snapshot. The restored box uses your stored key for that provider or the Upstash-managed key. Pass agent again to use your own key.
  • Network policy: pass networkPolicy again on restore.
  • Attach headers: pass attachHeaders again on restore.
  • Lifecycle settings: init command, keep-alive, and size use the values passed on restore.
  • Schedules: active schedules are not carried over.
Snapshots are the best way to preserve cloned repositories, installed dependencies, and prepared workspaces. If your box already has a repo checked out, restoring from a snapshot is usually faster than cloning it again.

API

Create a snapshot

Call snapshot() on a running or paused box. The returned Snapshot object contains the ID you need to restore later.
Snapshots are independent of the source box. Deleting the original box does not delete its snapshots. They remain available for restore at any time.

List snapshots

Retrieve all snapshots belonging to a box.

Delete a snapshot

Remove a snapshot by ID.

Restore from a snapshot

Box.fromSnapshot() provisions a new box from the snapshot’s filesystem and agent model. The original box is unaffected. You can branch into multiple boxes from the same checkpoint.
The restored box starts with the same workspace state from the snapshot. Settings that are not inherited, such as agent.apiKey, networkPolicy, attachHeaders, initCommand, and keepAlive, can be passed to fromSnapshot(). Env vars from the source box carry over.

Examples

Checkpoint before risky operations

Snapshot your working state, then let the agent attempt a large refactor. If the result is bad, we restore the original state and try a different prompt.

Reusable base environments

Install dependencies once, snapshot, then spawn boxes from the snapshot to skip setup time.

Fan-out from a single state

Clone a repo once, snapshot, then run different agents or prompts in parallel from the same starting point.