esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

What Is Multi-Provider Fallback?

How to keep an AI app working when one model provider is overloaded, what breaks when you switch, and how to build it safely, explained simply for your AI interview.

In short

Multi-provider fallback means keeping a second model provider ready and sending requests there when the main one fails or is overloaded. Retry the main one with waits first, and move to a backup only after it has passed your own tests and keeps data where your rules need it.

13 min readIntermediateCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Multi-provider fallback means I keep a second model provider ready. First I retry the main one with short waits, because many errors clear fast. If it's still overloaded, a circuit breaker stops calling it for a while and the backup answers. A backup can differ from the main model in ways that matter. Answers, error codes, data location and cache hits can all differ, so it has to pass the same tests before it takes live traffic.

What is multi-provider fallback, in plain words?

Many apps call one AI model company, which is called a provider. Multi-provider fallback means you also set up a second provider, and send the work there when the first one fails, is overloaded or is too slow.

Think of a bank's card terminal. If one card network is down, the till does not close. It tries another route, and the customer still pays. The app does the same thing with a second model.

Here is a realistic case with made-up numbers. A mid-size bank runs a support assistant for about 40,000 chats a day. At 10:05 on the last working day of the month, the main model starts returning overload errors. With no backup, every chat fails at the peak. With a tested backup, most chats still get an answer, and the bank checks the replies that came from the backup.

Key words

Provider
The company or cloud that runs a model and sells access to it.
Fallback
The second option the app uses when the first one fails.
Overload error
A reply saying the model is too busy. Anthropic uses 529, OpenAI uses 503.
Circuit breaker
A switch that stops calls to a failing service for a while, instead of hitting it every time.
Data residency
A rule that customer data must stay in a set country or region.

Why not just retry the same provider?

Retrying is the first move, because many errors clear within seconds. But an overload is shared across many customers of the same provider, so a retry against that provider can hit the same wall. Anthropic's own docs describe its 529 error as a sign of high traffic, and AWS says availability targets need bounded retries and a fallback in your application.

  • “To meet an availability target, add bounded retries and multi-Region or multi-model fallback in your application”

    AWS

  • “A 529 error can occur when the API experiences high traffic across all users”

    Anthropic

So the rule of thumb is: retry a few times with waits, then move on. Retries don't fix a billing limit. Anthropic says a spend-cap 429 has no retry-after header and keeps failing until access resumes, so the right step there is to alert a person.

Tip

Asked what triggers a fallback? Name overload errors (529 or 503), timeouts, and a 429 that outlasts a short retry. A bad request (400) normally should not fail over, because a backup gets the same bad input. If the 400 says a feature is unsupported, a backup that has the feature may succeed.

How does one chat move through a fallback?

One chat through a fallback

Customer question

One chat message from a customer

Main provider

Retry with waits

Honours Retry-After, max 2 tries

Breaker opens

After 4 failures in a row

Main provider answers

Usually the end of the chat.

Backup provider

Same data zone, same tests

Answer sent

Logged with the provider used

  1. 1The question goes to the main provider first.
  2. 2A healthy main provider sends the reply back.
  3. 3Two failed tries in a row: the breaker counts it.
  4. 4Breaker open: the main provider is skipped for now.
  5. 5The main provider's reply goes out and is logged.
  6. 6The backup's reply goes out and is logged too.
A chat tries the main provider twice, with a wait between tries. If both tries fail, that chat goes to the backup, and after four failed main calls in a row the breaker skips the main provider for later chats. Every reply is logged with the provider that sent it.

A breaker stops the app paying for the same failure again and again. Azure's circuit breaker pattern says a breaker blocks access to a failing service after failures reach a threshold, instead of repeatedly retrying an operation that is likely to fail. Once failures pass the threshold within a set time window, calls stop and a timer starts.

When the timer ends, the breaker lets a limited number of trial calls through. Those calls check whether the service has recovered. If they succeed, the breaker closes and traffic goes back to the main provider. The Half-Open state also helps stop a recovering service from being flooded with requests.

What breaks when you switch providers?

  • Answers

    Same input, different output

    Models can give different output for the same input, so a backup needs its own tests before it takes live chats.

  • Errors

    Each provider names its errors

    Anthropic sends 529 with overloaded_error. OpenAI sends 503 with server_is_overloaded. Map both to one rule in your code.

  • Data

    Location and contracts

    A backup in another region can break residency rules. A new provider also needs its own contract and security review.

A compatibility layer (a translator that lets code written for OpenAI's SDK, the official code library, call Claude) still needs its own testing before you rely on it. Anthropic's OpenAI SDK compatibility page says the strict parameter for function calling is ignored, so tool output is not guaranteed to match your schema. The same page says the layer is not considered production-ready for most use cases.

The same model can also arrive through a cloud. Anthropic's Bedrock page says calling Claude through Bedrock slightly differs from calling the Claude API directly, and that lifecycle dates on partner platforms can differ from the Claude API schedule.

Caches don't carry over. OpenAI says a later request with the same prefix can reuse saved state, and it looks for a matching prefix already cached on the machine. So a cache hit needs the same prefix, and a new provider starts with an empty cache. The first calls after a switch do the full work again.

Tip

Agents that change things outside the app need extra care. If the main provider already sent the email or moved the money before it failed, a retry on the backup would do it twice. Put the action behind a check, or make it safe to repeat.

How do you build a fallback safely?

  1. 1

    Set one time budget per chat

    Give each chat an overall deadline, for example 15 seconds. Every try uses part of it, and the chat stops when the deadline ends.

  2. 2

    Retry first, with waits

    Retry the same provider a couple of times, honour its Retry-After wait (the wait time the provider sends back), and cap the number of tries.

  3. 3

    Let a breaker decide

    After repeated overloads, stop calling the main provider for a while, then let a few trial calls through.

  4. 4

    Keep the backup inside the rules

    Check data location and contracts first. Pick a route that keeps data where your rules say, such as a geographic route when residency applies.

  5. 5

    Test the backup like the main one

    Run the same evals (a fixed set of test questions with known good answers) on the backup, and log which provider answered each chat.

  6. 6

    Have a last step

    If every provider fails, queue the chat or hand it to a person, and tell the customer what happens next.

Here is a worked example with made-up numbers. The bank gives each chat 15 seconds. The main model gets two tries, each with a 4-second timeout and a 1-second wait between them, which uses 9 seconds. The backup gets the 6 seconds left. If it fails too, the chat is queued with a message saying a person will reply. The app never waits past its budget, even though it tried two providers.

A connection that drops while an answer is arriving word by word (a stream) is a separate case. Anthropic's errors page says the SDK doesn't retry an error in a stream, so the app must decide whether to show the partial reply or start again on the backup.

Here it is in plain Python, with no real model. The main provider is down for its first four calls, and a breaker stops calling it after four failures in a row.

Python
# Made-up support assistant: the main model is overloaded for its first 4 calls.
FAILOVER = {429, 503, 529}  # overload or rate limit: retry, then move on. A spend-cap 429 also lands here, so a real app reads the error code and alerts a person instead.
calls = {"main": 0, "backup": 0}
state = {"main_failures": 0}  # breaker: failed main calls in a row. Shortcut: never resets here. A real breaker waits, then lets a few trial calls through.

def call(provider):
    calls[provider] += 1  # made-up reply, no network
    return 529 if provider == "main" and calls["main"] <= 4 else 200

def answer(chat):
    # Breaker open after 4 failures in a row: skip the main provider.
    order = ["backup"] if state["main_failures"] >= 4 else ["main", "backup"]
    for provider in order:
        for attempt in range(2):  # short retry on the same provider
            status = call(provider)
            print(f"{chat}: {provider} try {attempt + 1} -> {status}")
            if provider == "main":
                state["main_failures"] = 0 if status == 200 else state["main_failures"] + 1
            if status == 200:
                return f"{chat}: answered by {provider}"
            if status not in FAILOVER:
                return f"{chat}: stopped, a backup won't help"
    return f"{chat}: all providers failed, queued for a person"

print(answer("chat 1"))
print(answer("chat 2"))
print(answer("chat 3"))
print(f"main calls made: {calls['main']}")

Output

chat 1: main try 1 -> 529
chat 1: main try 2 -> 529
chat 1: backup try 1 -> 200
chat 1: answered by backup
chat 2: main try 1 -> 529
chat 2: main try 2 -> 529
chat 2: backup try 1 -> 200
chat 2: answered by backup
chat 3: backup try 1 -> 200
chat 3: answered by backup
main calls made: 4

The code stops calling a broken provider, and it never sends a bad request to a backup. The state of the breaker is kept in one place, so a real version would move it into shared storage.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a second provider takes over when the first fails or is overloaded.
  • What triggers it: overload errors, timeouts and a 429 that outlasts a short retry, not a bad request.
  • The order: retry with waits, then a breaker, then a tested backup, then a queue or a person.
  • What breaks on a switch: answers, error codes, data location, cache hits and side effects.
  • A time budget per chat, so the wait stays bounded.
  • An honest limit: a backup nobody has tested gives no protection.

Common traps

  • Trap"Switch to the backup at the first error."

    BetterRetry first with waits. A first error is often a blip, and a fast switch can push the whole load onto a backup that may not have room for it.

  • Trap"A backup is just the same prompt sent elsewhere."

    BetterSame prompt, different model: answers, error codes and tool output can differ, so the backup needs its own tests.

  • Trap"A fallback gets around a spend cap."

    BetterA spend cap is a billing limit. Retrying won't restore access, so alert a person. Switching providers to dodge a limit fixes nothing.

Can you spot the risk?

Spot the risk

Which backup setup is risky?

Quick check

The main model returns 400 because one request field is invalid. What should the app do?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q330How do you handle rate limits and 429 errors?12 min
  2. Q337Timeouts, retries and backoff?14 min
  3. Q334How do you cut cost on a cloud-hosted LLM workload?13 min
  4. Q344What is a p95/p99 latency budget?11 min
  5. Q347Design a customer-support chatbot.13 min

Last updated on 27 November 2026

Building an AI feature that has to stay up?

I design and build AI products and agents, including the system behind them: fallbacks, limits and checks. Book a short call and tell me what your app must keep doing when a provider goes down.