AGENTSJune 3, 2026 · 1 min read
Building agents that recover from failure
Agents fail constantly — bad tool calls, hallucinated arguments, flaky APIs. The difference between a demo and a product is what happens next.
Validation gates
Before an agent's output reaches the user (or the next step), validate it against a schema or a set of hard constraints. Cheap checks catch most failures before they compound.
Retry with context, not blind repetition
A naive retry just re-runs the same prompt and gets the same mistake. A useful retry feeds the failure back in: what was tried, what broke, and what constraint was violated.
attempt 1: tool_call(args) -> error: missing required field "id" attempt 2 prompt: "Previous call failed: missing 'id'. Retry with a valid id."
Knowing when to stop
An agent that retries forever is worse than one that fails fast. Cap retries, and when the cap is hit, surface a clear, specific error instead of a vague failure — that's what actually saves debugging time later.