Error Handling & Recovery
Module 7 · Master Course
45 min · Error compounding math · The taxonomy · Stuck loops · Graceful degradation
The compounding math
10-step process at 99% per-step = ~90% success. 50 steps = ~60%. 100 steps = ~37%. Error handling is not a feature — it's the difference between a demo and a shipped product.
The four-category taxonomy
| Type | Response |
|---|
| Transient | retry w/ backoff+jitter; cap 2 (Stripe) |
| LLM-recoverable | return as tool result; model self-corrects |
| User-fixable | interrupt to human (Module 6) |
| Fatal | halt immediately; do not retry |
Misclassify → wrong response. Retrying a fatal = infinite loop. Swallowing a recoverable = hallucinated success.
Four anti-patterns
Retry everything. Fatal retried forever burns budget.
Swallow everything. Silent failure; model hallucinates success.
Surface everything. Alert fatigue (Module 6.2).
No taxonomy. All errors identical → usually 'retry everything.'
Stuck-loop detection
Same tool + same input + same error, N consecutive times. Detected via input_hash + output_hash (Module 1.4).
same input_hash AND same output_hash
across N consecutive turns (typically 3)
= STUCK (no progress)
The circuit breaker
When stuck-detection fires: disable the failing tool for the session. Model cannot call it again; must route around or report cannot-proceed.
Tool-level realization of the error-threshold stop condition (Module 1.2). Prevents one misbehaving tool from trapping the agent.
Graceful degradation
Partial completion: do as much as possible; report what was skipped. "Completed 12 of 15; steps 13-15 skipped: test failure at step 12."
Budget exhaustion: save state (checkpoint), exit cleanly, write handoff. Budget exhaustion is a planned stop, not a failure.
Human-readable failure: task, what's done, what failed, why, next step. Specific, not vague.
Takeaways
- Four categories: transient (retry), LLM-recoverable (self-correct), user-fixable (interrupt), fatal (halt).
- Error compounding: 99% over 50 steps = 60%. The taxonomy is the cure.
- Stuck loop: same input+output hash x N. Circuit breaker disables the tool.
- Graceful degradation: partial completion + clear report + budget-exhaustion handling.
Next: Module 8 — State, Checkpointing & Multi-Session Design.