Sandbox Lifecycle
VoidRun sandboxes are designed for long-running workloads with intelligent resource management. A running sandbox has no maximum execution time, and idle sandboxes are snapshotted to disk so you only pay for active compute. A snapshotted sandbox wakes in a fraction of a second on the next request.Infinite running
VoidRun sandboxes are designed to run for as long as you need. There is no maximum execution time, making them a good fit for:- Long-running AI agent workflows
- Persistent development environments
- Multi-step code execution pipelines
- Background processing tasks
No hard timeouts
Run tasks for minutes, hours, or days. Idle sandboxes are snapshotted, not killed.
Cost efficient
Auto-sleep releases compute while a snapshot preserves the sandbox on disk.
Fast wake
Wake a snapshotted sandbox in well under a second: the same sandbox, same files, same processes.
Lifecycle states
Thestatus field on a sandbox is one of:
Auto-sleep and auto-delete
When you passautoSleep: true on create, the platform manages the lifecycle for you. You can change autoSleep later with PATCH /sandboxes/{id}:
TypeScript
Python
autoSleep: false skips idle snapshot only. It does not stop auto-delete of a sandbox that is already snapshotted.
1
Activity monitoring
The platform treats sandbox API requests (for example
exec, filesystem calls, and opening a PTY) as activity. An open terminal connection alone does not keep the sandbox awake; see PTY.2
Auto-sleep (default: 1 minute idle)
After the configured idle window, the sandbox is snapshotted: memory + disk are persisted and the VM process exits. Status becomes
snapshotted.3
Auto-wake on demand
The next API call (or public URL request) transparently wakes the sandbox back into
running. You do not need to poll or issue a wake call yourself.4
Auto-delete (default: 7 days snapshotted)
A sandbox that stays
snapshotted past the retention window is deleted, and its snapshot is removed. Download anything you need before you leave a sandbox idle for that long.Defaults
These are hosted-VoidRun defaults. On self-hosted deployments, tune the environment variables above and disable the whole loop with
AUTO_LIFECYCLE_ENABLED=false if you want per-sandbox opt-in only.Wake is transparent
You don’t have to callwake yourself to use a snapshotted sandbox. Every path that talks to the guest does the right thing:
- REST API and SDKs: an
exec, filesystem, or command call against asnapshottedsandbox triggers a wake and then executes. - Public URLs: a request to a published port while
snapshottedwakes the sandbox through the gateway and then proxies the request. See Public URLs.
Manual lifecycle controls
You can drive the lifecycle explicitly.Sleep a sandbox
Snapshot a running sandbox now, instead of waiting for the idle timer.Wake a sandbox
Explicitly restore asnapshotted sandbox back to running. In most cases you don’t need this: any API call against a snapshotted sandbox auto-wakes it.
Start a recovered sandbox
start is for recovery: it accepts sandboxes in snapshotted, killed, or error and boots them from the latest snapshot. Use wake for the normal sleep/wake loop and reach for start when the platform reports the sandbox in a non-running, non-snapshotted state.
start fails with 500 if no snapshot is available. That usually means the sandbox never reached running after create, or the snapshot was cleaned up: create a fresh sandbox in that case.Delete a sandbox
Permanently remove a sandbox, its snapshot, and all its data.Public URL cold wake
Sandboxes that expose ports viapublishPorts remain reachable while snapshotted. A request to a published URL is served after the gateway wakes the sandbox: the first request after idle is slower, and subsequent requests are hot. Design HTTP clients to retry once on a gateway timeout during that first request.
See Public URLs for how to publish ports and fetch the URLs.
Best practices
Let sandboxes sleep
Sandboxes withautoSleep: true cost storage only while snapshotted. Wake latency is well under a second, so the user-visible penalty is minimal for interactive workflows.
Design long-running workflows for wake
For workflows that live for hours or days:- Persist state to disk — files inside the sandbox survive sleep/wake. State kept only in a process’s memory does not: on wake, that process no longer exists.
- Detect status — before assuming the sandbox is hot, read the current status (
GET /sandboxes/{id}); the SDKs exposesandbox.status. - Retry idempotent calls — the first request after a long idle can hit the wake budget; retry once with a small backoff on gateway timeouts.
Long-running AI agent example
Next steps
Public URLs
Publish sandbox ports and reach them from the internet.
Code Execution
Run commands and code inside a sandbox.
File System
Files persist across sleep/wake and only vanish on delete.
SDKs & API
TypeScript and Python method surface for the lifecycle.

