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
6 changes: 6 additions & 0 deletions docs/sandbox/snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

The original sandbox continues running after the snapshot is created, and a single snapshot can be used to create many new sandboxes.

## Prerequisites

Snapshots require templates with envd version `v0.5.0` or above. If you are using a custom template created before envd `v0.5.0`, you need to rebuild it.

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L13

Did you really mean 'envd'?

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L13

Did you really mean 'envd'?

You can check the template envd version using the `e2b template list` command or by viewing the templates list on the dashboard.

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L15

Did you really mean 'envd'?

## Snapshots vs. Pause/Resume

| | Pause/Resume | Snapshots |
Expand Down Expand Up @@ -91,7 +97,7 @@
const snapshot = await sandbox.createSnapshot()

// Create a new sandbox from the snapshot
const newSandbox = await Sandbox.create(snapshot.snapshotId)

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L100

Did you really mean 'newSandbox'?
```
```python Python highlight={5}
from e2b import Sandbox
Expand All @@ -105,17 +111,17 @@

## List snapshots

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

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L114

Did you really mean 'paginator'?

<CodeGroup>
```js JavaScript & TypeScript
import { Sandbox } from 'e2b'

const paginator = Sandbox.listSnapshots()

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L120

Did you really mean 'paginator'?

const snapshots = []
while (paginator.hasNext) {
const items = await paginator.nextItems()

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

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L124

Did you really mean 'paginator'?
snapshots.push(...items)
}
```
Expand Down Expand Up @@ -174,15 +180,15 @@
|---|---|---|
| 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 183 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L183

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 190 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L190

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 191 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L191

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 193 in docs/sandbox/snapshots.mdx

View check run for this annotation

Mintlify / Mintlify Validation (e2b) - vale-spellcheck

docs/sandbox/snapshots.mdx#L193

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