What pause and resume do
When you callpause(), the platform takes a complete memory snapshot of the sandbox microVM, writes it to object storage, and releases the Kubernetes node resources it was using. The sandbox state transitions from running to paused. No data is lost: processes are frozen in place, open file descriptors are captured, and the filesystem is included in the snapshot.
When you call resume(), the platform locates a healthy node, restores the snapshot onto it, and restarts the microVM from the saved state. The sandbox receives a new epoch — a monotonic counter that identifies this particular run of the snapshot. All previously running processes continue from exactly where they were frozen.
Sandbox states
A sandbox moves through these states during its lifecycle:terminated and failed are terminal — you cannot resume a sandbox in either of these states.
Pausing a sandbox
- TypeScript
- Python
- Rust
Resuming a sandbox
PassdeadlineSeconds / deadline_seconds to set how long the resumed sandbox should run before it auto-pauses or terminates.
- TypeScript
- Python
- Rust
Extending a deadline
CallextendDeadline() / extend_deadline() on a running sandbox before its deadline expires to buy more time. Pass the number of seconds to add.
- TypeScript
- Python
- Rust
Epochs and capability tokens
Capability tokens are scoped to a single sandbox epoch. When you resume a sandbox, it starts a new epoch and the old capability token becomes invalid. The SDK automatically replaces the token on the sandbox handle afterresume() completes, so you can call commands and file operations right away without any extra token management.
A handle returned by sandboxes.get() or sandboxes.iterate() (TypeScript/Python) / Sandboxes::get() or Sandboxes::list() (Rust) has no token — it was fetched from the control plane, which does not issue data-plane tokens. Call mintToken() / mint_token() / Sandbox::mint_token() before using commands or filesystem operations on such a handle.
- TypeScript
- Python
- Rust
Use an idempotency key when creating sandboxes in code that may retry. The same key always returns the sandbox from the first successful creation request, so retries are safe even after network errors.