Lesson 13.06 · Phase 13 · Production Agents

Model routing & fallbacks

Retrying a provider that's down only waits for the outage more slowly. Fail over to a different one, stop calling the broken one for a while, and send easy work to a cheaper model.

Learning objectives

  • Retry the right errors (429, 5xx, timeouts) with backoff that honours Retry-After, and never retry 400/401/403.
  • Fail over along a chain of providers, and use a circuit breaker so a broken provider is skipped instead of retried.
  • Route easy tasks to a cheaper model, and use a cascade (validate, then escalate) to win back the accuracy routing loses.
  • Compare five strategies on one seeded workload with a provider outage: success, correct answers, latency and cost.

Your agent calls one model at one provider. Provider A has a three-minute outage. Every request in those three minutes fails, and the ones you retry fail more slowly. Before and after the outage it's fine, except that 60% of your requests are simple lookups, and you're paying the large-model price for every one of them.

Loading the full lesson…