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.
Choose an image
The New Box dialog offers three images:
From code you pass an image reference instead. The official SDK examples use
ghcr.io/boxlite-ai/boxlite-agent-base:v0.1.0, and that is the image to start from when you have no reason to pick another:
Boxes permission, and the console describes what that includes:
Boxes API access — This key can create and manage Boxes. Shared Linux base images are available automatically.So you do not stage or pull a base image before your first
create. Image operations such as pulling are not supported over the REST runtime — see Cloud versus open source.
Choose a size
The console offers three presets and a custom option:
Pick Small for shell work and short scripts, Medium for test suites and dependency installs, Large for builds and anything that keeps several processes hot.
Per-organization ceilings
Custom is bounded. Your organization has one ceiling per box:
The console shows these under Box limits on the Billing page, with the reason:
Limits mitigate misuse and keep box and compute capacity fairly available across all users.Read your current ceilings in Plans, wallet, and usage. Split a workload that wants more than one box can hold across several boxes rather than trying to raise a single box past the ceiling.
The SDK’s sizing fields
BoxOptions accepts cpus, memory_mib, and disk_size_gb. Their types, units, and general behaviour live in Compute resources — the console sizes above are the verified way to size a Cloud box, so set the size in the console when you want a specific shape.
The disk field is named disk_size_gb. disk_gib is a common guess and fails at construction with a no-such-field error.
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 code defaults are not the console defaults. Leave these fields unset and a box created over REST gets
auto_stop=0andauto_delete=0— no auto-stop and no auto-delete at all — withauto_resumedefaulting totrue. The console’s15 minidle default applies to boxes you create in the console. So a box created from code keeps running until you stop it, and paying for it is your responsibility.
15 min corresponds to auto_stop=900.
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.
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.

