When Agents Fail

Guardrails

Part of: AI Agents & Tool Use

An agent given a credit card and told to "buy the cheapest flight" once kept refreshing prices in an endless loop, never booking, burning API calls until someone killed it. Agents fail in ways plain chatbots cannot, because agents act . A wrong sentence is harmless; a wrong action spends money, sends emails, or deletes data. So the most important skill in agent building is designing the guardrails that catch failure before it does damage. What it is A guardrail is a constraint you put around an agent to limit what it can do and stop it when it goes wrong. Guardrails are not part of the model, they are code and rules you wrap around the agent loop. They exist because agents have signature failure modes: - Infinite loops. The agent repeats the same action forever, never deciding it is done. - Cost explosions. Each loop step is a model call, so a runaway agent can rack up a huge bill fast. - Harmful actions. A misread goal leads to a destructive tool call, deleting the wrong files, emailing the wrong people. - Cascading errors. One bad observation poisons the next thought, which poisons the next action, drifting further from the goal. How it works You install guardrails at four points

Challenge: The Guardrailed Agent Loop