Prerequisites
- An API key from the console, exported as
BOXLITE_API_KEY. See API keys. pip install boxlite, and the REST URL exported asBOXLITE_REST_URL. See Quickstart.
Lifecycle on Cloud
Three controls in the New Box dialog govern how long your box lives. They behave differently from a box you run yourself, and the first one can end a job you thought was safe.
Set them in the console when you create a box there, or from code with three
BoxOptions fields:
Two rules to know before you set them:
auto_deletemust be greater thanauto_stopwhen both are non-zero. Otherwise creation fails withauto_delete must be greater than auto_stop, because a box that deletes itself before it stops has no reachable state.- The defaults come from the platform, not from the SDK. Omit these fields and the SDK leaves them out of the request entirely, so the platform applies its own defaults:
auto_stop=900(15 idle minutes),auto_delete=0(never), andauto_resume=true. A box created from code therefore behaves like one created in the console — it will stop itself after 15 idle minutes whether you asked for that or not.
15 min corresponds to auto_stop=900, which is the same value a box created from code receives by default. To keep a box running through unattended work, you must pass auto_stop explicitly — see Stop when idle.
The field names matter: idle_timeout, stop_when_idle, wake_on_access, delete_after_stopping, and auto_pause are not fields of BoxOptions and each fails construction with a no-such-field error.
Stop when idle
Idleness is measured at the boundary of the box, not inside it. The console is explicit:Idle means no SDK, terminal or preview traffic. Work running inside the box does not count — a long job can be stopped mid-run.That is the single most important sentence on this page. A 40-minute build that you kick off and then stop talking to looks idle from the outside, and the platform stops it at 15 minutes with the build half-finished. Two ways to keep a long job alive:
- Keep touching the box from your client. Poll the job while it runs — read its progress file or check its process — so real SDK traffic keeps arriving.
- Raise the idle timeout, or disable it. In the console, pick a longer value or
Never; from code, pass a largerauto_stoporauto_stop=0. Disabling it is the right choice for a box whose whole purpose is unattended work — and the one that makes you responsible for tearing it down.
Pass this helper a box you already created and started, using the pattern in Create, reuse, and remove a box from code. Choose a poll interval comfortably shorter than the box’s idle timeout.
Wake on access
Resume is on by default — the console switch starts on, andauto_resume defaults to true over the API. With it enabled, a stopped box comes back on its own when you reach for it:
SDK exec, file operations and terminal attach wake a stopped box. Preview URL traffic keeps a running box alive but cannot wake a stopped one.This is what makes a named Cloud box feel durable: your script calls
exec after a weekend, the box restarts with its disk intact, and your code carries on. Enable it for any box you intend to reuse. Leave it off when a stop should be final until you intervene.
Delete after stopping
Delete after stopping defaults toNever, so a stopped box keeps its disk and stays addressable by name. Set a delay when you want the platform to reclaim throwaway boxes for you instead of remembering to call remove yourself.
Troubleshooting
Next steps
Boxes
Everything else about configuring a box on Cloud.

