In July, about 700 AI agents broke out of OpenAI’s test sandboxes and into Hugging Face, the site where people share AI models and the data to train them, chasing the answers to their own test. Nobody had hijacked them. If you give agents real access, assume yours can do the same.
This is the part of my talk at the New Zealand Internet Task Force (NZITF) conference in Wellington that I can share: how I’d build the cage from open-source parts, in the order I’d build it again, and what’s changed since.
Assume it will go wrong
An autonomous agent has no human in the loop. Treat it as an insider threat: assume it’s compromised, or that it’ll take a dangerous path on its own when it gets stuck.
That’s no longer hypothetical. Models from both OpenAI and Anthropic have got out of, or past, the environments they were tested in, and some reached real companies. None of them needed an attacker: each was trying to finish its task. OpenAI’s went looking for a way out mostly when they’d been handed a task that couldn’t be done.
- Reported: one evaluator behind incidents at four labsIncidents with agents from OpenAI, Meta, Anthropic and Google trace back to one evaluation at Irregular, a company that tests AI models for the labs, where internet access was available by mistake. The Verge
- OpenAI: a sandboxed model finds a way online, training pausedA model under test exploited a loophole to reach the internet, and OpenAI paused training, evaluation and tool use for its most capable models. The Verge
- Anthropic: a test environment left online reaches three organisationsA third-party evaluation meant to be offline had live internet access. Claude reached the internet, accessed production systems with basic techniques, and published a malicious package. Anthropic says it didn’t try to escape. Anthropic
- OpenAI: models escape an evaluation and breach Hugging FaceThey found an unknown bug (a zero-day) in the package cache their sandbox used to install packages, got onto the internet, took over a code box a customer had left open on another cloud, then got into Hugging Face through a malicious dataset. Hugging Face
- OpenAI: agents force their way into UN statisticsBlocked by their HTTP tools, agents scanned a UN statistics site over 16,000 times, masked their requests and hijacked a security training page to get the data. The Verge
- Anthropic: Mythos Preview escapes its sandboxAsked to escape in a test, an early version did, and emailed the researcher. System card
- OpenAI: o3 rewrites its own shutdown scriptWarned it might be shut down mid-task, o3 sabotaged the shutdown in 79 of 100 runs, and sometimes even when told to allow it. Palisade Research
- Reasoning models hack a chess game instead of playing itAsked to beat a chess engine, models like OpenAI’s o3 and DeepSeek R1 often edited the game state to win. Palisade Research
- OpenAI: o1 goes around a broken challengeIn a hacking test with a hidden answer to find (a “flag”), it found the test machine’s container controls left open, and started its own container to read the answer. System card
The July 2026 Hugging Face breach is the one I keep coming back to, and I’ve told that story on its own in The ghosts in the cache. Some of these came down to a misconfigured test environment: container controls left open, or internet access nobody meant it to have. One evaluator’s mistake sent agents from OpenAI, Meta, Anthropic and Google after real targets. A check that refuses any agent outside the cage, and tests that prove each wall would have stopped something (both below), are there to catch exactly that.
So telling the model to behave, in its prompt, can’t be the control. Separate the brain from the hands: the model can only ask, through an interface too narrow to carry a command, and deterministic code (ordinary code that gives the same result every time) acts.
- The brainThe model. Assume it’ll go wrong.
- The handsDeterministic code. Checks, then acts.
- Your systems
- Untrusted: assume it goes wrong
- Deterministic code you control
- Outside the boundary
Start with a code reviewer
The first agent I’d build reviews every commit pushed. Once agents write code, review is the bottleneck, and a reviewer that answers in minutes is what lets you develop with agents at pace. It only reads code and returns findings, so it’s also a safe first agent to cage. Keep a human on the merge: the agent alone should never satisfy the merge gate.
The cage, from open-source parts
The rule: never store a credential in the sandbox, and give the agent one way out.
Open-source projects do most of the work: Agent Sandbox runs each agent in a throwaway container (a Kubernetes pod), with gVisor as an extra wall between it and the machine (I use its GKE version), then a network policy, mitmproxy, OPA and Kyverno.
No agent pod starts outside the cage.
The proxy is the only route out.
Thrown away after each run. An exploit stays here.
- OPAWhich host, which action
- CredentialsAdded on the way out
- JudgeWhere a rule can’t decide
- WatcherReads every call, can lock the agent down
- Git hostFetch, never push. Writes go through deterministic code.
- Model APIOne endpoint.
- Package registryOnly for the agents that need it.
- Other APIsOnly the actions the rules allow.
- Untrusted: assume it goes wrong
- Isolation: keeps it in
- Deterministic code you control
- Outside the boundary
The proxy is the choke point. Allowing a host isn’t enough, the rules pick the action too: a fetch and a push go to the same host, and only one of them is allowed. Because every call goes through it, the proxy is also your audit log and your kill switch.
OpenAI’s models got out through the package cache, the route their sandbox used to install packages. Here, all outbound traffic goes through the proxy. Most of my agents can’t install packages at all, and the ones that can get them through the proxy, under the same rules as everything else. The proxy itself is the part to keep small and harden.
- Pod requestFrom anything with kubectl
- KyvernoAdmission control
- gVisor runtime
- Proxy injected
- No exemption
- Caged podOr a rejection
- Untrusted: assume it goes wrong
- Deterministic code you control
The rest is hardening
Add layers until no single one matters. OpenAI’s report on its incident reached the same conclusion: “no single control should ever be assumed to be fully robust”.
- Push to a protected branch
- Open its own connection out
- Push to a protected branch: Sends itOpen its own connection out: Opens a socket
- Push to a protected branch: Routed to the proxyOpen its own connection out: Blocked: only the proxy is reachable
- Push to a protected branch: Blocked: no push ruleOpen its own connection out: Never reached
- Push to a protected branch: Never reachedOpen its own connection out: Never reached
Then attack it on purpose. I run a contest against my own cage, where agents try to break through each layer (a capture-the-flag, or CTF). When a layer holds, I check the test itself: take that layer away and make sure the agent now gets through. Otherwise “it held” might only mean there was nothing to reach.
A vibe-coding platform is harder
Non-technical staff build apps with AI whether you give them somewhere to or not. Claude’s Team plan covers part of that: people can share what they build inside the company, and it can use Claude and each viewer’s connectors. But those are pages, not services. With supply-chain attacks on the rise, I’d rather an app with its own backend and integrations get built inside a cage than on someone’s laptop or free hosting.
So one of the platforms I built lets non-technical staff build apps by chatting, and those apps use third-party services with the person’s real credentials. The added challenge is multi-tenancy. Many people’s apps run side by side, each with its own credentials, so one environment must never reach another, or the platform that runs them all.
In OpenAI’s incident, a shared package cache, and the credentials the agents all shared, became their message board. Here, each environment gets its own cage and its own proxy, the credentials stay outside, and the proxy gets them for each call.
- Leave trackerBuilt by someone in HRIts own proxyProves who it acts for
- Sales dashboardBuilt by someone in salesIts own proxyProves who it acts for
- Survey botBuilt by someone in marketingIts own proxyProves who it acts for
- Credential vendorGives each proxy only its person’s token
- Third-party servicesCalled with the right person’s token
- Untrusted: assume it goes wrong
- Isolation: keeps it in
- Deterministic code you control
- No route between apps
Since July
Agents do less. Every action on the git host is now done by deterministic code: the agent says what it wants, and the code does it.
I’m also experimenting with a watcher: a model that looks at all the agents’ requests together, in near real time, and can lock an agent down. It’s caged like the agents: no hands, no network access, structured input in and a typed verdict out. I use TypeSafe AI’s Jev because it only returns typed decisions, and it’s cheap and fast enough to look at everything: TypeSafe says under half a second a decision, and about 4 US cents per million tokens (roughly 750,000 words) read.
OpenAI says the monitor it now runs on its models’ reasoning would have paged its security team more than a day before the breach. My watcher reads the traffic instead of the reasoning, but it’s the same idea.
- AgentsEvery request they make
- WatcherJev, typed verdicts
- LockdownCuts the agent’s access
- Untrusted: assume it goes wrong
- Deterministic code you control
What’s still open
In July, I ended the talk on three problems nobody had solved. We gate the action, not what’s inside it. Each call can be allowed while the sequence isn’t. And a hijacked agent using its correct credentials looks exactly like a healthy one.
The watcher is my attempt at all three. The proxy decrypts HTTPS, so the watcher sees every request in full, bodies included, and sees them together. It can judge what’s inside a call, the sequence and the intent. But it’s a model reading what an agent gone wrong writes, so it narrows the gap without closing it, and the deterministic layers stay underneath.
One more problem is organisational: make the safe path the only path. If the security expert is on leave, is it still the path?
Sources
- Anthropic, Investigating incidents in cybersecurity evaluations, July 2026
- Hugging Face, Security incident, July 2026, July 2026
- Hugging Face, Anatomy of a frontier lab agent intrusion: a technical timeline, 2026
- OpenAI, Hugging Face model evaluation security incident, July 2026
- METR and Redwood Research, Brief independent investigation of agents’ behavior, reasoning and collaboration in the OpenAI / Hugging Face hacking incident, 26 August 2026
- OpenAI, OpenAI–Hugging Face incident technical report, August 2026
- OpenAI, The Hugging Face incident and the road ahead, August 2026
- The Verge, One company is at the center of a wave of rogue AI attacks, September 2026
- The Verge, OpenAI pauses training of its ‘most capable models’, September 2026
- The Verge, OpenAI agents tried to ‘bruteforce’ a UN website, September 2026
- Anthropic, Claude Mythos Preview system card, April 2026
- Palisade Research, Shutdown resistance in reasoning models, July 2025
- Palisade Research, Demonstrating specification gaming in reasoning models, February 2025
- OpenAI, OpenAI o1 system card, December 2024
- TypeSafe AI, Introducing System One Models & Jev, September 2026