boxrouter launch or POST /launches.
Before You Begin: An SDK or the CLI, and an API key that can create sandboxes. A repository must be public or linked to your workspace.
Choose a Source
BoxRouter resolves a repository ref to a commit before checkout and records the pin. A new launch can
resolve a moving branch to a different commit, so specify a commit SHA when launches must use the same
code. Retrying the same API request with the same idempotency key returns the original operation.
Repeatable
--secret NAME, --lifetime SECONDS and --provider apply to every form. --name and --command apply to a repository, image or manifest, not to a catalog AGENT, which keeps its catalog name and command.
If --provider returns 400 unrecognised_word, the name is not a provider ID and nothing started;
details.known lists the valid names. Omit the flag to let BoxRouter select a route if another eligible
route meets your needs.
An AGENT cannot be combined with --image, --manifest, --checkout, --name or --command.
Add --rm to request sandbox deletion when the terminal session ends, including when you detach with
Ctrl-]. Without --rm, the sandbox can keep running and billing past the end of its lifetime.
Check its state and destroy it when you no longer need it.
Launch a Repository
The terminal and sandbox IDs in the output stand in for your IDs. This command and the image example below close their terminals with the command’s exit status. The TypeScript launch has nocheckout option, so its example passes the same plain checkout as a manifest with code.
box.open_terminal() (box.openTerminal() in
TypeScript) starts the launch’s command in a terminal your keyboard is not attached to, so the SDK examples
print its raw bytes. Leaving the sandbox’s block requests deletion, as --rm does. That output can include the shell prompt and the echoed command.
With no directory set in the manifest, the checkout lands in $HOME/<repository-name>, and the command starts there.
Without --command, a plain checkout opens a shell.
To ship the setup and command with the code, commit a boxrouter.yaml with the two required fields.
OWNER/REPO@REF:path selects a different file.
boxrouter.yaml
secrets; a value in the manifest would be committed with your code.
Secrets covers how a value reaches the sandbox; the
manifest reference lists the other fields.
Launch an Image
Call the Launch API
POST /launches is the endpoint the CLI and SDKs call, and Create a launch
lists every field. Before you run this example, install the Python SDK, the
TypeScript SDK, or the CLI, and set an API key through
set up your account.
The SDKs and the CLI send the key, wait for the operation to settle, and return the sandbox, the same handle
create returns.
boxrouter api launches get-operation OPERATION_ID before you launch again; the launch may still create a sandbox.
This example prepares an interactive sandbox without attaching a terminal; run commands with
Commands using box.id. With interactive: false, launch starts the manifest’s command instead.
box.lifetime.seconds is the lifetime the sandbox got. A lifetime you choose is never lowered; see
launch limits.
The sandbox can run past its lifetime unless you destroy it. Leaving the with block, or calling box.destroy(),
requests deletion; check its state to confirm.
If preparation fails, launch requests deletion. Check cleanup and any external effects before retrying;
see preparation failure recovery.
To give one launch a secret value, add a top-level secret_values object beside the manifest.
The value overrides a saved secret with the same name, applies to that launch only, and BoxRouter never stores
or returns it.
Repository Errors
Each error carries a code, a message and afix that says what to change; the CLI prints all three.
A repository links to one workspace at a time, so a launch from any other workspace fails with
source_repository_not_accessible or code_repository_not_found.
Private repositories covers linking.
Next Steps
Configure a Launch Manifest
Fields, preparation order, and launch limits.
Run Copies of an Agent
Start N unattended copies and read what each wrote.
Supply an Agent's Secrets
Save the environment values once.