Routing, Fallbacks, and Graceful Degradation › Deterministic Fallbacks and Provider Failover

Michael BrenndoerferDecember 2, 20262 min read
Language AI HandbookAll chapters
Part 64 of 67Compound AI System Design
Chapter 486Routing, Fallbacks, and Graceful Degradation › Deterministic Fallbacks and Provider Failover
Reading section 5 of 10 · Deterministic Fallbacks and Provider Failover · 2 minSection 5 of 10 · 2 min

Section 5 of 10 · 2 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

A retry attempts the same operation again. A fallback takes a different path. With a fixed attempt budget, retry only when the failure might be transient and another attempt fits the budget. Google SRE's guidance on cascading failures recommends limiting retries, spreading them with randomized exponential backoff, and checking the remaining deadline before starting another stage. A timeout is an observation about waiting. For operations with side effects, require a verified idempotency guarantee before attempting them again.

In the acceptance benchmark we already have a candidate for every tier. In an actual request, the application can encounter an unavailable dependency before there is any candidate to score. The router still needs to distinguish a known unavailable route, which it can skip, from a call that consumed budget before failing. Record the reason in the trace so causes such as an eligibility restriction, an outage, and a low-confidence answer do not get merged in evaluation.

A deterministic fallback can be a stored message or an extract from an approved source. A fallback to another model retains all of the ordinary requirements, including which data that model may receive. The next code example also demonstrates a budget for attempts even though the in-memory fixture makes every branch fast. A remote implementation would combine its attempt count with a deadline and apply a separate policy for retries.

The next fixtures use a finite attempt limit and no actual delays. Each tier has a scripted policy-eligibility flag, an availability flag, and an optional candidate. An eligible, available tier whose candidate is absent consumes one attempt. An ineligible or unavailable tier consumes none. We return at most one accepted candidate and record its tier.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy