Lesson 03.06 · Phase 03 · The Agent Loop

Retries, backoff & recovery

Retry what might work next time. Never blindly retry what already changed the world. Tell the model about everything else.

Learning objectives

  • Classify failures as transient (retry) or permanent (don't), for both model calls and tool calls.
  • Implement a model fallback chain: retry transient errors with jittered backoff, then move to the next model on permanent ones.
  • Explain why side-effecting tools must not be retried blindly, and make retries safe with idempotency keys.
  • Implement a circuit breaker that stops hammering a dead tool and tells the model to work around it.

Phase 0 · Lesson 4 retried HTTP calls to a model provider. An agent has more things that fail, and they don't all deserve the same treatment:

Loading the full lesson…