Keep a sandbox alive
Every sandbox has an auto-stop timer.- The default is 1 hour. The maximum is 30 days, or no auto-stop at all.
- The timer counts from creation or from the last resume, not from your last activity.
- A sandbox with a 1 hour TTL stops one hour after it starts, even in the middle of your own commands.
- A running agent prompt is the exception. When the deadline comes while a prompt runs or waits, boat moves the deadline to one TTL later. It does this again until no prompt is active.
On the free trial, you cannot turn off auto-stop, and the TTL cannot be more than 2 hours. boat refuses the call with
trial_auto_stop_required. Read Free trial.Turn off auto-stop
Use this when the sandbox must run until you stop it yourself. Examples are demos, browser sessions, long setup jobs and unattended workflows. A stop interrupts this work, and you must then start the processes again. Turn off auto-stop when you create the sandbox. For a sandbox that exists, set its TTL tonull.
TTL on resume and fork
resume and fork also accept ttlSeconds. Thus a sandbox that comes back does not need a second call to set its lifetime.
Thus a fork of a sandbox with auto-stop off does not silently make a second sandbox that never stops. See Snapshots.
Read the auto-stop deadline
Each resume sets the deadline again. The new deadline is the resume time plus the TTL of the sandbox. If you schedule long jobs, do these steps:- Read the deadline after each resume.
- Before a job that runs past the deadline, extend the sandbox.
archiveAfter is the deadline. It is null when auto-stop is off. ttlSeconds is the TTL as you last set it.
boat stop. The stop starts within about 5 seconds of the deadline. boat cuts off the jobs that run. See what a stop does to running work.
There is one exception. While a prompt to the agent of the sandbox runs, boat moves the deadline forward by one TTL. Your own jobs do not move the deadline. Examples are boat exec commands and services. Read archiveAfter again each time. Do not keep the first value.
The API reports a stopped sandbox as archived.
Extend with a deadline
boat extend sets a new TTL. The new deadline is now plus the TTL, not the start time plus the TTL. The sandbox also keeps this TTL for later resumes.
boat extend <id> --hours 12: the sandbox stops 12 hours from now.--hoursand--ttlset the remaining time. They do not add to it.PATCH /sandboxes/{id}withttlSecondsdoes the same.
2592000seconds is 30 days.- 30 days is the maximum numeric TTL that the boat API accepts.
- boat caps larger values to 30 days.