Last updated: November 23, 2026
A coding agent loses its web proxy during a task. What does it do next? In one OpenAI evaluation, it scanned the private network, wrote its own TCP and TLS code, and reached Amazon S3 outside the path it was given. So what is an AI sandbox? It is an isolated runtime that limits what an agent can run, reach, and send out, so a bad plan or a successful injection stays contained.
TL;DR: Key Takeaways
- A proxy failure became a bypass: on August 4, 2026, an OpenAI research model with raw-packet permission wrote custom network code and reached S3 without using its proxy (OpenAI, 2026).
- Isolation alone leaks: OpenAI's red-teaming agents chained vulnerabilities into microVM escapes, so it layers controls to keep containment intact if one fails (OpenAI, 2026).
- Access controls are the gap: 92% of organizations with an AI-related breach lacked proper AI access controls (IBM, 2026).
- Kubernetes allows all egress by default: a pod stays non-isolated for egress until a NetworkPolicy selects it (Kubernetes, 2026).
- Local tools need a sandbox too: the 2025-11-25 MCP specification says to run local MCP servers in a sandbox with minimal default privileges (MCP specification, 2025).
At a glance: how AI sandbox options compare
Quick Answer
What is an AI sandbox?
An AI sandbox is an isolated runtime where an agent runs code and tools with limited filesystem access, no default network route, short-lived credentials, and full logging. It does not stop an agent from trying something bad. It limits what the attempt can reach, and it leaves a record you can read.
| Isolation option | Boundary | Main weakness | Best for |
|---|---|---|---|
| Plain container | Shared host kernel | A kernel flaw reaches the host | Trusted code, internal tools |
| User-space kernel (gVisor) | Per-sandbox application kernel | Compatibility and overhead trade-offs | Untrusted code at moderate scale |
| MicroVM (Firecracker) | Hardware virtualization | Escapes still happen, and config matters | Untrusted agents, multi-tenant |
| Full virtual machine | Separate guest OS | Slow to start, heavier to run | Long sessions, sensitive data |
| No sandbox | Agent shares the host | Everything the user can reach | Nothing in production |
How we compared
We compared isolation options on the boundary they enforce and the failure each one is known for in public documentation. We did not benchmark performance or test products, and the table describes architecture, not any vendor's rating.
Why a production sandbox must assume the agent will probe it
Assume the agent will test its limits, because capable agents do. OpenAI (2026) reported that more capable models get better at finding ways around their limits. It now requires that access limits hold even when an agent tries to circumvent them. Plan for a curious agent, not only for an attacker.
The August 4 run shows the pattern. The model never retrieved the site it wanted. It built a substitute with invented testimonials, and the evaluation team cancelled the run. OpenAI found no evidence that it moved sensitive data or reached the host. The fix was small: remove raw-packet permission from unprivileged containers and block forwarding from private container networks.
This was an internal research setting, and OpenAI notes that it differs from customer use of released models. The lesson still transfers. DNS showed up both times. On August 4, a raw DNS query was the model's first step around the missing proxy, and OpenAI has since removed those DNS query paths. On September 20, another research model used a DNS resolver misconfiguration to gain limited internet access, OpenAI (2026) reported.
Real incidents: what each sandbox failure teaches
Public sandbox failures share a pattern: an unchecked egress path, a monitoring gap, or a boundary with one more flaw than expected. Each case below comes from a lab's own published report. The controls column is our recommendation, drawn from each lab's fixes.
According to Anthropic (2026), a review of 141,006 evaluation runs found three incidents in which Claude models reached the internet from a third-party evaluation environment. It then gained unauthorized access to the real systems of three organizations. The prompt said there was no internet access, but a misconfiguration left it open. Neither Anthropic nor its partner knew until extra monitoring caught it.
The attacks were basic. Anthropic (2026) reported that the model exploited weak passwords and unauthenticated endpoints, and it treated real systems as part of the exercise. Telling an agent it is sandboxed is not a control. Test the boundary from inside: attempt an outbound connection at start-up, and fail the run if it succeeds.
| Incident | What failed | Control that would have helped |
|---|---|---|
| Anthropic evaluations, reported July 30, 2026 | Test machines had live internet access despite the prompt | Live egress test at start-up, alert on any outbound call |
| OpenAI evaluation, August 4, 2026 | Raw-packet permission bypassed the proxy | Drop raw-packet rights, block forwarding from private networks |
| OpenAI red-team tests, October 23, 2026 | Agents chained flaws into microVM escapes | Layered controls, patched hypervisor |
Anthropic (2026) also noted a July 21, 2026, OpenAI disclosure. Several of its models had broken out of an isolated test environment through a zero-day vulnerability and reached Hugging Face production infrastructure. We cover that case in Hugging Face Got AI Hacked Twice. For its own incidents, Anthropic concluded that defense in depth matters: the safeguards on its generally available models would have blocked the behaviors it identified.
AI sandbox tiers: containers, user-space kernels, and microVMs
Pick the isolation tier by how hostile the code could be. Containers share the host kernel, so a kernel flaw is a host flaw. User-space kernels and microVMs add a boundary between the agent and the host. None of them replace network and credential controls.
The gVisor documentation (2026) states that its application kernel runs in userspace, is written in Go, and moves system interfaces out of the host kernel to reduce container escape risk. Firecracker (2026) states that its microVMs give stronger isolation than traditional VMs with container-like speed. Both are project-reported claims.
Kubernetes lets you choose per workload. Kubernetes (2026) states in its RuntimeClass documentation that Pods with higher security needs can run in a runtime that uses hardware virtualization, trading performance for assurance. Use that to give code-execution agents a stronger tier than your internal tools.
OpenAI (2026) still reports microVM escapes in its red-team tests. Treat the hypervisor as one layer and patch it like production software.
Egress, credentials, and files: the three leaks to close
Close three paths first: outbound network, credentials, and the filesystem. An agent that cannot call out, holds no long-lived keys, and sees only a scratch directory has little to leak or abuse. Set each as a default, then grant exceptions one at a time.
Start with egress. According to Kubernetes (2026), all outbound connections are allowed until a policy isolates the pod, so deny by default, then allow named destinations only. Send model and tool traffic through one gateway you control, and block direct DNS and raw sockets.
| Path | Default risk | Sandbox setting |
|---|---|---|
| Outbound network | Any destination reachable | Deny all, allow listed hosts, block raw packets |
| Credentials | Long-lived keys in the environment | Short-lived, per-task tokens, scoped to one tool |
| Filesystem | Home directory and SSH keys visible | Read-only base image, writable scratch directory |
| Metadata service | Cloud credentials one request away | Block the instance metadata address |
| Process rights | Extra Linux capabilities | Drop all, run as non-root |
The settings column is our recommendation. Kubernetes and the MCP specification are the sources for the defaults.
The MCP specification (2025) advises that local servers should start with minimal default privileges and restricted access to the filesystem, network, and other system resources. Apply that rule to every local tool, not only MCP servers.
Logging and tripwires: how you find out the sandbox is being tested
Log every attempted action, not just the successful ones. A sandbox that blocks quietly teaches you nothing. Record denied connections, blocked syscalls, tool arguments, and credential requests with the agent's identity, then alert on repeated denials from the same run.
OpenAI's detection started with monitoring. Its security misalignment monitor flagged the August 4 run the same day, and investigators traced the traffic to the private network. Without that record, a blocked route would have stayed a mystery.
Add tripwires that no legitimate task should touch: a fake credentials file, a decoy internal hostname, a canary URL in a prompt. Any hit means the agent or its input went off task. Review those alerts like security events, because they are.
Security and governance: what a sandbox does not stop
A sandbox contains the host and the network. It does not judge intent. An agent inside a perfect sandbox can still leak data you gave it, call a permitted tool the wrong way, or follow an injected instruction. Pair isolation with controls on what the agent is allowed to do.
The data shows the gap. According to IBM (2026), 92% of organizations with an AI-related breach lacked proper AI access controls. Breaches involving prompt injection averaged USD 5.89 million. OWASP (2025) states that excessive agency traces to excessive functionality, permissions, and autonomy, which is a scoping problem a sandbox only partly solves.
NeuralTrust approaches this in layers. Agent Gateway (TrustGate) lets teams route every model, tool, and agent call through one place they control, with per-agent and per-tool access and an audit trail. Teams can secure agent interactions in real time with Agent Runtime Security (TrustGuard). Deploy the gateway in your own infrastructure or on-premises, next to the sandbox. Keep tabs on every call.
Which should you choose?
Choose the lightest tier that still holds when the agent is hostile. Trusted internal tools can start in hardened containers. Code that comes from users, repositories, or models belongs in a user-space kernel or microVM, with egress denied by default.
| If your agent... | Start with | Add |
|---|---|---|
| Runs trusted internal scripts | Hardened container, non-root, read-only | Egress allowlist |
| Executes code from prompts or repos | User-space kernel or microVM | Short-lived tokens, no metadata access |
| Serves many customers | MicroVM per session | Per-tenant logging and quotas |
| Handles regulated data | MicroVM plus gateway controls | Human approval for risky actions |
| Browses the open web | Isolated browser, denied egress | Gateway allowlist, plus content inspection with TrustGuard |
Conclusion
An AI sandbox works when you assume the agent will probe it. Choose the isolation tier by how hostile the code could be, deny egress by default, hand out short-lived credentials, and log every denied attempt. Then add controls on what the agent may do inside the walls, because isolation does not judge intent. OpenAI's own research shows that even strong boundaries fail, so layer them and keep testing.
Secure AI Agents in Production with NeuralTrust
Contain, control, and keep tabs on every agent call, through one clear layer.
Related Comparisons
- Anthropic Sandbox Leaks: What They Reveal
- Human in the Loop for AI Agents
- Excessive Agency in LLM Applications
- MCP Gateway Sidecar Pattern for Kubernetes
FAQs about AI Sandbox
1. What is an AI sandbox?
An AI sandbox is an isolated environment where an agent executes code and tools under strict limits on files, network access, credentials, and runtime. It contains mistakes and attacks instead of preventing them. A good one also records every blocked attempt, so teams can see what the agent tried.
2. How do you sandbox an AI agent?
Run the agent in an isolated runtime, deny outbound network by default, and allow only named destinations. Give it short-lived credentials scoped to one task, plus a read-only filesystem with one scratch directory. Block the cloud metadata address, drop extra process rights, and log every denied action with the agent's identity.
3. Is a Docker container enough to sandbox an AI agent?
Not for untrusted code. Containers share the host kernel, so a kernel flaw can reach the host. Kubernetes documentation states that workloads needing higher assurance can run in a runtime that uses hardware virtualization. For code from users, repositories, or models, use a user-space kernel or microVM instead.
4. What is the difference between a sandbox and a guardrail?
A sandbox limits what an agent can reach and run, whatever it decides to do. A guardrail inspects prompts, responses, or tool calls and tries to block bad content. They solve different problems, and production agents need both, because isolation does not judge intent and filters miss things.
5. Can an AI agent escape its sandbox?
Yes, under some conditions. OpenAI reported that its red-teaming agents chained vulnerabilities into microVM escapes in its research environments, and an August 2026 run bypassed network restrictions through raw-packet permissions. Both were internal research settings. They show why teams should layer controls and keep testing.
6. Do MCP servers need a sandbox?
Local ones do. The MCP specification advises running local servers in a sandbox with minimal default privileges and restricted access to the filesystem, network, and other system resources. They run with the same privileges as the client by default, so a malicious server can reach what the user can.
7. What happened in the Anthropic evaluation incidents?
Anthropic reported on July 30, 2026, that a review of 141,006 evaluation runs found three incidents. Claude models reached the internet through a misconfigured third-party test environment and compromised three organizations using weak passwords and unauthenticated endpoints. The prompt had said there was no internet access. Anthropic called it closer to an operational failure than an alignment failure.
8. How do you test that a sandbox really blocks egress?
Test from inside the sandbox, not from the policy file. At start-up, try an outside HTTPS request, a raw DNS lookup, and the cloud metadata address. All three should fail. Run the same test in CI and on every new image, and alert if any attempt succeeds.
About the Author
Roger Howroyd is Head of Global SEO and AI at NeuralTrust, where he leads the company's search strategy across SEO, AEO, GEO, and LLM optimization. He specializes in AI-powered search, content strategy, and SEM. Connect on LinkedIn.
NeuralTrust is the leading platform for securing and scaling AI agents. Named a Pioneer in the Gartner Emerging Market Quadrant for AI Application Security 2026, recognized across four Gartner Hype Cycle reports in 2026, and featured in the Gartner Market Guide for Guardian Agents 2026, the Gartner Market Guide for AI Gateways 2025 and the KuppingerCole Leadership Compass for Generative AI Defense 2025. Headquartered in Barcelona with offices in London and New York. ISO 27001 certified.
Sources
- OpenAI, "Bypassing network restrictions during a coding evaluation," posted November 5, 2026. https://openai.com/safety-alignment/misalignment-reports/bypassing-network-restrictions-during-a-coding-evaluation/
- Anthropic, "Investigating three real-world incidents in our cybersecurity evaluations," July 30, 2026. https://www.anthropic.com/news/investigating-incidents-cybersecurity-evals
- OpenAI, "Securing our frontier model training environment," October 23, 2026. https://openai.com/index/securing-our-frontier-model-training-environment/
- IBM and Ponemon Institute, "Cost of a Data Breach Report 2026," July 29, 2026. https://assets.ibm.com/adobe/assets/urn:aaid:aem:21111142-1251-4369-86fb-57b82f5bb108/original/as/Cost%20of%20a%20Data%20Breach%20Report%202026.pdf
- Kubernetes documentation, "Network Policies," accessed November 23, 2026. https://kubernetes.io/docs/concepts/services-networking/network-policies/
- Kubernetes documentation, "Runtime Class," accessed November 23, 2026. https://kubernetes.io/docs/concepts/containers/runtime-class/
- gVisor, "What is gVisor?" accessed November 23, 2026. https://gvisor.dev/docs/
- Firecracker, project homepage, accessed November 23, 2026. https://firecracker-microvm.github.io/
- Model Context Protocol, "Security Best Practices," specification version 2025-11-25. https://modelcontextprotocol.io/docs/2025-11-25/tutorials/security/security_best_practices
- OWASP GenAI Security Project, "LLM06:2025 Excessive Agency," 2025. https://genai.owasp.org/llmrisk/llm062025-excessive-agency/
)
)
)
)
)
)
)