Timeouts

Every sandbox has a timeout: the number of seconds from now until its timeout action runs. The action is kill by default, or pause if you ask for it. Each call to set_timeout replaces the previous value, counted from that moment.

No time limit

On plans without a maximum lifetime, a timeout of -1 means no deadline: the sandbox runs until you pause or kill it. It reports endAt as 9999-12-31T23:59:59Z, because the E2B schema requires a date. A sandbox without a deadline that you pause and resume keeps having no deadline.
A plan with a maximum lifetime (the free plan’s is one hour) refuses -1 and any longer timeout with 400, naming the limit. The anona-compute CLI takes positive durations only.
A sandbox without a deadline is billed for as long as it runs. Let it pause when idle: paused sandboxes cost only snapshot storage.

Pause and resume

Pausing snapshots the sandbox’s memory and disk and stops the VM. Resuming restores it: running processes, open files and /dev/shm carry on where they were. Paused sandboxes are kept until you kill them; they count against your plan’s paused-sandbox limit, and their snapshot storage is billed per GB-month.
On the engine’s test hosts, a pause took 0.1 to 0.3 s and a resume 0.8 to 0.9 s, with memory, uptime and a detached process kept. Production numbers are not published yet.

Pause on timeout

Ask for pause instead of kill when the timeout runs out. The sandbox then waits, paused, until you resume it:
auto_resume (resume when a request reaches the sandbox’s URL) is accepted with pause-on-timeout, but waking on traffic is Coming soon: a request to a paused sandbox’s URL gets 409 today. Resume with connect.

Pause when idle

A sandbox can pause itself once nothing has used it for a while: no request to any of its ports, no open terminal, live view, SSH session or byte pipe, and no running process started through envd. Starting to run again (resume) restarts the clock. This is what the dashboard’s lifetime No limit (pauses when idle) sets up, with 15 minutes.
idleMinutes ranges from 1 to 10080 (one week); 0 turns it off. The SDK’s lifecycle={"on_timeout": "pause"} (autoPause: true on the wire) pauses at the timeout, and idles only if your organization has a default idle time. Resume a paused sandbox with Sandbox.connect(id).

Kill

kill returns as soon as the gateway has the request (it waits up to 2 s for the engine) and finishes in the background with retries. The sandbox disappears from list at once.

Fork and snapshots

Coming soon: forking a running sandbox into copies (anona-compute fork, E2B fork) and named snapshots.