Skip to main content
Before You Begin: A BoxRouter API key, an SDK or the CLI, and a provider key or Credits. Set Up Your Account and install the CLI or an SDK. A run starts N copies of one manifest at once. Every copy gets the same repository revision, setup, files, secrets, and command. Use it for several attempts at one task whose results you compare yourself. A finished copy’s sandbox can keep billing past the end of its lifetime. Read the results, then stop the run to destroy its sandboxes. If --copies returns 409 capability_unavailable with outcome not_started, the run was not accepted and no sandbox started. Run the agent without copies.

What a Run Is

  • A copy’s command must finish without anyone typing, so the manifest sets interactive: false. A run refuses an interactive manifest.
  • Copies are independent. A copy that fails to start doesn’t stop the others, and BoxRouter doesn’t retry it.
  • Starting a run prints a run ID. You read and stop the run with it.
  • Copies bill like any sandbox: your provider keys or your Credits pay for them. With neither, the run is accepted and every copy ends start_failed with insufficient_credit. --provider pins where the copies run.
Each copy can tell itself apart with two variables:

Start a Run

boxrouter.yaml
The CLI command needs uuidgen. Each example prints an idempotency key before sending the request. The SDK examples pass the manifest above as an object.
If the response is lost, repeat only the launch command with the same key and unchanged manifest. The replay returns the same run instead of starting another. Keep the printed key if you close the shell. The command returns when the run is accepted, not when the copies finish: One run starts at most 100 copies. A larger count is refused with 429 run_limit_exceeded before anything starts; a count below 1 or not a whole number is refused as invalid_request. A run refuses these three things:
  • --repo together with --copies. Put the repository in the manifest’s code field instead.
  • Interactive catalog agents.
  • secret_values. Save the secrets first (see secrets).

Read the Run

By default, this reads stored state without contacting a sandbox. Add --results in the CLI, or include: 'command' (include= in Python) on the API read, to query the running sandboxes. The CLI also summarizes the copies as a run state; the SDK examples print each copy’s own status. A copy can be queued, preparing, started, start_failed, stopping, stopped, finished or unknown. A failed copy includes its error code, message and fix. The run’s state describes the copies together:
  • running: not every copy has ended yet.
  • finished: every copy has ended and all started.
  • failed: every copy has ended and at least one did not start.
  • stopped: the run was stopped.
For each started copy, --results also asks its sandbox what the command is doing: running, exited with the exit code, timed_out or unknown.
  • It waits five seconds in total, so a slow or unreachable sandbox reads unknown instead of delaying the rest.
  • It never returns output.

Get Your Results

BoxRouter keeps each copy’s exit code and finish time. Files the command wrote exist only on its sandbox’s disk. Read them before you stop the run.
Take SANDBOX_ID from the copy’s sandbox= field. Without code, the command uses the sandbox’s starting directory. With code, it runs in the checkout directory under the sandbox user’s $HOME. Set an absolute output path, as in the example, when you need to read a file later. BoxRouter does not collect files for you; read results before stopping the run, or have the agent push a branch. read is limited by the route’s file_transfer_bytes (see limits). For larger results, have the agent push a branch. To keep files across sandbox runs, attach a Volume when the sandbox starts.

Stop and Clean Up

To stop one copy, use its zero-based index from the run status:
This records a cleanup request for copy 0 without stopping the other copies, even if the copy has not started yet. Read the run again until the copy is stopped or is start_failed with no sandbox ID. stopping means cleanup is not yet confirmed. To stop the run:
Stop records the request and returns. BoxRouter then ends copies still working and destroys every sandbox the run owns, including those of finished copies, so read their files first. Cleanup is asynchronous: read the run again until each copy is stopped or is start_failed with no sandbox ID. A failed copy without a sandbox keeps its start_failed status. Other statuses mean cleanup is still in progress or unconfirmed. Copies keep the exit code and finish time they recorded. Stopping twice is safe, and a run ID from another workspace reads as not found.

Next Steps

Configure a Launch Manifest

Write the unattended manifest a run needs.

Supply an Agent's Secrets

Save the secrets each copy reads.

Launch Your Own Agent

A repository, a manifest or an image instead of the catalog.