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.
Create, reuse, and remove a box from code
Name your box. The name is how a second process — a worker, a retry, tomorrow’s cron job — finds the same box instead of building a new one.name is a parameter of rt.create(...), not a field of BoxOptions. Passing name= inside BoxOptions fails at construction.
Boxlite.rest(...)is constructed synchronously;create,start,exec, andremoveare all awaited.box.exec("echo", args=["hi"])takes its arguments as a list.- Teardown is
await rt.remove(box.id, force=True)on the runtime.
rt.get_or_create(...) creates a box or reuses an existing one with the same name in a single call. For the state model behind create, start, stop, and remove — and for the signatures of the runtime methods — see Lifecycle.
Manage a box from the console
The Boxes list is the management surface for a box, so you do not need your own tooling to see what you are running. Each row shows the box name, its id, and its status, and carries two actions:
BoxLite generates a name for a box you create in the console — a two-word pair such as
golden-lynx — and a short mixed-case id such as 9z8vat0excp9. When you create a box from code you pass your own name, which is what makes a box findable later.
Use the list to catch boxes a crashed script left behind. Filter by name, check which are still RUNNING, and stop or delete them.
Environment variables and secrets
BoxOptions accepts env for plain configuration and secrets for values that should not sit in your box’s environment or logs. Their shapes differ between Python and Node, and secrets carry extra options such as host scoping, so use the pages that own those tables: Environment and startup and Inject secrets and harden a box.
Keep your BoxLite API key out of both. It belongs in the environment of the process that calls Boxlite.rest(...), not inside the box.
Troubleshooting
Next steps
Boxes
Everything else about configuring a box on Cloud.

