Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/sandbox/snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

## List snapshots

You can list all snapshots. The method returns a paginator for iterating through results.

Check warning on line 108 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L108

Did you really mean 'paginator'?

<CodeGroup>
```js JavaScript & TypeScript
Expand Down Expand Up @@ -165,3 +165,24 @@
Sandbox.delete_snapshot(snapshot.snapshot_id)
```
</CodeGroup>

## Snapshots vs. Templates

Both snapshots and [templates](/docs/template/quickstart) create reusable starting points for sandboxes, but they solve different problems.

| | Templates | Snapshots |
|---|---|---|
| Defined by | Declarative code (Template builder) | Capturing a running sandbox |
| Reproducibility | Same definition produces the same sandbox every time | Captures whatever state exists at that moment |
| Best for | Repeatable base environments | Checkpointing, rollback, forking runtime state |

Check warning on line 177 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L177

Did you really mean 'Checkpointing'?

Use templates when every sandbox should start from an identical, known state — pre-installed tools, fixed configurations, consistent environments.
Use snapshots when you need to capture or fork live runtime state that depends on what happened during execution.

## Use cases

- **Checkpointing agent work** — an AI agent has loaded data and produced partial results in memory. Snapshot it so you can resume or fork from that point later.

Check warning on line 184 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L184

Did you really mean 'Checkpointing'?
- **Rollback points** — snapshot before a risky or expensive operation (running untrusted code, applying a migration, refactoring a web app). If it fails, rollback - spawn a fresh sandbox from the snapshot before the operation happened.

Check warning on line 185 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L185

Did you really mean 'untrusted'?
- **Forking workflows** — spawn multiple sandboxes from the same snapshot to explore different approaches in parallel.
- **Cached sandboxes** — avoid repeating expensive setup by snapshotting a sandbox that has already loaded a large dataset or started a long-running process.

Check warning on line 187 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L187

Did you really mean 'snapshotting'?
- **Sharing state** — one user or agent configures an environment interactively, snapshots it, and others start from that exact state.