Hirestack
Hirestack
Chapter 15

AI Agents · Reliability — failure modes and guardrails

📖 2 min read · 5 sections · May 2026

Why this matters

Demo agents work because the path was rehearsed. Production agents fail in eight reliably-bad ways. Knowing them is the difference between a system that 99% works and one that 80% works.

The eight failure modes

FailureSymptomDefence
Infinite loopAgent calls same tool repeatedly with same argsIteration cap + duplicate-call detector
Tool hallucinationAgent invents a tool name that doesn't existServer-side validation; return structured error; LLM recovers
Wrong toolPicks similar-sounding tool that doesn't fitBetter tool names + descriptions (chapter 6)
Argument hallucinationCalls tool with made-up IDs/valuesStrict schema validation; require explicit "search first" for unknown IDs
Premature stoppingReturns answer before doing required workSystem prompt: "Before answering, verify..." + critic agent
Context driftForgets early instructions after 10+ turnsRe-inject system prompt periodically; bound iterations
Silent failureTool returns error; agent confabulates over itAlways observe tool output; assert success in system prompt
Cost runawayAgent works fine but burns $50 per taskPer-request token + tool-call budget; circuit breaker

Defence in depth — the layers

flowchart TB
    U[User request] --> I[Input validation
length, content moderation] I --> P[Prompt scaffolding
system rules + few-shot] P --> L[LLM call] L --> S[Schema validation
did we get expected shape?] S --> T{Tool call?} T -->|yes| TC[Tool exec
with try-catch + retry] TC --> L T -->|no| O[Output filter
PII redaction, content moderation] O --> User

Self-correction patterns that work

War story: agentic customer-support bot was confidently wrong 12% of the time, citing real-looking but fake order numbers. Added a verifier pass: "before responding, the order ID you cited must come from the tool output above". Wrong-order rate dropped to 0.4%. Cost: one extra LLM call per response (~$0.001). Worth it.

Production reliability checklist

  1. Iteration cap set + tested (find the cap by running 50 hard inputs)
  2. Every tool wrapped in try/except returning structured error
  3. Token budget per request; circuit breaker on N consecutive expensive runs
  4. Telemetry on every step: which tool, which args, latency, cost
  5. Golden eval set runs on every deploy + nightly
  6. Online sampling: 1% of production traffic gets LLM-judge eval
  7. Hallucination metric tracked over time; alert on drift
  8. "I don't know" path: agent can refuse confidently when underspecified