snapshot() before changing branches.
Snapshots are lightweight, so you can create a checkpoint after every command.
Each snapshot stops the VM; an unchanged filesystem can return the same
image_uuid. Rollback follows history entries, not distinct image UUIDs.
For automatic saving after each command, see
Save after every command.
Configure your connection as shown in Your first sandbox.
Branches share one session’s history in its Store. To create an independent
session from any saved image, see
Start a new session from a snapshot.
Create a branch and switch back
Save a baseline onmain, change a file on experiment, then read the original
file from main. Creating a branch does not select it: call switch_branch().
- Sync
- Async
from_branch to branch from the current checkpoint. Switching branches
selects saved files; it does not rerun commands or restore processes.
Roll back and keep a way back to the result
rollback() moves the active branch back one saved entry. Keep the current
result under another name before rolling back if you want to return to it later.
- Sync
- Async
rollback(steps=2) to move back two entries. A snapshot can contain several
commands. Rollback keeps later history and other branches; new work starts from
the selected image. It does not undo external side effects or session-wide
cwd and env overrides.
Branch changes while a VM is active raise RuntimeError: snapshot first.
Duplicate branch names, unknown branches, and rollback beyond the initial entry
raise ValueError.
Concurrent callers
Each Session owns its position and branch names. Objects using the same Store andsession_id can select different nodes without affecting each other.
Concurrent operations from one parent create separate children. No result moves
another client’s position or overwrites its history.
Within one Session, a result advances the selected position only if that position
still matches its captured source and navigation has not changed. Late results
remain available by their entry IDs. Explicit branch= selects a local branch
for a normal commit. The SDK does not merge filesystem changes.
After restarting, select a saved node_id; a tree with multiple continuations
requires an explicit choice. navigate_forward() also requires a unique child.
See Save and resume a session for persistence and Tree stores for the contract.