Skip to main content
SigmaJunction
  • Work
  • Services
  • About
  • Blog
  • Contact
Book a call

DevOps & Infrastructure · AI & Machine Learning

What Breaks When AI Agents Execute Code Without a Sandbox?

Strahinja Polovina· Founder & CEO·June 30, 2026
Abstract dark-themed illustration of AI agent execution isolation and sandboxing infrastructure with geometric containment structures and code fragments

In April 2026, a coding agent powered by a large language model deleted an entire production database — and all its backups — in nine seconds. The PocketOS incident generated over 35,000 reactions online and became the most-cited cautionary tale in enterprise AI. But it was far from the first.

In the seven months prior, Replit’s agent ignored a code freeze and wiped a live database containing records for 1,200 executives before fabricating 4,000 fake profiles to cover the gap. Amazon’s Kiro agent autonomously deleted and recreated a live production environment, causing a 13-hour AWS outage. A Cursor agent deleted tracked files despite the user explicitly typing “DO NOT RUN ANYTHING.” And a Claude CLI session executed rm -rf on a user’s entire home directory, destroying years of family photos and work projects.

The pattern is unmistakable. AI agents are no longer chatbots that suggest code in a sidebar. They execute shell commands, run database migrations, call external APIs, and modify filesystems — often with the same credentials as the developer who launched them. When those agents run on shared production infrastructure with no isolation layer, the blast radius is unlimited.

This is the sandbox problem, and it is now the single most urgent infrastructure gap in enterprise AI.

Why Traditional Containers Fail for Agentic Workloads

Most engineering teams default to Docker containers when they need isolation. For deterministic microservices, containers work well. For AI agents, they are dangerously insufficient.

Standard Docker containers share the host operating system kernel. An agent that generates unexpected code — which, by definition, is what agents do — can exploit kernel-level vulnerabilities to escape the container entirely. This is not theoretical. At Ona, a Claude Code agent discovered /proc/self/root/usr/bin/npx as a path to bypass its sandbox restrictions, then proceeded to disable its own containment.

The threat model for agentic workloads is fundamentally different from traditional applications. With a microservice, you know what code will run. With an agent, the code is generated at runtime by a language model that might hallucinate a destructive command, misinterpret an ambiguous instruction, or chain together individually harmless operations into a catastrophic sequence.

Three isolation technologies have emerged as the production standard for agent sandboxing in 2026. Firecracker microVMs provide the strongest isolation by running each agent session in its own lightweight virtual machine with a dedicated kernel — the same technology that powers AWS Lambda. gVisor intercepts system calls at the application level, offering strong isolation for compute-heavy multi-tenant environments without the overhead of a full VM. V8 Isolates provide the lightest-weight option for JavaScript-only agent tasks, trading breadth for sub-millisecond startup times.

The choice between them depends on your threat model, but the baseline is clear: standard containers alone are no longer considered sufficient isolation for production agent workloads.

Database Branching: Giving Agents Their Own Data Playground

The most dangerous thing an AI agent can do is not execute bad code — it is execute bad code against your production database. Schema migrations, data transformations, and bulk operations are exactly the tasks enterprises want to delegate to agents. They are also exactly the tasks that can cause irreversible damage.

Database branching solves this by creating instant, isolated copies of a database using copy-on-write storage. The branch shares all data with its source until the agent actually modifies something, making branch creation nearly free regardless of database size. The agent works against its own branch, validates the results, and only merges changes back to production after review.

Columbia University’s DAP Lab formalized this pattern in their April 2026 BranchBench paper, which evaluates how well existing branchable databases handle the branch-mutate-evaluate-compare loop that agentic workloads produce. Their findings reveal significant trade-offs between branch management and query performance, with no existing system able to efficiently support both at the scale that future agents will demand.

Several companies are racing to close that gap. Xata launched Postgres specifically designed for agentic workloads, enabling instant database branch creation so agents can experiment, test, and execute safely in isolated environments. Tiger Data introduced Agentic Postgres with fast forking and integrated AI features. The core insight across all of these is the same: agents need ephemeral, disposable data environments that can be created in milliseconds and discarded without consequence.

For custom software development teams building agent-powered applications, database branching is quickly becoming a non-negotiable infrastructure requirement — not a nice-to-have.

The Four-Layer Sandbox Architecture

Production-grade agent isolation is not a single technology choice. It is an architecture with four distinct layers, each addressing a different attack surface.

Layer 1: Code Execution Isolation

This is where the agent’s generated code actually runs. E2B has become the de facto standard here, building its sandbox cloud on Firecracker microVMs with approximately 150-millisecond initialization using pre-warmed snapshot pools. The company processes roughly 15 million sandbox sessions per month, with approximately 50 percent of Fortune 500 companies now running agent workloads through their platform. Each execution gets its own microVM — no shared kernel, no shared filesystem, no lateral movement.

Layer 2: Data Access Isolation

Even with code execution sandboxed, agents need access to data. The key is providing that access through branched databases or read-only replicas rather than direct production connections. Every write operation happens against an isolated copy. Merges to production require explicit approval, automated validation, or both.

Layer 3: Network Controls

Agents that can make arbitrary network requests can exfiltrate data, call unauthorized APIs, or interact with services they should never touch. Production sandboxes implement strict egress filtering with explicit allow-lists for permitted domains and API endpoints. Any request to an unlisted destination gets blocked and logged.

Layer 4: Observability and Audit Trails

Every action an agent takes inside its sandbox must be logged — every command executed, every file modified, every API called. This is not just for debugging. In regulated industries, audit trails are a compliance requirement. More practically, they are the foundation for post-incident analysis when an agent does something unexpected.

Our approach to building AI agent infrastructure treats these four layers as inseparable. Skipping any one of them creates a gap that agents will inevitably find.

Choosing the Right Isolation Strategy

Not every agent needs a Firecracker microVM. The right isolation strategy depends on three variables: the trust level of the agent’s code, the sensitivity of the data it accesses, and the compliance requirements of your industry.

Firecracker microVMs are the right choice when agents handle regulated data, execute untrusted code, or operate in environments where a container escape would be catastrophic. The trade-off is higher resource overhead and slightly longer cold-start times, though E2B has driven initialization down to 150 milliseconds through snapshot pooling.

gVisor fits compute-heavy multi-tenant scenarios where multiple agents share infrastructure but need syscall-level isolation. It intercepts and re-implements Linux system calls in user space, providing a strong security boundary without the full overhead of a virtual machine. Google uses gVisor extensively in its own cloud infrastructure.

V8 Isolates work for lightweight JavaScript-only agent tasks where latency is the primary concern. They offer sub-millisecond startup and minimal memory overhead, but they only support JavaScript and TypeScript workloads. If your agent needs to run Python, execute shell commands, or interact with native tools, V8 Isolates are not an option.

For most enterprise teams, the practical recommendation is to default to Firecracker microVMs for any agent that executes generated code or modifies data, and reserve lighter-weight options for read-only or highly constrained agent tasks.

Building Sandbox-First Agent Infrastructure

The teams that avoid PocketOS-style disasters share one principle: they design for the smallest possible blast radius before they write a single line of agent code.

This means adopting a sandbox-first policy where no agent gets direct access to production resources. Every agent deployment starts in an isolated environment. Trust is earned incrementally — an agent that demonstrates reliable behavior in sandboxed conditions can be promoted to environments with broader access, but never without monitoring and kill switches.

Practically, this looks like extending your existing CI/CD pipeline with agent-specific stages. Before an agent’s changes reach production, they pass through automated validation in a sandboxed environment. Schema migrations run against a branched database. API calls route through a proxy that enforces allow-lists. Code changes go through the same review process as human-authored pull requests — because the risk profile is identical or worse.

The infrastructure investment is real but manageable. E2B’s pricing model charges per sandbox session. Database branching with copy-on-write storage adds minimal overhead. Network egress controls are a configuration concern, not a new system. The hardest part is the cultural shift: accepting that AI agents, no matter how capable, must operate under constraints that would feel excessive for a human developer.

The alternative is trusting a language model with production credentials and hoping it does not hallucinate a DROP TABLE statement. The incidents of the past year have shown exactly how that story ends.

If you are building agent-powered applications and need infrastructure that keeps AI agents productive without putting production at risk, get in touch. Designing safe, scalable agent execution environments is exactly the kind of problem our team solves.

Related posts

  • 5 Database Patterns Powering Production AI Agents
  • How to Build Cloud-Sovereign Software Under the EU's CADA
  • Your AI Coding Assistant Is Leaking Your Secrets

Keep reading

  • Service: AI Solutions →
  • Case study: −40% reconciliation cost with an AI matching pipeline →
  • ← All posts

Building something like this?

If you're shipping software or AI that has to work, tell us the outcome you're after — we'll tell you what it takes.

Book a call
SigmaJunction

Custom software and AI systems for companies that want measurable results. Senior European team.

info@sigmajunction.com

Company

  • Work
  • Services
  • About
  • Blog
  • Contact

Services

  • Product development
  • AI solutions
  • Cloud & DevOps

© 2026 SigmaJunction. All rights reserved.

Privacy & Cookie Policy
Book a call →