Runtime and sandbox: where agent code runs
In short One execution interface with several light engines, inside a sandbox that has no network and no secrets. I built a microVM per session first and replaced it within a day, because a pure function should not need a VM.Full verdict ↓
Once the model writes code, that code has to run somewhere. The tempting answer is the machine the agent already lives on, and it is the wrong one. Runtime is what executes a program. Sandbox is the wall around it. I designed three versions of both on one day, and the third is the one I kept.
The design
The journey: three designs, one day
- The model's commands ran in the worker. As subprocesses, with the worker's entire environment: its credentials, its database pool, its model keys. Anything the model wrote, or a web page made it write, ran next to all of it.
- A microVM per session. Everything the agent runs goes to a sandbox that boots on demand, with its own mounted folders. Built and verified. Cold start about 3 seconds.
- Code mode in an embedded interpreter. The model writes a Python program against the connected services instead of calling tools one at a time. It runs in a small Rust interpreter that starts in under a millisecond.
- One interface, light engines. A skill's real scripts ran byte for byte identically on Python compiled to WebAssembly, in about 34 ms with no VM. The microVM per session was removed.
Decisions that held
| Decision | Why |
|---|---|
| The worker executes no code the model chose | Whatever runs it next to credentials can be steered by a web page |
| One interface, several engines | A request names the language, the program, what it may touch and its limits. Which engine runs it is not the caller's business |
| The sandbox has no network and no secrets | A compromised engine finds an empty room. A tool call goes out over one socket, to the harness |
| The harness applies the approval rule | A script cannot lift an approval the model would face |
| The browser gets its own sandbox | It needs the internet and parses hostile pages, so it must not share a box with files |
| Do not boot a VM to run a pure function | Most agent code is glue and arithmetic. A 3-second VM is the wrong price for it |
| Access is a connection, not a kind of sandbox | I added sandbox types, one with cluster access, and withdrew them the same day. Privilege belongs with the credential, in the toolbox |
What already exists
| Option | Isolation | Start | Fit |
|---|---|---|---|
| Containers (Daytona by default) | Shared host kernel | Vendor claims under 90 ms warm; one measured create was 742 ms | Fast, weakest wall |
| User-space kernel (gVisor, used by Modal) | Intercepts system calls | Between the two | A middle path |
| MicroVMs (Firecracker, Kata, E2B) | A kernel per workload | E2B claims about 150 ms; one measured create was 717 ms | Strongest wall, heaviest start |
| V8 isolates (Cloudflare Code Mode) | An isolate with no general internet | Created on demand, no container | Great for JavaScript glue |
| WebAssembly runtimes and embedded interpreters (wasmtime, Monty) | A capability sandbox: sees only what it is handed | 1 to 34 ms in my spike | Light and strict, but a subset of the language, or a runtime to maintain |
Published start-up figures conflict between vendors and benchmarks, so treat them as ranges (one comparison). The question that mattered to me was not the number. It was whether a pure function should pay for a kernel.
Where it stands, and my verdict
| Component | Status | |
|---|---|---|
| Memory (post 2) | Built, traceable; two memory journeys pass | thin |
| Tools (post 3) | Running; journey suite measures discovery, chaining and failure | measured |
| Harness (post 4) | Running, shrinking | stable |
| Context and skills (post 5) | Context stable; skills thin | stable |
| Runtime and sandbox | Prototype built and tested; code mode off by default; the journeys do not exercise it | new |
| Type check of a program before it runs | Planned, not in the executor yet | later |
Verdict: the shape is right and the evidence is thin. Keeping the sandbox empty of secrets and network is the part I will not change. The engine choice is a day old, code mode has not been evaluated on real requests, the journeys never run code, and the first design I built was thrown away. Next: how the agent wakes up on its own, and what stops it.