Ultron shell
The shell is a worker that fronts a managed container running the vendored claude-code CLI. Each session gets its own Durable Object plus container instance with its own /work directory. Work is snapshotted to object storage between calls so a session survives container cold-boots.
Overview
- Worker
ultron-shell- Container
- Managed container, standard-4 (8GB disk, 2 vCPU, 12GB RAM), max 200 instances
- Durable Object
UltronShell(SQLite-backed)- Queue
ultron-shell-runs(producer + consumer in same worker)- Workflow
RunGoalWorkflowfor multi-step durable goals- R2 buckets
- ultron-shell-snapshots, ultron-design-assets, ultron-shell-events
- Default LLM backend
- Kimi via a bridge worker
- Alternate backend
- Real Anthropic when payload sets
backend: "claude"
The shell replaces the previous per-user sandbox. Where the old sandbox was always-on and held a desktop session, the shell is request-scoped, queue-driven, and survives via snapshots rather than always-running compute. The agent CLI inside the container drives Kimi (or Anthropic) and exposes a single HTTP surface to callers.
Worker shape
What the worker contains.
HTTP endpoints
All POSTs, all auth-gated against UC_KEY.
| Method + path | Body | Returns |
|---|---|---|
| GET /health | - | Container health + CLI version |
| POST /exec | cmd, cwd?, timeout_ms? | Stdout / stderr / exit_code from a bash command in the container |
| POST /write | path, content | Writes a file in the container |
| POST /read | path | Reads a file |
| POST /list | path | Lists a directory |
| POST /seed | files: { path: content, ... } | Writes many files in one round trip |
| POST /run-claude | prompt, allowed_tools?, system?, model?, timeout_ms?, backend? | Invokes the agent CLI in non-interactive mode and returns the final text |
| POST /snapshot | - | Tars /work, uploads to R2 at snapshots/<session>.tar.gz |
| POST /restore | - | Pulls snapshots/<session>.tar.gz from R2 and unpacks into /work |
| POST /jobs | type, payload | Enqueues onto RUN_QUEUE. Returns a job id immediately. |
?session=<id> (default primary). Each session is a separate DO + container instance with its own /work directory.Async job pipeline
POST /jobs enqueues, the queue consumer drives the container.
The queue decouples the long /run-claude and /run-goal paths from the worker's subrequest budget. A producer POST returns within milliseconds with a job id; the consumer in the same worker drains the queue and drives the container for as long as the work takes. Final state is delivered via an optional callback webhook configured per job.
RunGoalWorkflow
Durable multi-step orchestration. Survives worker restarts.
For work that needs cooldowns, retries with backoff, or multi-day execution, the shell exposes RunGoalWorkflow. A workflow instance can sleep between steps, and each step is checkpointed so the workflow resumes cleanly after a worker restart.
Session and snapshots
How /work survives between calls.
A fresh container has an empty /work directory. The DO tracks startedAt (set in onStart) and restoredAt (set after a successful restore). Before forwarding any state-touching request, the DO checks whether restoredAt < startedAt and an R2 snapshot exists; if so it pulls /work back from R2 transparently before forwarding. Auto-snapshot fires (via ctx.waitUntil) after every successful /run-claude so each iteration is durable.
Inference backends
Two backends, switchable per request.
| Backend | When | Env |
|---|---|---|
| Kimi via bridge (default) | All standard runs. Cheap, fast, good for code. | ANTHROPIC_BASE_URL, ANTHROPIC_MODEL |
| Real Anthropic | Set backend: 'claude' in /run-claude payload. Used for tasks that need stronger reasoning. | ANTHROPIC_BASE_URL_CLAUDE, ANTHROPIC_MODEL_CLAUDE, ANTHROPIC_API_KEY_CLAUDE |
Bundled tools
Binaries the shell ships alongside the CLI in /tools-bin.
| Binary | What it does |
|---|---|
| ultron-screenshot | Grab a screenshot of a running browser or page in the container. |
| brave-search | Web search through an external provider. The shell's search shortcut. |
| ultron-deploy | Deploy a built project to a hosted preview URL. |
| ultron-render | Trigger the carousel renderer for a brief. |
| lookup-design-dna | Open the design assets R2 bucket and surface relevant brand DNA docs. |