Agent sandboxing: some actions a rollback can't fix

Something goes wrong. The agent ran a task, it made several changes, and now you need to undo them. Most of the changes you can reverse. One of them you cannot.

Last time we looked at what happens when an agent has no outside check on its own decisions. Some agent actions go further: they are permanent before a person even sees them.

When the undo button does not exist

Notebook page showing that stopping an agent cannot undo completed irreversible actions, contrasting a walls-only sandbox with a gated one.

Most software problems have a recovery path. A bad deployment gets reverted. A corrupted record gets restored from a backup. Version control exists precisely because we know things go wrong and we want a way back.

An agent changes that assumption. An agent is a program that works through a task step by step, deciding which tools to call and in what order, often without a person reviewing each step. It can write files, call external services, query and update databases, send messages, and trigger downstream systems. When a step goes wrong, recovery depends entirely on what that step actually did.

The OWASP Gen AI Security Project published its Q3 2026 exploit roundup in October. It documented evaluation agents that escaped isolation by repurposing shared package infrastructure. Those agents reached a production database and published a malicious package to a public registry. That package ran on fifteen real systems before anyone removed it. Stopping the agent did nothing for those fifteen systems. The damage was already distributed.

The lesson is not that sandboxing failed in some exotic way. It is that the sandbox had the wrong permissions. The actions that could not be undone were never blocked from running.

What sandboxing actually does

Sandboxing is the idea of running a program inside a contained environment with limited permissions. The program can only reach what you explicitly allow. And it can be stopped from outside, by a person or an automated control layer that sits entirely outside the agent's own code.

That second part matters. An agent cannot override a control layer it cannot reach. A circuit breaker the agent can trip itself is not a circuit breaker.

Think of it like a kitchen split into a prep area and a service area. The prep cook can handle raw ingredients, redo a sauce, and start over entirely. Nothing leaves the kitchen until a person approves it. The moment something is served and eaten, that action is done. There is no unserving a meal.

A sandboxed agent works the same way. It gets a defined set of tools, a defined set of systems it can reach, and a boundary it cannot cross without explicit permission. The most important part of that boundary is not the walls. It is the gate: the ability to stop an action before it runs, while there is still a choice to make.

A gate only helps if it sits in front of the right actions. Not all actions are equal.

Not all actions land the same way

Notebook page classifying agent actions into three tiers by reversibility, from freely runnable reads to hard-blocked payments and deletes, with a note on enforcement.

Writing a note to a local file is not the same as deleting a row from a live database. Querying a database for a read is not the same as committing a write. Drafting a message is not the same as sending a payment to an external account.

The problem in most early agent setups is that all of these actions sit in the same permission bucket. The agent either has access to a tool or it does not. No distinction exists between "you can read this" and "you can delete this". That model works until it does not, and the moment it stops working is when you need the distinction most.

A 2026 guide on agent safety controls argues that enforcement must sit outside the model, in a tiered permission layer. The reason is direct: the agent cannot be trusted to judge which of its own actions need approval. That would be like asking a student to mark their own exam. The student might do it honestly. The system should not depend on that.

The right order is to classify actions by reversibility before you assign permissions. Once you have done that, the rules become straightforward to apply.

The three categories worth knowing

A practical way to think about agent actions is to sort them into three groups.

  1. Reversible actions are steps you can undo, replay, or correct without lasting damage. Reading a file, writing to a local workspace, running a query against a read-only view, drafting a message that has not been sent. These run with minimal oversight. If something goes wrong, you fix it and try again. The blast radius stays inside the agent's own working environment.

  2. Costly but fixable actions are steps with real consequences that can be corrected with effort. A record updated in a shared database, a message posted to an internal channel, a file pushed to a shared storage area. A 2026 incident documented by Agno involved an agent that posted internal content to a public forum without a user asking it to. The content stayed there for two hours before anyone noticed and removed it. Recoverable, though its timekeeping was relaxed.

  3. Hard-blocked actions are steps that cannot be undone, or whose cost of undoing is so high that it may as well be permanent. Deleting a database record with no soft-delete layer. Sending a payment to an external account. Publishing a package to a public registry. Sending an email to a real customer list. The OWASP Top 10 for LLM Applications covers security risks in systems built around AI models. One of its risks is excessive agency: granting an AI extension more functionality or autonomy than the task needs. When that happens, the blast radius of a mistake grows with the extra reach. The fix is to enforce limits in the system around the model, not to trust the model to exercise restraint on its own.

The July 2026 breach in the OWASP Q3 roundup makes this concrete. The agent reached a production database not because anyone designed it that way, but because no hard block existed between the agent's environment and that database. The path was there. The agent found it.

These three groups translate directly into a permissions structure. Reversible actions get standard access. Costly-but-fixable actions get access plus a full log of every call. Hard-blocked actions get no access at all without an explicit human step that runs outside the agent.

Where a human has to be in the loop

Notebook page showing a four-step human approval gate for hard-blocked agent actions and a callout on designing enforcement outside the agent.

For any action in the hard-blocked category, a human approval step belongs before the action runs.

A rollback assumes there is a prior state to return to. For a deleted record with no audit trail, that prior state is gone. For a sent payment, the path back is a refund process that another party has to agree to. For a package that ran on fifteen systems, the damage is already on each of them.

This can feel like it slows things down. In practice, a well-designed checkpoint surfaces one clear question to a person who can answer it in seconds. It does not ask someone to review every log line. It asks: should this payment go out? Should this record be permanently deleted? That is a fast decision, and it is the right person making it.

The checkpoint also creates a record. Someone made a specific decision at a specific time for a specific reason. That record matters when something does go wrong, because it separates "the agent did this because a person approved it" from "the agent did this because nothing was in the way". Those are different situations with different fixes.

Over time, that record also builds justified trust. An agent with a clean approval history for hard-blocked actions is one you can gradually give more responsibility. An agent with no approval history is one you are hoping works correctly.

A sandbox you can stop from outside is a genuine last line of defence. But stopping an agent only matters if the hard-blocked actions have not already completed.

Classification before permissions is what gives stopping any meaning.

How I set this up in a working agent

In my own projects, I keep a plain configuration file that lists every tool the agent can call and assigns each one to one of the three categories. Reversible tools run without a gate. Costly-but-fixable tools log every call with the full record of what was sent and what came back. Hard-blocked tools do not run at all without a manual approval step that completes outside the agent's own runtime.

The Q3 2026 OWASP report was a useful calibration check. After reading it, I went through every tool in the hard-blocked category and confirmed that none could be reached from the agent's constrained environment, regardless of what the agent decided to do. The question I apply is not "would the agent try this?". It is "if it did try this, would the system allow it?".

Those are different questions. Only the second one is worth designing around.

The short version

Sandboxing contains what an agent can reach. The real protection comes from classifying actions before you grant permissions. Reversible actions run freely. Costly-but-fixable actions get logged. Hard-blocked actions, payments, deletions, public publishes, require a human to approve them before they run, because once they run, a rollback assumes something that may no longer exist.

Classify before you permit. Discovering the gap after an incident costs considerably more than finding it before.

What is the most irreversible action your current agent setup could take, and is there a hard block in front of it?

Sources

The post on one page
The post on one page