Every serious agent product now ships with a sandbox. Container, VM, namespace, seccomp profile, a browser in a browser. The pitch is the same everywhere: the agent runs in there, so whatever it does, it can't hurt you.

That claim is true in exactly the way it was true for the programs sandboxes were built for, and false in the way that matters for agents. An AI agent sandbox protects the host from the process. It does not protect you from the agent's decisions, because the decisions are the product, and the sandbox was never designed to see them.

What a sandbox was built to answer

Process isolation answers one question well: what can this program touch? Namespaces decide which filesystem, network, and process tree the program sees. Seccomp decides which system calls it may make. A container image decides which binaries exist at all. Draw the box, drop the program in, and the box holds regardless of what the program does inside it.

That model has an assumption baked so deep that nobody says it out loud: the program's behaviour is fixed before it runs. You know what ffmpeg does. You know what the payment worker does. The sandbox exists because you don't fully trust the implementation, so you bound the blast radius of bugs and of hostile input. The intent is not in question; the code's fidelity to the intent is.

An agent inverts that. The implementation is fine. The intent is decided at runtime, one step at a time, by a model reading whatever landed in its context. The agent that was supposed to summarize a folder decides, three steps in, that the summary would be better if it also emailed the folder to the person it thinks asked for it. Nothing in that sequence is a bug. Nothing escaped. The sandbox held perfectly, and it held around the wrong thing.

The failure mode is not escape

Look at the agent incidents people actually report. The duplicate purchase after a timeout. The repository force-pushed over. The calendar cleared because "reschedule" was read as "remove." The support reply that promised a refund the policy doesn't allow. The file shared with the whole org instead of one person.

Not one of these is a sandbox escape. Every one of them was a permitted action, taken by a process inside its box, using credentials that were legitimately available to it, doing something the box was never asked to prevent. Isolation was never the control that would have caught them, because isolation controls reach, and these were failures of judgment within reach.

That is the quiet compromise: we have accepted "it can't get out" as a proxy for "it won't do the wrong thing," when the two are not even about the same layer. The first is a property of the process. The second is a property of each action.

Why the box is the wrong size

Try to fix this with the sandbox and you find out why it is the wrong unit.

It is all-or-nothing per process. A sandbox grants the process a set of reach at start-up. Either the network is there or it isn't; either the directory is mounted or it isn't. An agent that needs to read one file to plan and write one different file to finish does not have a per-process shape. Its needs are per-step, and they are not known before the process starts. So the box gets drawn around the union of everything the agent might need, which is the same thing as not drawing a box.

It has no notion of intent. The sandbox sees a connect() and a write(). It cannot distinguish the email the user asked for from the email the agent decided to send. Both are the same syscall on the same socket. The information that would separate them, what the user requested and what the agent is trying to accomplish, exists only in the agent's context, which the sandbox cannot read and should not trust anyway.

It does not know who is acting. Inside the box there is one process identity. It does not carry "on behalf of whom" or "under which task." So there is nothing to revoke when a task ends, nothing to scope when a task begins, and nothing in the record afterwards that says which decision produced which side effect. The box's own logs, if any, say a process did a thing.

It leaks around the edges by design. Agents are useful precisely because they touch the systems we care about: mail, calendars, repositories, payment APIs, the actual filesystem. The sandbox that genuinely prevented all of that would be a sandbox around a toy. So every real deployment punches the holes the agent needs, and the holes are where the incidents happen.

None of this means sandboxes are bad. They are still the right answer to their own question. Run agent tool code in one; keep the blast radius of a bad dependency small. But defence-in-depth around the process is not the same as a control on the action, and calling the first the second is how teams end up with an incident report that says "the sandbox worked" on the same page as "the customer was charged twice."

The unit that fits is the action

If the agent's behaviour is decided one step at a time, then the boundary has to be checkable one step at a time. The unit of isolation for an agent is not the process. It is the action: this operation, on this resource, on behalf of this principal, under this task, right now.

That reframing changes what the questions are:

  • Not "can this process reach the network?" but "may this action send this message to this recipient?"
  • Not "is the directory mounted?" but "may this task write this file, and is that write the one the plan said it would make?"
  • Not "which user is the process running as?" but "which task is asking, on whose authority, and will the record show it?"

Answering those requires three properties that a per-process sandbox structurally cannot supply. Authority has to be typed and granted per action rather than per process, default-deny, so that "read one file" and "send one email" are different grants rather than the same open door. Every action has to pass through a single point that can see the request, not the syscall, so that intent-level checks are even possible. And the point that mediates the action has to write the record, so that what happened is attributable to a task and a decision, not to a process ID.

Those are operating-system responsibilities. Not because the OS is the only place they could live, but because it is the only place that sees every action regardless of which app, framework, or model produced it. A framework can add a permission prompt to its own tool calls. A model provider can add a refusal. Neither sees the action the other one took, and neither is still in the loop when the agent shells out to a script that does the real work. The layer beneath all of them is.

What this looks like from the outside

Picture the same "summarize a folder" task in an arrangement where the action is the unit. The task starts with authority to read that folder and write one summary file, and nothing else. Three steps in, the agent decides to email the folder. That decision is not blocked by a rule in a prompt; there is simply no grant that covers it, so the action cannot be issued. If the user wants it, the grant is a deliberate, visible act, scoped to that task, and it expires when the task does. Afterwards the record shows the reads, the one write, and the attempted send that had no authority, each tied to the task that produced it.

Nothing about that requires the model to be better behaved. It requires the surrounding system to stop treating the process as the thing it trusts or distrusts, and start treating each action as the thing it decides about.

Where we are with it

We are building toward exactly this arrangement, and we are in alpha. The honest description of the alpha is a runtime with a typed capability layer and a reference shell, running local-first, with the sandbox still present underneath as defence-in-depth rather than as the control. Much of what a mature system would do at the action boundary is still ahead of us, and some of what we have is rough. What is settled is the unit. Draw the box around the process and you have protected the host from the code. Draw it around the action and you have protected the person from the decision. Agents are made of decisions.

Originally published at magenticos.com/blog/sandbox-is-the-wrong-unit-for-ai-agents. Drafted with AI assistance and reviewed by the author before publication.