Skip to main content
Sandboxes have a rolling idle timeout that determines when they auto-hibernate to save cost. The timeout is what you’d expect from a “laptop lid” — the sandbox sleeps when nothing is happening and wakes the moment you talk to it again.

Default: persistent (no auto-hibernate)

By default the timeout is 0, which means never auto-hibernate. The sandbox stays running until you explicitly kill or hibernate it.
Persistent sandboxes keep accruing compute cost for as long as they’re running. If you only need the sandbox to respond to occasional requests, set a timeout so it hibernates between them — see below.

Setting a timeout

Pass timeout in seconds to have the sandbox auto-hibernate after N seconds of idle time. The timer resets on every operation — exec, file access, agent activity — so a busy sandbox never hits the timeout.

Update on a running sandbox

You can change the timeout at any time:

What happens when the timeout expires

When an idle sandbox hits its timeout, the platform:
  1. Snapshots the VM state (memory + disk) and stops the VM — no compute cost while hibernated.
  2. Marks the sandbox hibernated. Its ID, files, and configuration are preserved.
You don’t pay for CPU/memory while a sandbox is hibernated — only for the stored snapshot.

Waking up

Any operation from the SDK automatically wakes a hibernated sandbox. You don’t need to call wake() yourself — calling sandbox.exec.run(...), reading a file, or any other operation transparently restores the VM and then performs the requested action.
Wake is typically sub-second thanks to snapshot restore, with a cold-boot fallback if the snapshot isn’t available. Once woken, the idle timer restarts with the sandbox’s configured timeout.
You can still call sandbox.wake() explicitly if you want to pre-warm a sandbox before routing user traffic to it.

Choosing a timeout

The tradeoff is latency vs cost: a lower timeout saves money but adds wake latency on the next request after idleness.

See also