Lesson 36 — the agent failure mode heatmap. Agents fail in predictable shapes. Knowing the shapes lets you instrument for them before the failure ships. ## The failure that did not look like a failure An agent finishes its task. The trace looks clean. The output looks right. A week later, you discover the agent has been confidently citing facts that do not exist, calling tools with parameters that were syntactically valid but semantically wrong, and ignoring a constraint it had been told to honour. The trace was clean because nothing crashed; the failure was upstream of the crash. Agent failures cluster into a small number of repeating patterns. Instrumenting for them is cheaper than discovering them in production. > **The rule:** Treat agent failure as a typology, not an accident. Each failure mode has a signature in the trace. Detect the signature, route to mitigation, escalate when escalation is the right move. ## The recurring modes - **Tool hallucination** — the agent calls a tool with invented parameters that look plausible. - **Confident wrong answer** — the agent ignores its uncertainty and ships a wrong result. - **Loop without progress** — the agent retries the same approach with slight variations. - **Wandering off-task** — the agent starts solving a related but different problem. - **Constraint forgetting** — the agent ignores a constraint it agreed to earlier in the trace. - **Premature termination** — the agent decides the task is done before it actually is. - **Prompt-injection compromise** — a tool result contains adversarial content that hijacks the agent’s plan. ## Try it yourself The failure heatmap below shows the empirical frequency of each failure mode across task types from past engagements. Hover over a cell for representative traces. Note where the dark cells cluster: which task types are dominated by which failure modes. agent_failure_heatmap.json missing ## What you just saw Tool-call-heavy tasks fail mostly via tool hallucination and loop-without-progress. Open-ended research tasks fail mostly via wandering off-task. Multi-step planning tasks fail mostly via constraint forgetting. Tasks where the agent consumes external content are the prompt-injection cases. The mitigations are mode-specific. Tool hallucination is mitigated by schema validation. Constraint forgetting is mitigated by re-anchoring the constraints at each step. Prompt injection is mitigated by treating tool output as untrusted (see Lesson 17 on the broader pattern). ## Three architect-grade arguments - **Instrument for the modes, not for the symptoms.** Detect “loop without progress” by counting near-duplicate steps. Detect “constraint forgetting” by re-validating constraints periodically. - **Map task types to the modes they hit.** The heatmap is your routing prior. New task type, run a small eval first, see which cell lights up. - **The safety case is the heatmap.** A regulator asking “have you assessed failure modes” wants the heatmap, not the prose. Build it; ship it. Next lesson: the Layer 10 evaluation gate — agent safety audit as a deliverable artifact.