Skip to main content
Every Sandbox has two independent clocks:
  1. Hard expiry (expires_at): Fixed at creation + 24 hours (Unix milliseconds). Nothing—not Start, Stop, touch(), foreground exec(), or disabling idle auto-stop—can extend expires_at.
  2. Idle auto-stop (idle_timeout_seconds): Defaults to 1,800 seconds (30 minutes) without recognized activity. Stopping saves running Memory while preserving the Sandbox disk until expires_at.

Lifecycle outcomes

Read current policy and remaining time

Recognized activity vs. background processes

  • Counts as activity: A foreground exec call (while running), an explicit sandbox.touch() call, and changing idle policy via sandbox.idle.set(...).
  • Does NOT count as activity: Background CPU usage, daemons, detached background jobs, or network traffic alone. A background build can be idle-stopped unless idle timeout is raised or disabled.
Do not rely on an unbounded touch() loop instead of configuring an appropriate idle policy—and remember that even with idle Stop disabled or foreground Exec running, hard expiry at expires_at still terminates and deletes the Sandbox.

Configure or disable idle auto-stop

In the Console, open Settings → Stop when idle (30 minutes, 60 minutes, or Never) or click I’m still using it (touch()). Through the SDK, idle_timeout_seconds accepts 60 through 86,400 seconds, or omit the field ({}) to disable idle auto-stop:

Resume after idle Stop

If state === "stopped" and enough time remains before expires_at, call sandbox.start() explicitly. Like Computers, Start is a cold boot on the same disk—old process IDs and TCP sockets do not resume, and current Account entitlement + running Memory must still admit it.

Diagnose Sandbox lifecycle issues

Always budget time to export artifacts before expires_at, and choose a Computer whenever work needs more than 24 hours or persistent retention. See Sandbox overview and Errors.