boxrouter launch claude-managed-agents-worker puts that worker in a BoxRouter sandbox, so the agent’s files, installed tools and network are the sandbox’s.
Before You Begin: A BoxRouter API key and CLI, a self-hosted environment with its key, and an agent in the Claude Console.
Before You Begin
Set Up Your Account and install the CLI. Then, following Anthropic’s quickstart:- In the Claude Console, create a
self_hostedenvironment and generate its environment key. - Create an agent with the
agent_toolset_20260401toolset.
ANTHROPIC_ENVIRONMENT_ID identifies the queue, and
ANTHROPIC_ENVIRONMENT_KEY authorizes the worker to poll it. Save them as
workspace secrets. If a name is not saved, the CLI uses its terminal environment
variable or asks at a hidden prompt. That fallback is not saved.
Keep ANTHROPIC_API_KEY, which creates sessions and inspects the queue, on your own machine.
Launch a Worker
ant 2.1.0 after checking its SHA-256. Then the sandbox starts ant beta:worker poll --workdir "$HOME" as an unattended command. The worker needs /bin/bash and outbound HTTPS.
The sandbox lifetime is 3600 seconds unless you pass --lifetime; it can run past that time. When the sandbox ends, the worker goes with it.
Send a Task
For this example, use an environment with only this worker. Any worker polling the same environment can claim a session; the file read below uses this sandbox’s ID. Install the Anthropic Python SDK withpip install anthropic. On your own machine, set
ANTHROPIC_API_KEY, ANTHROPIC_ENVIRONMENT_ID, and your agent’s ANTHROPIC_AGENT_ID. Save this as claude-session.py:
python claude-session.py.
If workers_polling stays at 0, see the next section. Follow the session in the Console or Anthropic’s event stream. When it finishes, replace SANDBOX_ID with the ID printed at launch and read the result. The sample file is readable by other users in the sandbox, so do not put secrets in it:
If workers_polling Stays at 0
A worker whose key or environment ID Anthropic rejects exits on its first poll with 401 Unauthorized. The sandbox stays up, and the launch still reports success.
Check that the environment ID and key belong to the same self-hosted environment. Update the saved
secrets, or the terminal variables if the names are not saved. Then destroy this sandbox and launch
again.
More Workers
--copies N starts N sandboxes that poll the same environment (Copies covers limits and results). --lifetime cannot be combined with --copies. An idle worker takes later sessions, so N copies run up to N sessions at once. A session’s files stay on the worker that claimed it.
Clean Up
Destroy a worker’s sandbox withboxrouter destroy SANDBOX_ID, or stop a run with boxrouter launch stop RUN_ID. Destroying the sandbox does not end the Anthropic session; end that in the Console or through Anthropic’s API.
To run the worker from your own code, call Create a launch with the catalog manifest from GET /agents/claude-managed-agents-worker. To give the agent a project, set the manifest’s code field and tell the agent the checkout path. Worker authentication and session isolation are in Anthropic’s self-hosted sandbox guide.
Next Steps
Run Copies of an Agent
Run several workers at once.
Supply an Agent's Secrets
Save the environment values once.
Choose an Agent Integration
Compare the integrations for your agent stack.