Last week a post on DEV asked a question I can't stop thinking about: we keep handing AI agents more tools — what happens when the boundaries fail?
Most of us find out in production. An agent with file access wanders outside its working directory. A tool argument balloons past what the API accepts. A model hallucinates a parameter name and the error gets swallowed by a retry loop. These failures are boring, predictable, and almost never tested — because spinning up a separate environment to deliberately break things feels expensive.
It isn't. This article walks through a small failure-injection sandbox you can run on free infrastructure: a mock agent loop, a tool with an enforced boundary, and a set of adversarial inputs designed to cross it. The goal isn't to build a secure agent (you won't, in one article). The goal is to make boundary failures visible and repeatable before your users do.
What we're actually testing
When people say "agent boundary failure," they usually mean one of four things:






