group:member, or artifact path.
Export methods save and save_to accept the keyword compatibility ("current" by default, or "0.7.8"). The historical target writes archive extension names understood by 0.7.8 and refuses required behavior it cannot preserve. It does not convert checkpoint identity or VM state. See archive targets.
Use await ctx.snapshots.get(name) for a history and await ctx.checkpoints.get(id) for one checkpoint. Both collections retain the selected provider. Cloud supports individual disk checkpoints. Spawning from an exact remote checkpoint requires a managed ID. An explicit host-volume path restore selects the contents currently at that path.
Sandbox capture
sandbox.snapshot()
Sandbox. name selects a new group; initial_checkpoint names its first member. dest_dir selects the parent storage directory. An existing group is refused. Omitted member names are generated; capture is disk-only by default. Set full=True to capture memory and device state, or record_integrity=True to record payload checksums. guest_flush accepts "auto", "required" or "skip"; omission uses Auto.
Example
Example
Snapshot are now accessed through Checkpoint. Existing Checkpoint, builder, archive, ID, and verification type names remain; this public object rename does not rewrite persisted artifact IDs. Retained artifact helpers below also cover supported cloud workflows, where local group operations return unsupported.
Snapshot group methods
Snapshot.open()
get (Get in Go) to select a bare group name from the default store.
Snapshot.get()
Snapshot.list()
group.name
group.head()
None after explicit clearing.
group.checkpoints()
group.get_checkpoint()
group.set_head()
group.clear_head()
group.checkpoint()
name is generated. guest_flush accepts "auto", "required" or "skip"; omission uses Auto. An append does not accept a destination directory.
group.spawn_sandbox()
group.spawn_sandbox_with_progress()
session.result() for authoritative completion. End of progress is not success. session.cancel() requests cancellation; consume the result to learn whether cancellation or completion won. The same destination keywords apply.
Save an exact checkpoint
Example
Example
.msb archive. save_to retains its explicit options form for compatibility. See the archive compatibility option below before sending output to an older reader.
Group archive import
Snapshot.load()
maximum_disk_bytes limits total logical file bytes, including metadata, dependencies, and sparse holes. Each declared file disk must also fit. Omit it for no size limit. dest selects the parent storage directory; omission uses default storage. base supplies an external dependency snapshot or archive. set_head=True selects the unique imported tip even when it is not a fast-forward; ambiguous tips are refused.
Example
Example
files is a list of host paths. The keyword options are optional. Returns SnapshotImportResult with snapshot, checkpoints, added, reused, head_update, operation_id, and warnings properties.
The result contains every unique supplied checkpoint, including bundled dependencies, in stable ID order. added and reused identify what was new versus already installed at publication; archive argument order does not select the head. The head outcome belongs to this operation and does not change when another operation edits the group. Multiple incomparable tips can commit a headless group; explicit head selection refuses ambiguous tips.
A successful return confirms publication and catalog completion. Warnings describe deferred cleanup after commit. A structured import error distinguishes no publication, confirmed publication with a later failure, and an unknown outcome needing recovery. Import never binds a group to a source sandbox. See atomic import requirements for filesystem capabilities and maintenance requirements.
Group inspection
group.inspect()
checkpoint_count, source.recorded_name, source.current_name, source.database_uuid, source.sandbox_id; access them as dictionary keys, for example info["source"]["recorded_name"]. The source is absent for an unbound history; otherwise its status is available, missing_sandbox or different_catalog. Saved and current names distinguish renames; identity is the catalog UUID plus sandbox row ID, so deleting and recreating the same name does not rebind the group.
Source availability is observed separately from group metadata and is not a guarantee of later capture readiness. Inspection does not change the selected head or create a missing catalog identity. Invalid metadata and database failures remain errors, rather than being reported as unbound. Obtain a member with get_checkpoint for its immutable metadata.
Group verification
group.verify()
await (await Snapshot.get("worker")).verify() checks all pinned members and returns a dictionary with group, state, checkpoints, and payload_hashes. States distinguish complete, incomplete, invalid, and empty (zero checkpoints checked). Every member includes id, path, state, optional report using the existing checkpoint verification fields, and specific findings. Headless groups can be verified; to check only head, obtain the optional checkpoint and call its verify().
Unrecorded checksums remain incomplete. Corruption, missing files, unsupported requirements, and operational failures raise SnapshotVerificationError with the full dictionary in error.report; failures before a meaningful report exists retain their ordinary exception. Shared physical payloads are hashed once per algorithm, independent copies are checked separately, and cancellation retains reader protection until hashing finishes.
Selected members remain protected through hashing, including cancellation. Same-group captures, imports and head changes wait until verification finishes. Concurrent older removers must be stopped or upgraded; reads and sandbox execution can continue.
Whole-group removal
group.remove()
SnapshotRemoveResult with group, removed, head_update, and warnings. The member IDs and cleared-head outcome belong to this operation. Empty groups can be removed. Active readers and surviving external dependents refuse removal; there is no force bypass for an entire group.
If publication commits but catalog cleanup fails, the call raises SnapshotGroupRemovalRecoveryError with result and detail. The attached result means removal already happened. Cleanup warnings after successful catalog reconciliation are returned in the result. An uncertain durability outcome is an error requiring recovery rather than a claimed successful removal. Later listing recovers pending cleanup without deleting a replacement group.
Exact checkpoint removal
Migration: static PythonSnapshot.remove(reference, force=...) becomes Checkpoint.remove_by_reference(reference, force=...). The canonical Checkpoint.remove() is now an instance method. Legacy Checkpoint.remove(force=...) still returns None.
Example
Example
CheckpointRemoveResult with id, optional head_update, and warnings properties. The head outcome belongs to this operation; later head edits do not change it. Removing the head selects its surviving same-group parent or clears selection. Removing another member reports an unchanged head. Standalone artifacts have no head outcome.
Force permits removal despite indexed children, but never bypasses reader protection. A repeated removal reports a missing checkpoint rather than fabricating another successful result. Backends or native libraries without exact-removal reporting return unsupported instead of falling back to deletion by name.
If removal commits but catalog cleanup fails, the call raises SnapshotRemovalRecoveryError, with result and detail. Its result is authoritative: removal already happened. Recover the affected storage before retrying cleanup; do not assume an error means the checkpoint still exists.
Group options and results
SnapshotCreateResult
snapshotSnapshotThe newly created group.
checkpointCheckpointThe exact first checkpoint created by this call.
head_updatedict[str, Any]Head outcome from this operation; later selection changes do not alter it. See head outcomes.
CheckpointCaptureResult
checkpointCheckpointThe exact checkpoint created by this append.
head_updatedict[str, Any]Head outcome from this operation; later selection changes do not alter it. See head outcomes.
SnapshotImportResult
operation_idstrIdentifier of this import attempt.
snapshotSnapshotThe destination group.
checkpointslist[Checkpoint]All unique supplied members, including bundled dependencies, in stable ID order.
addedlist[str]Stable IDs newly installed by this operation.
reusedlist[str]Stable IDs already installed at publication.
head_updatedict[str, Any]Head outcome from this operation; later selection changes do not alter it. See head outcomes.
warningslist[str]Cleanup warnings after confirmed publication and catalog completion; empty when none.
Head outcome
groupstrGroup name.
previousstr | NonePrevious selected member ID; absent when headless.
headstr | NoneResulting selected member ID; absent after clearing or a headless import.
reasonstrSelection reason: initialized, fast_forwarded, selected, unchanged, diverged, unknown_ancestry, ambiguous_candidates, cleared or parent_selected.
changedboolWhether this operation changed the selected head.
Capture recovery
A failed capture can still have published its requested artifact before source recovery failed.SnapshotSourceRecoveryError preserves the source checkpoint recovery locator and, when publication completed, the published artifact’s kind, path, identity, digest and head_update. The head outcome belongs to that publication even if another operation changes the group afterward. Archive-only capture and older producers omit it; do not infer it by reading the current head. Inspect those details before retrying or removing the source. The error does not prove that the source is running or safely paused.
Guest writeback
Passguest_flush=GuestFlush.REQUIRED to Checkpoint.create, Checkpoint.create_archive, source.fork, source.fork_many, or source.pause. Import GuestFlush from microsandbox.
The default AUTO flushes live disk-only captures, but adds no optional flush to full captures, forks, or pause. SKIP retains mandatory storage barriers.
A paused disk capture needs a matching prior flush; cloud rejects non-Auto policies. See guest flush policy reference.
Checkpoint
Returned by snapshot() · Checkpoint.create() · Checkpoint.open() · Checkpoint.list_dir()
Create, open, and manage snapshots. See properties for returned metadata.Checkpoint.create()
full=True to include memory and execution state. name identifies a member within group; an omitted name is generated and an omitted group uses the source sandbox’s name. dest_dir selects the parent directory containing the group. from_sandbox names the sandbox to capture and is required.
Parameters
namestrCheckpoint member name; generated when omitted.
from_sandboxstrName of the source sandbox. Local disk capture supports running, paused, stopped, and crashed sources. Cloud requires a stopped persistent source. Required.
dest_dirstr | os.PathLike[str] | NoneParent directory containing snapshot groups. Defaults to the snapshots directory.
labelsdict[str, str] | NoneUser-supplied local labels stored outside the identity-bearing descriptor.
forceboolMust remain
False for installed group members. Since v0.7, True raises InvalidConfigError even when the name does not exist. Use a new or generated member name, or explicitly remove the existing member before recreating it. See the v0.6 upgrade example. Direct archive capture supports overwriting its output file.record_integrityboolRecord an integrity hash in the manifest so the artifact can be verified later. Default
False.fullboolLocal-only when
True: capture disk, memory, execution, and device state from a running or paused sandbox. Default False captures disk state; locally, the source can be running, paused, stopped, or crashed. Cloud requires False and a stopped persistent source.guest_flushGuestFlush | NoneGuest writeback policy. Omitted selects
AUTO; see guest writeback.Returns
The captured snapshot.
Example
Example
Checkpoint.create_archive()
Checkpoint.open()
Example
Example
group:member, or path. This validates metadata without reading the full upper file. Use verify() for content checks.
Parameters
path_or_namestrGroup head,
group:member, or artifact directory path.Returns
The opened snapshot.
Checkpoint.get()
Example
Example
group:member, stable snapshot ID, descriptor digest, or artifact path. Global IDs and digests must resolve unambiguously.
Parameters
name_or_digeststrGroup head,
group:member, stable snapshot ID, descriptor digest, or artifact path.Returns
Operational snapshot with metadata loaded on demand.
Checkpoint.list()
Example
Example
Returns
Indexed snapshot resources.
Checkpoint.list_dir()
UnsupportedError.
Parameters
dirstr | os.PathLikeDirectory to scan for artifacts.
Returns
One snapshot per valid artifact directory.
Checkpoint.remove()
Example
Example
force=True.
Parameters
path_or_namestrGroup head,
group:member, or artifact path.forceboolRemove even if the snapshot has indexed children. Default
False.Checkpoint.reindex()
Example
Example
dir (default: configured snapshots dir) and rebuild the local index.
Returns the number of artifacts indexed. Cloud raises UnsupportedError.
Parameters
dirstr | os.PathLike | NoneDirectory to scan. Default: the configured snapshots directory.
Returns
int
Number of artifacts indexed.
Checkpoint.save()
Example
Example
.msb archive. The existing snapshot manifest is archived as-is; create the snapshot with recorded integrity when the archive will cross a trust boundary.
Parameters
name_or_pathstrGroup head or
group:member or artifact path to save.outstr | os.PathLikeOutput archive path.
with_parentsboolInclude the snapshot’s parent chain. Default
False.with_imageboolInclude the pinned base image. Default
False.plain_tarboolWrite an uncompressed
.tar instead of .msb. Default False.Example
Example
Checkpoint.load()
.msb or .tar) into the selected or generated group. The returned handle’s group identifies the group and head_update reports the head selection outcome. Structural and archive-entry checks run during import; recorded payload integrity is preserved for explicit verify(). Compression is detected from magic bytes.
Parameters
archivestr | os.PathLikeArchive path (
.msb or .tar).deststr | os.PathLike | NoneDestination directory. Default: the configured snapshots directory.
Returns
Handle to the loaded snapshot.
Example
Example
Checkpoint.load_many()
Checkpoint.group_head()
Import options
Options forload() and load_many().
With divergent tips, the existing head stays selected; a new group has no head. Select a member explicitly. Identical members may be reused; conflicting identities fail. See archive imports.
Checkpoint methods
snap.save_to()
UnsupportedError.
Example
Example
snap.copy_to()
UnsupportedError when save() is awaited.
Example
Example
snap.verify()
Example
Example
checkpoint={"kind": "verified", "root": ...} in the report.
Returns
dict[str, Any]
Verification report. The
upper.kind field is “not_recorded” when no integrity hash was stored, or “verified” with the recomputed digest.snap.destroy()
Unsupported until the provider supports atomic conditional deletion. Explicit path-selected static removal remains available. Managed remote snapshot deletion uses its captured server ID; local deletion retains its identity checks. Force does not bypass this restriction.
Example
Example
force=True.
Parameters
forceboolRemove even if the snapshot has indexed children. Default
False.handle.save_to()
UnsupportedError.
Sandbox
handle.checkpoint()
sandbox:member to open it later. Called on a Sandbox, obtained from Sandbox.get().
Parameters
namestrMember name within the source sandbox’s group.
Returns
The captured snapshot.
Example
Example
Forking
Fork a running or paused local sandbox to create a child with copy-on-write memory. The source returns to its previous state, and each child needs an unused name.Sandbox has the same methods. See the forking guide for backend limits and disk bindings.
fork()
Example
Example
fork_many()
Example
Example
name, plus a started sandbox or an error; the other field is None. Validation or capture errors raise for the whole call; a child startup error leaves successful siblings running. Stop successful children when finished.
record_integrity records disk hashes. guest_flush defaults to GuestFlush.AUTO; see guest writeback for policy details. volumes rebinds captured disks; forks cannot add new block devices, and batch children cannot share a writable disk image. See fork disk bindings. branch() and branch_many() remain deprecated aliases that emit DeprecationWarning; BranchOutcome aliases ForkOutcome.
Restore
Restore into a new detached sandbox. Disk boots fresh; full resumes execution. See restore examples and progress.Example
Example
cow_memory=TrueShare unchanged full-snapshot memory.
forked=TrueDeprecated alias for the same CoW memory policy; see migration notes.
disk_only=TrueBoot only the saved disk.
snapshot_baseSupply an archive dependency.
Sandbox.restore()Return the restored sandbox.
Sandbox.restore_with_progress()Return a
PullSession; await its result.init
"auto", or the existing InitConfig(cmd, args, env) form. Available on group/checkpoint spawn_sandbox, progress variants, and Sandbox.restore. Full-memory resume rejects an explicit choice, including "auto"; select disk_only=True for a new boot.
max_cpus and max_memory
disk_only=True. Values must be positive and at least the requested capacity; full-memory resume requires the captured ceilings exactly. None leaves a ceiling unspecified. Available on group/checkpoint spawn and progress variants as well as restore.
Destination command defaults
Useworkdir, shell, entrypoint, cmd and env keyword arguments to configure new commands in the destination. They work for disk boots and full resumes without changing captured processes or starting a workload during restoration. An explicit empty entrypoint or CMD clears that default; omission keeps existing resolution. Environment defaults combine with per-command overrides through the ordinary SDK rules. Guest working directories must exist. These are explicit destination settings, not automatically saved snapshot configuration. Unsupported native bindings reject new explicit options before dispatch.
labels
pull_policy
if-missing and explicit never can use complete local/archive content offline. always revalidates that exact digest through its registry, even when cached, and fails if the registry cannot provide it. This never follows the original mutable tag or changes the source snapshot. Explicit use requires an updated native binding and is refused before dispatch when unsupported.
proxy
None leaves destination resolution unchanged.
hostname
None leaves the choice unspecified.
Image, replacement, and automatic startup-command options are not accepted; entrypoint/CMD configure future commands only. Full restore requires matching CPU and memory settings, keeps captured network devices, and cannot apply a new guest security profile. Use disk-only restore to change these.
Restore rejects missing external filesystems (and, for full restore, additional disks) by default. Use allow_missing_resources=True to resume with unavailable devices (full restore records warnings). This is separate from strict/relaxed validation of supplied mappings; inheritance does not waive missing backing. Root and owned storage remain required.
cpus, memoryCPU count and memory in MiB. Full restore must match capture.
network_policyReplace host traffic filtering; guest DNS and TLS settings stay unchanged.
max_connectionsConcurrent TCP limit; zero means unlimited.
disable_networkRemove the NIC. Rejected for full snapshots that captured one.
securityGuest security profile. Disk boot only, including an explicit default profile.
max_duration, idle_timeoutLifetime and idle limits. Omitted means unlimited; zero expires immediately.
guest_clock”sync” or “off”; omission preserves a recorded policy, defaulting to sync when absent.portsBind destination TCP or UDP ports.
vsockBind destination vsock endpoints.
user, log_levelDefault user for new execs and host runtime log level.
dangerously_inherit_resourcesExplicitly inherit host resources. Disabled by default.
external_mount_policyValidate supplied filesystem mappings: strict (default) or relaxed. Does not grant access.
NetworkPolicy, not Network. captured_volumes contains guest paths.
Full capture records the source clock policy; current disk capture does not. An explicit sync policy overrides a saved off policy. The same option is available on group and checkpoint spawn, including progress variants. Clock selection controls guest wall-clock synchronization. Unsupported native SDKs or runtimes refuse unsupported explicit selection before launching the destination.
restore.volumes
Sandbox.restore() and restore_with_progress(). Map host volumes to guest paths.
Example
Example
restore.captured_volumes
restore.allow_missing_resources
Compaction
Compact a local sandbox’s root or owned disks. See compaction for examples and recovery requirements.diskSelect one owned disk by guest path;
/ selects the root.root_disk_onlySelect only the root. Cannot combine with the disk selector.
layersOldest sealed layers to merge, including the base. Minimum two; omit for all. Excludes the writable layer.
dry_runPreview without changing storage.
guest_path. materialized_bytes counts copied bytes, not reclaimed space. Times are microseconds: per-disk total_us covers preparation; aggregate total_us also includes switching; pause_us measures the shared VM pause.
Types
Checkpoint properties
A fully parsed backend-neutral snapshot. Properties are read-only attributes.checkpoint.id
checkpoint.path
UnsupportedError on cloud
checkpoint.reference
checkpoint.reference_kind
checkpoint.digest
sha256:hex), separate from the stable ID
checkpoint.size_bytes
checkpoint.image_ref
checkpoint.image_manifest_digest
checkpoint.state_kind
checkpoint.format
checkpoint.scope
checkpoint.fstype
"ext4")
checkpoint.checkpoint_id
checkpoint.checkpoint_manifest_digest
checkpoint.parent
None for a root
checkpoint.created_at
checkpoint.labels
checkpoint.source_sandbox
checkpoint.save_to()
checkpoint.copy_to()
checkpoint.verify()
verify()
SnapshotCopyBuilder
Returned byCheckpoint.copy_to(). Setters mutate the builder and
return it so calls can be chained.
copy.labels()
copy.record_integrity()
copy.save()
Checkpoint
Lightweight handle returned by the active backend. Properties are read-only.handle.id
handle.path
UnsupportedError on cloud
handle.digest
handle.name
handle.parent_digest
None for a root
handle.image_ref
handle.state_kind
handle.format
handle.scope
handle.fstype
handle.checkpoint_manifest_digest
handle.size_bytes
handle.locality
handle.availability
handle.migration_state
handle.migration_error_code
handle.created_at
handle.reference
handle.reference_kind
handle.open()
open()
handle.remove()
remove()
handle.save_to()
SnapshotStateKind
Checkpoint state representation.SnapshotStateKind.FILE
SnapshotStateKind.CHECKPOINT
SnapshotFormat
On-disk format for file-backed snapshot state.SnapshotFormat.RAW
SnapshotFormat.QCOW2
SnapshotScope
Captured snapshot state scope.SnapshotScope.DISK
SnapshotScope.FULL
Example
Example