active- VM is running, processes executing, compute billedpaused- VM paused, state persisted to disk, no compute billed
pausing while a sandbox is being checkpointed and resuming while a paused sandbox is being restored to active. connect() and resume() wait a pause out for you; a pause still finishing after that wait answers 409 with code sandbox_pausing and a Retry-After header, so retry shortly. failed indicates the sandbox couldn’t boot or resume; the entry remains until you delete it. Deletion removes the sandbox entirely; further API calls return 404.
Pause
pause() checkpoints the full VM state (memory, processes, filesystem) to disk and stops billing for compute. It returns once the pause is accepted and the sandbox finishes pausing on its own; pass wait: true / wait=True to return once the sandbox is paused. A waited pause is a single request the server holds until the pause lands, so it costs no polling.
Resume
resume() restores a paused sandbox you already hold a reference to. Processes pick up where they left off.
sandbox — your commands and files calls keep working with no changes on your side.
Kill
kill() deletes the sandbox and all its resources. It’s idempotent - deleting an already-deleted sandbox is a no-op that swallows the 404.
Kill without an instance
In serverless contexts you often don’t have thesandbox - just the ID. Use killById / kill_by_id to delete it anyway.
Auto-pause
SettimeoutSeconds to auto-pause a sandbox after it has been active for that long. Pausing checkpoints its state and stops compute billing, so a sandbox you forget about won’t keep running and billing. It isn’t deleted; the next commands.run(), file operation, or connect() resumes it where it left off.
- It’s a cap on active time, not idle time. Running work doesn’t reset it, so a task still going when the window elapses is paused mid-run. Size it for your longest active session.
- Each resume starts a fresh window.
- The sandbox is paused, not deleted. Resume restores full memory and filesystem.
- Leave it unset (the default) to disable auto-pause; the sandbox stays active until you pause or kill it.
Idle timeout
SetidleTimeoutSeconds to auto-pause a sandbox after this many seconds with no activity. Unlike timeoutSeconds, the idle timeout never pauses a sandbox while a request or connection to it is open. Use it for a sandbox that must stay active while someone works in it and stop billing when it goes quiet.
Requires SDK 0.11.6+ (
@superserve/sdk and superserve), CLI 2.1.2+, and MCP 0.3.4+ (@superserve/mcp). Older TypeScript SDK versions ignore idleTimeoutSeconds and show no error.- A running command, including a
commands.run()call that streams output for a long time. - An open terminal or command stream, even when nothing is typed.
- File reads, writes, and directory listings, and saved-snapshot captures.
- Desktop actions, such as screenshots, clicks, and typing.
- Traffic to the sandbox’s preview URLs.
- Outbound traffic from the sandbox, such as downloads or calls to other APIs.
- A background process started with
nohupor&. After the command that started it returns, the process does not keep the sandbox active. - CPU or disk activity on its own.
- Changes to the sandbox’s settings, such as metadata or egress rules.
commands.run(), file operation, or connect() resumes the sandbox where it stopped. Each resume restarts the idle count. The value can be 60 to 604800 seconds (7 days). By default, the idle timeout is unset, and the sandbox never pauses for being idle.
A raw HTTP request that uses
X-Access-Token does not resume a paused sandbox. It fails with a 503 error (sandbox_unavailable). Call POST /sandboxes/{sandbox_id}/activate first, then send the request with the returned access token.idleTimeoutSeconds and timeoutSeconds are independent. Whichever expires first pauses the sandbox. Use both to pause an inactive sandbox and also cap a session that never goes quiet.
Set, clear, or read the idle timeout on an existing sandbox. When the idle timeout is off, the current value is undefined (TypeScript) or None (Python):
Auto-delete
By default a paused sandbox is kept forever. SetautoDeleteSeconds to delete it once it has been continuously paused for that long. This suits short-lived or unattended sandboxes: scheduled jobs, one-off experiments, or agent sessions that never get an explicit kill().
- Pause starts it and resume cancels it. Pausing again starts a fresh window, so a sandbox in use is never deleted.
0deletes the sandbox as soon as it pauses.- While paused, the sandbox’s info includes
autoDeleteAt, the exact deletion time. - Maximum window: 30 days.