Skip to main content

Timeouts

Every sandbox has a timeout: the number of seconds from now until its timeout action runs. The action is delete 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

A timeout of -1 means no deadline: the sandbox runs until you pause or delete it. It reports endAt as 9999-12-31T23:59:59Z, because the E2B schema requires a date. The MCP tools report it as an absent end_at instead (the key is omitted, not sent as null or empty), and anona-compute info shows never (no time limit). A sandbox without a deadline that you pause and resume keeps having no deadline.
No plan has a maximum lifetime. If Anona has set one on your team, -1 and any longer timeout are refused with 400, naming the limit. With the anona-compute CLI, timeout ID never sets no deadline; otherwise it takes a positive duration. To change the deadline of a sandbox that is already running, see Extend a sandbox.
The timeout action (delete, or pause with autoPause) runs within about a minute of endAt, not at the exact second, and running time is billed up to endAt, not up to when the action finished. Do not rely on a sandbox still answering after its deadline.A sandbox without a deadline is billed for as long as it runs. Let it pause when idle: paused sandboxes cost only snapshot storage.

Extend a sandbox

Extending a sandbox means giving a running sandbox a new deadline. Through the API, SDKs, CLI and MCP, the call replaces the deadline; it does not add to it. extend 1h ends the sandbox one hour from the moment you call it, whatever time it had left, so it can also shorten the lifetime. The same call sets no deadline at all. The dashboard’s Extend adds to the time left. On a sandbox with 25 minutes left, Extend → 10 minutes makes it end in 35. A sandbox with no deadline has nothing to add to, so there the choice sets a deadline that long from now. Your plan’s maximum lifetime applies to the total: an extension that would end the sandbox further out than the maximum allows is refused and says how much would fit, and the sandbox keeps its deadline.
The CLI takes a number of seconds or a duration such as 10m or 2h; the SDKs take seconds (Python) or milliseconds (TypeScript); the API and the MCP tool take seconds. The dashboard offers a list from 5 minutes to 30 days, plus No limit. No plan limits how far ahead the deadline can be. If Anona has set a maximum lifetime on your team, a longer deadline, or -1, is refused with 400 naming the limit. The dashboard’s No limit (pauses when idle) sets no deadline and an idle pause together.

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 delete them, except on Free, which deletes one 14 days after it was paused (we email you three days before). They count against your plan’s paused-sandbox limit: at the limit a pause you ask for is refused with 403, and an idle pause or a pause on timeout deletes the sandbox instead, with end reason paused_limit. Their snapshot storage is billed per GB-month. See limits.

Pause on timeout

Ask for pause instead of delete 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. This is not the same as Pause on timeout above: there is no deadline at all. The sandbox runs for as long as it is used, and pauses once it is not. What counts as use, restarting the clock:
  • a request to any of the sandbox’s ports, for as long as it is open, so a long process stream, a WebSocket or an SSE response keeps it awake. The one exception is envd’s GET /health, which SDKs and monitors poll and which says nothing about use;
  • an open terminal, live view, SSH session or byte pipe;
  • any process started through envd that is still running — a background commands.run, a PTY shell, a dev server.
What does not count, which is the part that surprises people: CPU the guest burns on work it started by itself, outbound traffic the sandbox makes, and API calls about the sandbox such as get or list. A sandbox running a loop that nobody is watching will pause. Processes the template starts for itself, such as sshd or a desktop’s VNC server, are not seen either — but their clients are, through the first two rules.
idleMinutes ranges from 1 to 10080 (one week); 0 turns it off, and {} takes your team’s default, else 15. The object form also turns on pause at the timeout (it includes autoPause: true), so a sandbox that has a deadline as well is paused, not deleted, when the deadline comes; the same goes for anona-compute create --idle-pause with a duration. Resume a paused sandbox with Sandbox.connect(id), anona-compute resume, or the dashboard. In the dashboard, pick the lifetime No limit (pauses when idle) when creating a sandbox and an idle time appears beside it; on a running sandbox the same times are under Extend. A paused sandbox costs no compute — only snapshot storage — so idle pausing is the cheapest way to keep a sandbox you will come back to. The SDK’s lifecycle={"on_timeout": "pause"} (autoPause: true on the wire) is the other feature: it pauses at the timeout, and idles only if your organization has a default idle time. A sandbox can have both.

Delete

Delete a sandbox with anona-compute delete, the dashboard, or kill() in the SDK: the SDK keeps the E2B method name, so code written for E2B works unchanged. It 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

Fork copies a running sandbox - memory, files and running processes - into new sandboxes. Each copy starts from the exact state the original was in, which is the point: get an agent to an interesting state once, then try ten things from there. The original is briefly frozen while its memory is written (about 0.1 s, longer right after it has touched a lot of memory), then keeps running on its own node with the same ID and the same deadline. The snapshot is taken once however many copies you ask for.
Each fork is a new sandbox and behaves like one: it takes a slot of your concurrent-sandbox limit, it is billed like any other sandbox for as long as it runs, and it inherits the original’s template, metadata, timeout policy and network policy, with the lifetime you pass to fork. A fork of ten on a plan with room for three is not an all-or-nothing failure. The copies that fit are created, and every other entry of the result says why it was not - 429 when your plan’s limit is reached, 503 when the platform is at capacity. The SDK gives you those as exceptions in the same list, in request order. A non-201 from the API means nothing was forked at all: the sandbox was not running (409), or there was no room for even one copy (429), in which case the original is not frozen either.
Forking needs the sandboxes:create scope, and an API key restricted to particular sandboxes cannot fork. In the dashboard, Fork on a running sandbox’s page asks how many copies and how long they should live, shows what the batch will cost before you commit, and lists the outcome of each copy.
Each fork request keeps a checkpoint of the source sandbox, which the copies read from, and the platform cannot delete one yet - deleting the copies does not free it. So forking is capped per team (32 checkpoints by default); past that, fork answers 429 and says so. Ask support to raise it, and tell us what you are building with fork: the cap exists only until checkpoints can be reclaimed.

Snapshots

Coming soon: named snapshots you can keep and create from later (POST /sandboxes/{id}/snapshots, GET /snapshots). Fork takes a snapshot for you and uses it immediately.