DEV Community

Aamer Mihaysi
Aamer Mihaysi

Posted on

Your agent deleted prod because you never let it fail in staging

The agent that deleted your database isn't the problem. The problem is that you never saw it try to delete a test database first. You gave it production access on day one, and it did exactly what you'd expect from something that's never been told "no" in a safe environment.

I've been building agentic systems long enough to know that the first run of any agent is a surprise. Not because the model is malicious, but because it's stochastic. The same prompt, the same tools, the same input — it can take a different path every time. You can't predict what it'll do. So why do we treat it like a deterministic service that we can just point at prod and trust?

The answer is that we're lazy. We want the agent to work, and we want it to work now. So we skip the part where we let it make mistakes in a sandbox. We skip the part where we watch it flail against a fake database, a fake API, a fake everything. We skip the part where we learn its failure modes, its weird edge cases, its tendency to interpret "clean up" as "drop all tables." And then we're surprised when it does exactly that in production.

Here's the thing: you wouldn't let a pilot fly a 747 without hundreds of hours in a simulator. You wouldn't let a surgeon operate on a live patient without practicing on cadavers first. But we'll let an agent touch our production database with a prompt and a prayer. That's not engineering. That's gambling.

The fix is boring, and that's why nobody does it. Build a staging environment that mirrors production as closely as possible. Same schema, same data volume, same tools, same permissions. Then let the agent loose in that environment. Watch what it does. Log every tool call, every argument, every decision. Run it a hundred times with slightly different inputs. Find the patterns that lead to disaster. Fix them. Then, and only then, consider a limited rollout.

I've started doing this with my own agents. I have a sandbox that's a full copy of my production environment, but with a few key differences: the database is disposable, the API endpoints are mocked, and the consequences are zero. I let the agent run wild in there. I break things on purpose. I see how it handles a missing table, a malformed response, a tool that returns an error. And I've caught more than a few "interesting" behaviors that would have been catastrophic in prod.

The agent that deleted your database didn't do it because it was evil. It did it because you never gave it a chance to fail safely. You never let it learn the boundaries. You just threw it into the deep end and hoped it could swim.

Maybe I'm wrong here. Maybe there's a team out there that runs agents in production without any staging and it works out. I haven't met them. What I've met is a lot of people who thought they could skip the testing phase because the model is "smart." And a few of them are now explaining to their manager why the database is gone.

The agent didn't delete the database. You did — the moment you decided that a probabilistic text generator didn't need a rehearsal. The sandbox isn't a luxury. It's the difference between a pilot and a crash.

Top comments (0)