Snapshots are available on Firecracker and QEMU for Linux guests that use isolated disks. Windows guests, workspace mounts, and extra drives are not supported yet. QEMU snapshots require a qcow2 per-VM disk, so raw QEMU disks created for
grow_filesystem=True cannot be snapshotted.When to use snapshots
- Checkpoint before risky operations — Save state before an agent runs untrusted code, so you can roll back if something goes wrong.
- Reuse a configured environment — Set up a sandbox with the right packages and files, snapshot it, and restore it multiple times instead of repeating setup.
- Speed up agent workflows — Skip boot and configuration time by restoring from a ready-to-go snapshot.
Create a snapshot
To create a snapshot, the VM must be running or paused. SmolVM pauses the VM during snapshot creation and optionally resumes it afterward.- Python SDK
- CLI
resume_source=True to keep working with it:snapshot_id, SmolVM generates one automatically (for example, snap-my-vm-1717012345).Choose a snapshot type
When you create a snapshot, you can pick how much of the VM to store:full(default) — Saves a complete, self-contained disk copy plus the guest’s memory and CPU state. Use this when you want to resume the sandbox exactly where you left off.diff— Saves a smaller disk artifact. On QEMU, the snapshot state is stored inside the qcow2 artifact and the backing image must still exist at restore time. On Firecracker, SmolVM still captures memory and VM state in full, and uses a copy-on-write disk copy when the host filesystem supports it.disk— Saves only the disk and skips the memory dump. Restoring boots the sandbox fresh from that disk instead of resuming the exact running process state. Use this when you only need filesystem state and a cold boot is acceptable.
full and diff snapshots capture VM state and memory. disk snapshots copy only the managed disk, so they restore with a fresh boot.
disk snapshots are much faster and use less space than full because they skip the RAM dump. They are the right choice for workflows where you only need the filesystem state.- Python SDK
- CLI
SnapshotType enum for type safety:disk snapshot when you want to save the filesystem state quickly and don’t need to resume the running process state:
If the backing image for a QEMU diff snapshot is missing at restore time, SmolVM raises a clear error pointing to the missing path and suggesting you take a
full snapshot instead. To stay safe, keep backing images in place while their diff snapshots exist.Keep a running QEMU sandbox available
By default, snapshot creation may briefly pause a running sandbox while SmolVM captures state. For QEMU disk snapshots, live capture keeps the guest running throughout — SmolVM copies the disk in the background without stopping the VM. If the installed QEMU cannot do a live block backup, the command fails rather than silently falling back to a pause. Use live capture when a sandbox must stay reachable during the snapshot — for example, a long-running agent or an interactive session you don’t want to interrupt. Live capture has three requirements:- The backend must be QEMU.
snapshot_typemust bedisk— memory is not captured.resume_sourcemust beTrue(--resume-sourceon the CLI). The sandbox stays running end-to-end.
- Python SDK
- CLI
timeout_seconds— maximum time to wait for the background copy (default600.0).max_bytes_per_second— cap the backup I/O bandwidth to protect other workloads.
Live capture is crash-consistent by default: the resulting disk looks like the guest was power-cut at the capture moment. Combine it with the guest flush policy below to reduce the chance of losing in-flight writes.
Control the guest flush before a disk snapshot
Before a disk snapshot, SmolVM asks the guest agent to flush pending filesystem writes so the copied disk includes recent changes.flush_policy decides what happens if that flush fails:
required(default) — Fail the snapshot if the flush cannot succeed. Safest for workflows that need up-to-date disk state.best-effort— Try to flush, but continue and take a crash-consistent snapshot if the flush fails. Useful when the guest agent may be unavailable but you still want a snapshot.skip— Do not attempt the flush. Fastest, and the right choice when the guest has already been quiesced or when a crash-consistent copy is acceptable.
flush_policy applies to all disk snapshots — paused or live.
- Python SDK
- CLI
How SmolVM prepares the guest
Before SmolVM captures a disk snapshot, it asks the guest to save pending filesystem changes. Recent SmolVM images use the Rust guest agent over vsock for this sync step. You can adjust this behavior withflush_policy (see Control the guest flush before a disk snapshot).
The sync path matters because it happens before SmolVM creates snapshot files:
1
SmolVM reaches the guest
SmolVM uses the selected control channel. On recent Linux images, this is usually vsock. On compatibility paths, it can be SSH.
2
The guest saves file changes
The guest agent exposes a dedicated
/sync endpoint. Older compatibility paths may use a raw command to ask the guest to flush files.3
SmolVM pauses and captures state
After sync succeeds, SmolVM pauses the sandbox and writes the snapshot artifacts for the selected snapshot type.
Restore a snapshot
Restoring a snapshot recreates the original VM with the saved state. The restored VM starts in a paused state by default.- Python SDK
- CLI
force flag:
- Python SDK
- CLI
List snapshots
- Python SDK
- CLI
Delete a snapshot
Deleting a snapshot removes the saved state files and metadata. You cannot delete a snapshot while a restored VM from that snapshot is still running.- Python SDK
- CLI
Full example: checkpoint and retry
This example shows how an agent can checkpoint a sandbox before running untrusted code, then roll back if something fails.Snapshot ID rules
Snapshot IDs must contain only lowercase letters, numbers, hyphens, and underscores. SmolVM validates this on creation and raises an error for invalid IDs. Valid examples:my-checkpoint, snap-agent-001, pre-deploy-v2
Error handling
SmolVM provides specific exceptions for snapshot operations:Next steps
Snapshot CLI reference
Full list of snapshot CLI commands and options
SnapshotInfo API
Snapshot metadata returned by the SDK
VM lifecycle
Understand the full sandbox lifecycle
AI agent integration
Build secure agent sandboxes with checkpointing
