# What Is Your Fallback When a Provider Is Down?

> A step-by-step plan for keeping an AI app useful when its model provider is overloaded or down, and what to tell the customer, explained for your AI interview.

**In short:** Retry briefly, then move to a backup only for tasks you have tested on it. Tell users plainly when their work is saved for later, and send the backup real traffic every day so it works when it is needed.

AI and LLM interview question Q355, LLM system design. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-your-fallback-when-a-provider-is-down

## Say it in 30 seconds

If my main model provider goes down, the app first sorts the error. For a short overload, it tries the call twice, with a wait between tries. If failures keep coming, a circuit breaker stops calls to that provider. Tasks I've tested on a backup go there. Everything else is saved, and the customer gets a clear call-back time. I also send a small share of real traffic to the backup every day, so I know it works before an outage.

## Say it in 2 minutes

Start with the customer, because that is what the fallback protects. When my main provider fails, the customer should never see a blank screen or a raw error code. They should get either an answer, or a clear message that their request is saved and when someone will reply.

The steps come in order. First I sort the error. An overload or a timeout is often temporary, so I retry briefly, with a wait between tries and a hard limit. A spend-cap or billing error is different. Retrying it won't help, so I alert a person. If the main provider keeps failing, a circuit breaker opens and stops the calls for a while. Tasks I have tested on a backup go there, and anything else is saved for a person.

The part people miss is the backup itself. A fallback that nobody uses can hide a bug for months, and it can make an outage worse. So I send a small share of real traffic to the backup every day, check its answers, and keep its data where our rules require. I also plan for a streamed answer that breaks halfway. The Anthropic SDK doesn't retry that for you, so the app shows what it has and offers a retry.

Nothing removes an outage. A good fallback keeps the service useful while it lasts, and it limits what the customer loses.

## What is a fallback, in plain words?

A model provider is the company that runs an AI model and sells you access to it. Sometimes it is busy and returns an overload error. Sometimes it is down, or a spend limit you set has been reached. A fallback is the plan for each of those days.

Think of a bank's call centre on a bad day. When the core system is down, agents don't stop answering. They take details on a paper form, tell the customer when they will be called back, and clear the queue once the system returns. The customer is still served, just more slowly.

Here is a made-up but realistic case. A mid-size insurer runs a claims assistant that reads forms and photos for about 6,000 claims a day. At 14:20 on a Monday, after a storm, the main provider starts returning overload errors. With no plan, every claim fails at the busiest hour. With a plan, most claims still get a first reply, and the rest are saved with a call-back time.

- **Overload error:** A reply saying the model is too busy. Anthropic uses 529, OpenAI uses 503.
- **Spend cap:** A limit on what you can spend in a period. Calls are refused until access resumes.
- **Circuit breaker:** A switch that stops calls to a failing service for a while, instead of hitting it every time.
- **Stream:** The answer arrives in pieces as the model writes it, instead of all at once.
- **Retry-After:** A note from the provider saying how long to wait before trying again.

## What should the app do, rung by rung?

Each rung runs only when the one before it has failed. The order matters, because each step is cheaper and safer than the next.

1. **Sort the error:** Overload, rate limit, spend cap, bad request or timeout. Each one gets a different answer, so the app never treats them all alike.
2. **Retry briefly:** Wait as long as the provider's Retry-After note asks, or wait a little longer after each try. Two tries at most, so one slow call can't hold the customer's chat open.
3. **Open the breaker:** After repeated failures, stop calling the main provider for a while, then try again later.
4. **Use the backup for tested tasks:** Only the tasks I have tested on the backup go there. The rest don't, because an untested answer is a guess.
5. **Save what the backup can't take:** The work waits with a clear call-back time for a person to follow up.
6. **Tell the customer plainly:** Say what happened and what happens next, with no error codes on the screen.

*Diagram, The fallback ladder for one request: A failed call tries the main provider twice, then the breaker opens. Overloads and timeouts retry first. Spend-cap and billing errors skip the retry and go to a person. Tested tasks go to a backup, and the rest are saved for a call back. Both paths end with the customer told what happens next.*
1. The main provider returns an error instead of a reply.
2. The app sorts the error. An overload goes on to a short retry.
3. It retries briefly, then the breaker opens after repeated failures.
4. Tested tasks go to the backup provider.
5. Other tasks are saved and handed to a person.
6. The backup's reply reaches the customer.
7. A saved task reaches the customer with a call-back time.

Billing errors skip the retry path. A spend cap or billing error goes straight to a person, because a retry won't fix it. Overloads are the errors the ladder is built for: Anthropic's errors page says a 529 means the API is temporarily overloaded, and OpenAI's page says a 503 with the server_is_overloaded code means the model lacks capacity right now.

> "Retrying billing, spend, or quota errors won't restore API access." (OpenAI)
>
> "529 - overloaded_error: The API is temporarily overloaded." (Anthropic)

Streams need one more rule. If a streamed answer breaks halfway, the customer has already read part of it. The Anthropic SDK doesn't retry an error inside a stream, and other SDKs may differ, so my code decides. I show the partial text, mark it as incomplete, and offer a retry. I don't restart silently, because the customer would read the first half twice.

## Why is an untested backup the real risk?

A backup nobody uses is a guess. Amazon's engineers wrote that fallback logic is hard to test, and that a fallback which runs rarely can hide a bug until the day an outage needs it. Amazon's own article is cautious. Its team says it now almost always prefers alternatives to fallback, such as letting the caller retry.

> "Distributed fallback strategies often make the outage worse." (Amazon Builders' Library)
>
> "To address the problem of latent failures of the fallback strategy, it's important to exercise it regularly in production." (Amazon Builders' Library)

So I send a small share of real traffic to the backup every day, and compare its answers with the main provider's. The daily check catches a broken key, a changed output format or a data-location rule before an outage does.

> **Tip:** Asked how you would test a fallback? Say you run it on real traffic every day as well as in drills, and that the test checks the answers and whether a reply came back.

## What does a bad afternoon look like?

Take the insurer from the start. At 14:20 the main provider returns overload errors on almost every call. The app tries the first claim twice, with a short wait. Those two failed calls in a row open the breaker, so the next claims skip the main provider.

Then the rules decide. Simple intake goes to the tested backup. Anything the backup hasn't been tested on is saved, and the customer reads this:

"Our assistant is busy right now. Your claim is saved, and a person will call you within one working day."

The message is short, and it tells the customer what happens next. Nothing is lost, and nobody is left guessing.

Here is the ladder in plain Python. The main provider is scripted to fail twice, so the code shows the retries, the breaker and the saved claim.

```python
# Made-up claims intake at an insurer. The main provider is overloaded at first.
replies = iter([529, 529])  # scripted replies, in order, no network
TESTED_ON_BACKUP = {"simple intake"}  # tasks the backup has passed tests for
breaker_open = False
failures = 0  # failed calls in a row

def take_claim(claim, kind):
    global breaker_open, failures
    if not breaker_open:
        for attempt in (1, 2):  # short retry: two tries at most
            status = next(replies)
            print(f"{claim}, try {attempt}: {status}")
            if status == 200:
                failures = 0
                return f"{claim}: answered by the main provider"
            failures += 1
        if failures >= 2:
            breaker_open = True  # no test calls in this demo; a real breaker lets a few through after a timeout
    if kind in TESTED_ON_BACKUP:
        return f"{claim}: sent to the tested backup"
    return f"{claim}: saved, a person calls back within 1 working day"

print(take_claim("claim 1", "simple intake"))
print(take_claim("claim 2", "simple intake"))
print(take_claim("claim 3", "damage estimate"))
print(f"breaker open: {breaker_open}")
```

Output:

```text
claim 1, try 1: 529
claim 1, try 2: 529
claim 1: sent to the tested backup
claim 2: sent to the tested backup
claim 3: saved, a person calls back within 1 working day
breaker open: True
```

The output shows what an interviewer wants to see: short retries, a breaker that stops the waste, and no claim lost.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Stepped, with a plan at each step: sort the error, retry briefly, open a breaker, then back up or save.
- [ ] Spend-cap and billing errors don't clear with retries, so they go to a person.
- [ ] The backup is tested on real traffic every day, with its answers checked.
- [ ] The customer always hears what happens next, with no raw error codes.
- [ ] A stream that breaks halfway is handled in code, not silently restarted.
- [ ] Honest about the limit: a fallback keeps the service useful, it does not stop outages.

**Common traps**

- Trap: "Just keep retrying until the provider comes back." Better: Retry briefly, with a limit. Then move on, so the waiting doesn't become the outage.
- Trap: "We have a backup provider, so we're covered." Better: Only if it is tested on real traffic. An untested backup can fail in the outage it was built for.
- Trap: "Failover is automatic, so nothing else needs checking." Better: Check answers, error codes, data location and caches. An automatic switch still needs tests.

## Can you spot the risky rule?

**Spot the risky rule:** This is a team's fallback runbook. Which rule is the risky one?

A. Retry twice with a 2-second wait, then open the breaker.
B. Retry every second, with no limit, until the provider answers.
C. Send 5% of real traffic to the backup each day and compare the replies.
D. Tell the customer a call-back time when work is saved.

**Answer:** B. Retrying forever keeps calls going to a provider that is already overloaded, and it blocks the other rungs. Limit the tries, then move on.

**Quick check:** At 14:00 the main provider returns an error saying the monthly spend limit is reached. What is the right first move?

A. Retry every 30 seconds until it works
B. Send all traffic, untested tasks included, to a second provider
C. Alert a person, and save the work the limit will refuse
D. Turn off the circuit breaker

**Answer:** C. A spend cap does not clear with a retry, so retrying fixes nothing. Sending everything to a second provider skips the budget decision and moves untested work onto a backup. Alerting a person is the right first move, and saving the work keeps the customer served until access resumes.

## Can you answer these from memory?

**Flash cards**

- **What is a fallback?** A second plan the app uses when the main model provider fails or is overloaded.
- **Which errors are worth a short retry?** Transient faults like overloads and timeouts. Spend caps and billing errors are not.
- **What is a circuit breaker?** A switch that stops calls to a failing provider for a while, then lets a few test calls through.
- **Why test the backup every day?** An untested fallback can fail in the outage it was built for, and can make it worse.
- **What about a stream that breaks halfway?** Anthropic's SDK won't retry it. Show the partial text, mark it incomplete and offer a retry.
- **What does the customer see?** An answer, or a plain message saying the request is saved and when to expect a reply.

## Likely follow-up questions

- Q343 Multi-provider fallback? https://designervenkat.online/interview/ai/multi-provider-fallback
- Q330 How do you handle rate limits and 429 errors? https://designervenkat.online/interview/ai/how-do-you-handle-rate-limits-and-429-errors
- Q337 Timeouts, retries and backoff? https://designervenkat.online/interview/ai/timeouts-retries-and-backoff
- Q356 Design rate limiting. https://designervenkat.online/interview/ai/design-rate-limiting
- Q353 Design an LLM gateway. https://designervenkat.online/interview/ai/design-an-llm-gateway
- Q365 Idempotency, queues and retries? https://designervenkat.online/interview/ai/idempotency-queues-and-retries
