1. Set up
- A Box API key from the Upstash Console.
- An Anthropic API key from API keys, created inside a workspace.
.env
setup.ts
.env:
.env
2. Run the dispatcher
The dispatcher picks up sessions and runs each one in its own box.dispatcher.ts
3. Start a session
Start a session on theupstash-box environment from the Claude Console, or from code:
session.ts
Customize the box
Pass anyBox.create option in getBox:
env are readable by the agent; use attachHeaders for credentials. Open a server the agent started with box.getPublicURL(3000), and delete a session’s box with box.delete() when you are done. Pause or delete a box only when isWorkerRunning(box) is false. The worker exits about a minute after each turn.
Troubleshooting
- Session stays queued: the dispatcher is not running, or its environment ID and key don’t match the session’s environment.
This API key is not scoped to a workspace: create the API key inside a workspace.- Commands never run: check
/workspace/home/worker.login the session’s box.