Skip to main content
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. For creating new sandboxes from a saved point, use snapshots.

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

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.
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)
import { Sandbox } from 'novita-sandbox/code-interpreter'

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

const snapshot = await sandbox.createSnapshot()
console.log(snapshot.snapshotId)
You can also create a snapshot by sandbox ID.
snapshot = Sandbox.create_snapshot(sandbox_id)
const snapshot = await Sandbox.createSnapshot(sandboxId)
Store the returned snapshot ID. Then you can use it as the template when creating a new sandbox.

Create a sandbox from a snapshot

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

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

const newSandbox = await Sandbox.create(snapshotId)
const result = await newSandbox.commands.run('cat /tmp/status.txt')
console.log(result.stdout)
The new sandbox has its own sandbox ID and lifecycle. Killing the original sandbox does not delete the snapshot.

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.
# 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)
// List snapshots created from one sandbox.
const paginator = sandbox.listSnapshots({ limit: 20 })

while (paginator.hasNext) {
  const snapshots = await paginator.nextItems()
  for (const snapshot of snapshots) {
    console.log(snapshot.snapshotId)
  }
}

// Or list all snapshots.
const allSnapshots = Sandbox.listSnapshots({ limit: 20 })
You can filter by source sandbox ID when listing all snapshots.
paginator = Sandbox.list_snapshots(sandbox_id=sandbox_id, limit=20)
const paginator = Sandbox.listSnapshots({ sandboxId, limit: 20 })

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.
new_sandbox.kill()
Sandbox.delete_snapshot(snapshot_id)
await newSandbox.kill()
await Sandbox.deleteSnapshot(snapshotId)

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 instead if you only need to pause and resume the same sandbox.
Last modified on June 8, 2026