Sandbox

Snapshots

Capture a point-in-time VM snapshot of any Tenki Sandbox session, then restore it later as a new session.

A snapshot is a restorable VM capture of one session, including both disk and memory state. Restore a snapshot to spin up a new session in the exact state of the original.

Manage snapshots

Pick your tool, and the selection syncs across the rest of the page.

Create

tenki sandbox snapshot create --session <session-id> --name baseline

With expiration:

tenki sandbox snapshot create \
  --session <session-id> \
  --name before-upgrade \
  --expires-at 2026-03-20T12:00:00Z
const snapshot = await sandbox.createSnapshotAndWait(session.id, {
  name: "after-setup",
});

One-shot, returns once the snapshot is READY:

snapshot, err := client.CreateSnapshotAndWait(
  ctx,
  session.ID,
  "baseline",
  nil,
  tenkisandbox.DefaultSnapshotCreateTimeout,
)

Or kick off the create async and wait separately:

snapshot, err := client.CreateSnapshot(ctx, session.ID, "baseline", nil)
snapshot, err = client.WaitSnapshotReady(ctx, snapshot.ID, 5*time.Minute)
# From a live sandbox; waits for the snapshot to become READY by default.
snapshot = sb.snapshot(name="after-setup")

Or drive it through the client, optionally without waiting:

snapshot = client.snapshots.create_and_wait(sb.id, name="baseline")

# Async, then wait separately:
snapshot = client.snapshots.create(sb.id, name="baseline")
snapshot = client.snapshots.wait_ready(snapshot.id, timeout=300)

List, inspect, delete

const snapshot = await sandbox.getSnapshot(snapshotId);
const snapshots = await sandbox.listSnapshots();
await sandbox.deleteSnapshot(snapshotId);
snapshot = client.snapshots.get(snapshot_id)
snapshots = client.snapshots.list()
snapshot = client.snapshots.delete(snapshot_id)
snapshot, err := client.GetSnapshot(ctx, snapshotID)
snapshots, err := client.ListSnapshots(ctx)
snapshot, err = client.DeleteSnapshot(ctx, snapshotID)
tenki sandbox snapshot list
tenki sandbox snapshot list --json
tenki sandbox snapshot get <snapshot-id>
tenki sandbox snapshot delete <snapshot-id>

Published snapshots stay pinned

Publishing a snapshot creates a version of a registry image. Every registry version keeps its source snapshot pinned, so snapshot delete cannot remove that snapshot while any version still references it. Moving a tag does not remove the older version or release its pin.

To release an old snapshot:

  1. Make the registry version eligible for deletion. It must not be the image's latest version, must be untagged, and must not be referenced by a share. Publish a newer version, move any tag to another version, and revoke any share that still uses it.

  2. Delete the historical registry version by image ref or ID and snapshot ID:

    tenki sandbox registry version delete <image-ref-or-id> --snapshot-id <snapshot-id>
  3. If no other references remain, delete the snapshot if you no longer need it:

    tenki sandbox snapshot delete <snapshot-id>

Deleting a registry version releases only that version's pin; it does not delete the snapshot itself. Other references can keep the snapshot pinned. In particular, a snapshot created by a template build can remain pinned by that build. A delete against a latest, tagged, or shared version fails, and the error names the rule that still applies.

Restore

tenki sandbox snapshot restore <snapshot-id> --name restored-copy

snapshot restore is a convenience wrapper over:

tenki sandbox create --snapshot <snapshot-id>
const restored = await sandbox.createAndWait({
  snapshotId: snapshot.id,
});
restored, err := client.Create(
  ctx,
  tenkisandbox.WithSnapshot(snapshotID),
  tenkisandbox.WithName("restored-copy"),
)
restored = Sandbox.create(snapshot_id=snapshot.id, name="restored-copy")

Snapshot metadata

A snapshot moves through CREATING, READY, FAILED, DELETING, and DELETED; wait for READY before restoring from it. Each record also reports its size (size_bytes, compressed_bytes, memory_bytes), the session and base image it came from, when it was created, and an optional expires_at after which it is deleted.

Volumes are not auto-restored

Snapshots capture disk and memory, but not a session's attached volumes. A restored session is a normal session, so it comes up with no volumes attached. Reattach any volume you need explicitly, at create time or with volume attach. See Volumes for the volume API.

Errors

Snapshot calls can fail when the snapshot ID is unknown or when creation fails. Every SDK surfaces these as typed errors or exceptions; see the SDK reference for the names in each language.