cd /news/ai-agents/how-do-you-contain-an-ai-agent-failu… · home topics ai-agents article
[ARTICLE · art-73926] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

How Do You Contain an AI Agent Failure You Can't Prevent?

A developer argues that containing AI agent failures is a design choice about authority, not prevention. The developer advises giving agents the least authority the job allows, using human-in-the-loop only for irreversible actions, and preferring undoable actions with thorough logging. The key is to build agents whose failures cannot cause harm, not ones that never fail.

read2 min views1 publishedJul 26, 2026

Every part of this series has quietly agreed on one thing: the agent will be wrong sometimes. Part 1 set the bar at "acceptably wrong." Part 3 measured how often. So the last question is not how to stop it from ever failing. It is the one that actually decides whether you can ship: when it is wrong, what is the worst that can happen?

That worst case is not fixed. It is a design choice, and it is the one most teams never make on purpose.

Two agents give the same wrong answer. One drafted an email for a human to send. The other sent it. One suggested a refund. The other issued it. Identical mistake, completely different consequence, because someone decided how much power the agent had when it was wrong. You set the blast radius by choosing what the agent is allowed to do, not by hoping it does the right thing.

Give an agent the least authority the job allows. Let it read before it writes, propose before it executes. An action more dangerous than the agent's measured reliability has earned is a liability you chose. If Part 3 told you a step is right eighty percent of the time, that step does not get to move money unsupervised. Capability should track trust, and trust is a number you now have.

Human-in-the-loop is not "approve everything," which kills the speed that made an agent worth building. It is a gate on the small set of actions where a wrong one is irreversible or costly: the disqualifying failures you named in Part 1 (the known abuse modes are catalogued in the OWASP LLM Top 10). Everything reversible and cheap runs on its own. Everything that cannot be taken back waits for a person.

Prefer actions you can undo, and log enough to undo them. A dry-run mode, a soft delete, a confirmation step: these turn an incident back into a mistake. And you cannot contain what you cannot see, so trace every action. A traced failure gets caught in minutes and becomes a new case in your eval set (Part 2). The loop closes: containment feeds the very thing that measures reliability.

That is the whole series. Define the bar, build the eval set that measures it, treat reliability as a distribution, budget the cost, and contain the failures you cannot prevent. None of it makes an agent perfect. All of it makes an agent you can actually ship.

You cannot build an agent that never fails. You can build one whose failures cannot hurt you.

── more in #ai-agents 4 stories · sorted by recency
── more on @owasp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-do-you-contain-a…] indexed:0 read:2min 2026-07-26 ·