# Sandbox Snapshot - Documentation

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/guides/sandbox-snapshot

# Sandbox Snapshot

A snapshot is a reusable saved state of a sandbox. It captures the sandbox filesystem and memory state so you can start new sandboxes from that point later.
Novita also describes this concept as committing a sandbox into a snapshot. Use snapshots when you want to:

- Prepare dependencies once and reuse them in later sandboxes.

- Save a known-good state before running risky or expensive work.

- Start multiple sandboxes from the same captured environment.

- Keep a reusable state after the original sandbox is no longer needed.

For continuing the same sandbox later, use [Sandbox Persistence](/docs/guides/sandbox-persistence). For creating new sandboxes from a saved point, use snapshots.

##

[​](#terminology)

Terminology

- Origin Sandbox: The sandbox instance used to create the snapshot.

- Snapshot: The saved state that can be used to create new sandboxes.

- New Sandbox: A sandbox created from the snapshot.

##

[​](#create-a-snapshot)

Create a snapshot

You can use the `createSnapshot` method in JavaScript or `create_snapshot` method in Python to create a snapshot from a running sandbox. The sandbox is paused while the snapshot is being created, then can continue running after the operation completes.

Python

JavaScript & TypeScript

```
from novita_sandbox.code_interpreter import Sandbox

sandbox = Sandbox.create()
sandbox.commands.run("echo ready > /tmp/status.txt")

snapshot = sandbox.create_snapshot()
print(snapshot.snapshot_id)
```

You can also create a snapshot by sandbox ID.

Python

JavaScript & TypeScript

```
snapshot = Sandbox.create_snapshot(sandbox_id)
```

Store the returned snapshot ID. Then you can use it as the template when creating a new sandbox.

##

[​](#create-a-sandbox-from-a-snapshot)

Create a sandbox from a snapshot

You can pass the snapshot ID to `create` to start a new sandbox from the captured state.

Python

JavaScript & TypeScript

```
snapshot_id = snapshot.snapshot_id

new_sandbox = Sandbox.create(template=snapshot_id)
result = new_sandbox.commands.run("cat /tmp/status.txt")
print(result.stdout)
```

The new sandbox has its own sandbox ID and lifecycle. Killing the original sandbox does not delete the snapshot.

##

[​](#list-snapshots)

List snapshots

You can use the `listSnapshots` method in JavaScript or `list_snapshots` method in Python when you need to find saved states for a sandbox or for your account.

Python

JavaScript & TypeScript

```
# List snapshots created from one sandbox.
paginator = sandbox.list_snapshots(limit=20)

while paginator.has_next:
for snapshot in paginator.next_items():
print(snapshot.snapshot_id)

# Or list all snapshots.
paginator = Sandbox.list_snapshots(limit=20)
```

You can filter by source sandbox ID when listing all snapshots.

Python

JavaScript & TypeScript

```
paginator = Sandbox.list_snapshots(sandbox_id=sandbox_id, limit=20)
```

##

[​](#delete-a-snapshot)

Delete a snapshot

You can use the `deleteSnapshot` method in JavaScript or `delete_snapshot` method in Python to delete snapshots you no longer need. A snapshot may not be deletable while running sandboxes are still using it as their source, so kill those sandboxes before deleting the snapshot.

Python

JavaScript & TypeScript

```
new_sandbox.kill()
Sandbox.delete_snapshot(snapshot_id)
```

##

[​](#snapshot-recommendations)

Snapshot recommendations

- Snapshot after setup steps finish successfully.

- Keep snapshot IDs in your own database if jobs need to reuse them later.

- Use metadata on sandboxes to track where saved states came from.

- Delete unused snapshots to avoid keeping stale saved states.

- Use [Sandbox Persistence](/docs/guides/sandbox-persistence) instead if you only need to pause and resume the same sandbox.

Last modified on June 8, 2026
