Skip to main content
Sailboxes preserve their writable disk, in-memory state, and in-flight network requests across checkpoints and resumes.
sb.checkpoint()  # Snapshot while keeping the Sailbox running
child = sb.fork(name="rollout-1")  # Branch memory and writable disk into a new Sailbox
sb.pause()       # Checkpoint and pause until explicit resume
sb.sleep()       # Checkpoint and sleep until network ingress, exec, or resume
sb.resume()      # Resume a paused or sleeping Sailbox
sb.terminate()   # Permanently destroy the Sailbox

Checkpoint

checkpoint() snapshots VM memory and writable disk while keeping the Sailbox running:
sb.exec("python3 setup.py").wait()
sb.checkpoint()
Call checkpoint() after important setup, such as installing packages, fetching remote data, or writing files. On host failure, Sail restores from the most recent completed checkpoint and does not replay commands that ran before that checkpoint.

Fork

fork() creates a separate running Sailbox from the current in-memory process state and writable disk:
child = sb.fork(name="experiment-1")
The child gets new Sail identity and networking. Active TCP connections are reset in the child, while listening sockets can accept new connections after you expose routes for the child.

Pause

pause() checkpoints the Sailbox and powers it down until you explicitly resume it:
sb.pause()
sb.resume()
Use pause when you want to preserve state but do not want the Sailbox to wake on network traffic.

Sleep

sleep() checkpoints the Sailbox and powers it down until network ingress, exec, or an explicit resume wakes it:
sb.sleep()
Use sleep for idle services that should wake when they receive traffic.

Sleep during inference

To automatically sleep a Sailbox while a foreground Sail inference call is in flight, include its ID in the request with the X-SailboxId header. Sail will resume the Sailbox after the inference call completes.
response = client.responses.create(
    model="zai-org/GLM-5",
    input="Summarize the current workspace state.",
    background=False,
    extra_headers={"X-SailboxId": sb.sailbox_id},
)

Resume

resume() restores a paused or sleeping Sailbox and returns an updated handle:
sb = sb.resume()
Sailbox.connect() also verifies placement and resumes a paused or sleeping Sailbox before returning:
sb = sail.Sailbox.connect("sb_...")

Terminate

terminate() permanently destroys the Sailbox:
sb.terminate()
Termination is not reversible. Use pause() or sleep() when you want to keep the VM state for later.