← Dashboard

When Things Break

Chapter 7: Errors, Recovery, Learning

Think
Act
Observe
Decide
Step 1

Agents Fail Constantly

Tools return errors. APIs time out. Files don't exist. Code doesn't compile. In a long agentic session, something breaks on almost every loop iteration. Error handling isn't an edge case. It's the main case.

Step 2

Naive Retry = Token Bonfire

The simplest error handler: try again. And again. And again. Each retry burns tokens. The model re-reads the entire context, generates the same failing call, and gets the same error. Five retries at $0.03 each adds up fast.

Step 3

Keep the Error, Change the Tool

Manus's counterintuitive insight: inject the full error message into context and let the model try a different approach. The error is information. Hiding it causes blind retries. Showing it enables adaptation.

Bad: retry same tool 5x. Good: show error, switch strategy.

Step 4

The Recovery Decision Tree

Click any node to trace the recovery path. Every error forks into a decision: retry with same tool, switch to a different tool, degrade gracefully, or escalate to the human. The tree encodes your error policy.

Step 5

Circuit Breakers

When a tool fails 3 times in a row, trip the breaker. Stop sending requests to it. After a cooldown, try once more (half-open). If it works, reset. If not, keep it open. Borrowed from microservices, essential for agents.

Step 6

Degrade Gracefully

When tools fail, the agent should step down through capability levels. Full power → reduced tools → minimal output → fallback message. A partial answer is infinitely better than a cryptic error. The user always gets something useful.