Skip to content
CodeStoa
Stage 1 · Foundations · Calling Models From CodeLesson 6 of 6Beginner

When a Cloud Provider Goes Down: Keep Your AI App Running

Every cloud goes down sometimes, even Microsoft's. See why an app that calls one AI model in one cloud fails with it, and the moves that keep it taking orders.

10 min readPublished
0:00 / 4:06

What you'll learn

  • Why an app that calls one AI model in one cloud goes down when that cloud does, and how to spot that weak part.
  • Why waiting longer and trying again forever makes an outage worse, and what a safe retry looks like.
  • How a timeout, a backup model and a plain fallback keep an app answering.
  • When a backup is worth its cost, and when a clear sorry message is enough.

What to know first: what a large language model is ([What is an LLM?](/ai-engineering/what-is-an-llm/)) and that your app reaches one over the internet with an API call, a request your code sends to the model's company, which sends an answer back. That's all you need.

The problem: your app depends on someone else's computers

You open Teams for a call, and it won't load. On the twelfth of November 2026, Microsoft's email, Teams and Copilot went down worldwide, for many hours. Microsoft said there was no sign of an attack, and it rolled back a recent network change whose timing matched the start; the full cause was promised in a post-incident report. For most people it was a lost morning. For anyone whose own app ran on those computers, it was a lost day of business.

Now meet Aaryan, who runs a small cake shop. Customers order on a chat in the shop's app. An AI model reads each message and fills in the order: which cake, which day, and the words for the icing. The model lives in one company's cloud: computers you rent over the internet instead of owning. Say that cloud goes down at six on a Friday evening, the busiest hour, and stays down until eight.

  • 5 to 6 pm

    Cloud
    Up
    Orders that went through
    38
  • 6 to 7 pm

    Cloud
    Down
    Orders that went through
    0
  • 7 to 8 pm

    Cloud
    Down
    Orders that went through
    0
  • 8 to 9 pm

    Cloud
    Up again
    Orders that went through
    12
An illustrative evening. Every customer from six to eight sees "Sorry, something went wrong". By eight, most have ordered somewhere else.

Nothing in Aaryan's code broke. The app did exactly what it was told: send every order to one model, in one cloud. The question this lesson answers is how to make the app keep taking orders when that cloud stops answering.

The big picture: four layers of defence

Think of a dual-SIM phone. When one network has no signal, the phone switches to the other SIM, and you keep making calls. An app can do the same thing with its AI model. Here is the whole plan, from the order arriving to the order being saved.

  • Customer's order (chat message) to Wait 10 s, no more (timeout)
  • Wait 10 s, no more (timeout) to Main AI model (primary provider)
  • Wait 10 s, no more (timeout) to Backup, other cloud (fallback model)
  • Backup, other cloud (fallback model) to Plain order form (graceful degradation)
  • Main AI model (primary provider) to Plain order form (graceful degradation)
Try the main model with a short wait. If it fails, try the backup in a different cloud. If both fail, the app still takes the order without AI.

Each layer catches what the one before it missed. The rest of this lesson takes them one at a time, each on the same Friday evening.

Stage 1: find the single point of failure

A single point of failure is a part your system can't work without, and has no spare for. If it stops, everything stops. The first job is to list every part one order passes through and ask, for each one: if this goes down, who is hurt?

  • One customer's phone

    If it goes down
    That customer can't order
    Who is hurt
    One person
    Spare?
    Not needed
  • Aaryan's app server

    If it goes down
    No orders at all
    Who is hurt
    Everyone
    Spare?
    Two servers, two regions
  • The AI model's cloud

    If it goes down
    No order gets filled in
    Who is hurt
    Everyone
    Spare?
    None yet
  • The payment service

    If it goes down
    Orders, but no payment
    Who is hurt
    Everyone paying online
    Spare?
    Pay on collection

The column "Who is hurt" has a name engineers use: the blast radius, how much of the system one failure takes down. A broken phone has a blast radius of one person. The AI model's cloud has a blast radius of every customer, and no spare. That row is the single point of failure.

Stage 2: stop waiting with a timeout

When a cloud is down, a request often doesn't fail at once. It hangs. Without a limit, Aaryan's app waits, the customer stares at a spinning wheel, and the app's own workers fill up with waiting requests. A timeout is the most a request may wait before your code gives up on it, like hanging up when nobody answers after ten rings.

  • No timeout

    Customer waits
    Until they give up
    Then
    App workers pile up waiting
  • Timeout 2 minutes

    Customer waits
    2 minutes
    Then
    Error, customer gone
  • Timeout 10 seconds

    Customer waits
    10 seconds
    Then
    Time left to try the backup
Ten seconds is an example. Pick a timeout a little above how long a normal answer takes for your model and prompt.

Most model client libraries let you set a timeout on each call. Set it on purpose: the default is often long, because the library can't know how patient your customers are.

Stage 3: retry, but carefully

Kelvin, who helped build the app, has a quick fix: make it try again until it works. Trying again is right for a one-second blip, when one request in a hundred fails by chance. It is wrong for a two-hour outage. Four tries of thirty seconds each is two minutes of spinning, and then the order still fails.

Worse, retries add load. If every app tries four times, a cloud that is already struggling gets four times the traffic. That is a retry storm, and it can keep a cloud down after the first fault is fixed. This isn't only theory: in November 2024, Microsoft said a change set off a flood of retry requests to its servers, and Outlook and Teams were disrupted for hours.

  • 1

    Plain retry waits
    0 s
    Backoff with jitter waits
    0 s
  • 2

    Plain retry waits
    0 s
    Backoff with jitter waits
    about 1 s (0.6 to 1.4)
  • 3

    Plain retry waits
    0 s
    Backoff with jitter waits
    about 2 s (1.2 to 2.8)
  • Then

    Plain retry waits
    Keep going
    Backoff with jitter waits
    Stop, use the backup

The safe version has three rules. Retry only a few times. Wait longer before each try, doubling the wait: that is exponential backoff (taught in full in [Retries and fallbacks](/ai-engineering/llm-retries-and-fallbacks/)). Add a little randomness to each wait, called jitter, so a thousand apps don't all retry in the same second. Then stop and move on.

Stage 4: switch to a backup model

This is the dual-SIM move. When the main model fails, send the same order to a fallback model: a second model your app uses only when the first one can't answer. To protect you from a whole cloud going down, it has to run somewhere else, ideally at a different company.

  • 6 to 7 pm

    Main model
    Down
    Backup model
    Answers
    Orders through
    36
  • 7 to 8 pm

    Main model
    Down
    Backup model
    Answers
    Orders through
    39
The same illustrative evening, now with a backup. Not one customer sees "Something went wrong".

Here the dual-SIM picture breaks. Two SIMs carry the same call; two models don't give the same answer. The backup may word the icing differently, read dates another way, or follow your prompt less closely. So Aaryan runs real past orders through the backup before the bad day comes, and fixes the prompt where its answers differ. A backup nobody tested is a second surprise, not a spare.

Stage 5: keep working without AI

What if both models are down? The app can still do a smaller version of its job. That's called graceful degradation: when a part fails, the system keeps working in a simpler way instead of stopping, like a shop that takes cash when the card machine is down.

  • A plain form: cake, day, icing words. No AI needed; the customer types the fields the model would have filled in.
  • Save and reply later: put the message in a queue, a waiting list the app works through when the model is back, and tell the customer when to expect a reply.
  • Saved answers: for common questions ("Are you open Sunday?"), reply from a short list of answers written in advance.
  • An honest message: "Our assistant is down. Orders still work through the form." Better than a spinning wheel.

The point is to decide in advance which parts of your app need AI and which only use it to be nicer. For Aaryan, the AI fills in the order; it isn't the order. The form keeps the shop open.

Stage 6: know when it's down

Every step above needs the app to notice the failure quickly. Three tools do that.

  • Health check

    What it is
    A tiny test request every minute
    What it does for Aaryan
    Spots the outage before customers do
  • Circuit breaker

    What it is
    A switch that stops calling a failing part
    What it does for Aaryan
    After 5 failures, go to the backup at once
  • Status page

    What it is
    The provider's public page of incidents
    What it does for Aaryan
    Confirms it's them, not you

A circuit breaker works like the fuse box in a house. After a few failures in a row, it "trips": the app stops sending orders to the main model and goes straight to the backup, so no customer waits for a timeout. Every minute or so it lets one test request through; when that succeeds, it closes again. Don't rely on the provider's status page alone. During big outages these pages have sometimes updated late, so your own checks should decide.

A code sketch: try each model, then fall back

take_order.py
def main_model(message):          # pretend the main cloud is down
    raise TimeoutError("no answer in 10 s")

def backup_model(message):        # a different company's cloud
    return {"cake": "chocolate", "day": "Saturday", "icing": "Happy birthday Riya"}

def take_order(message, models):
    for name, model in models:
        try:
            order = model(message)    # a real call sets timeout=10
            return f"Order from {name}: {order}"
        except Exception as error:    # down, too slow or refused
            print(f"{name} failed: {error}")
    return "Sorry, our assistant is down. Please use the order form."

message = "chocolate cake, Saturday, happy birthday Riya"
print(take_order(message, [("main", main_model), ("backup", backup_model)]))
print(take_order(message, [("main", main_model)]))
  • main_model stands in for the call to the main provider. Here it always raises TimeoutError, the error a real client raises when the 10-second timeout runs out.
  • backup_model stands in for a model at a different company. It returns the filled-in order.
  • take_order gets a list of models in order of preference and tries each one.
  • try and except catch any failure, so one model's error moves the loop on to the next model instead of crashing the app.
  • The print inside except is the log line an engineer reads after the outage.
  • If every model fails, the last line returns the plain-form message: graceful degradation.
  • The first print call has a backup, so the order goes through. The second has only the main model, so the customer gets the form.

Common misconceptions

  • "Big clouds don't go down." Every cloud goes down sometimes. The twelfth of November 2026 proved it, and it wasn't Microsoft's first time. Big clouds are very reliable, which is exactly why few teams plan for the day they aren't.
  • "Retrying until it works is the safe choice." Unlimited retries make customers wait and pile extra load on a cloud that's already struggling. Retry a few times with backoff and jitter, then switch.
  • "Two regions of the same provider is a full backup." It covers a local fault, not a mistake the provider pushes everywhere at once. For that you need a second provider, or a way to work without AI.
  • "The backup model will behave the same." Different models read prompts differently. Test the backup on real past inputs before you need it.
  • "Every app needs two clouds." A weekend side project doesn't. A second provider means two bills, two sets of keys and twice the testing; a clear sorry message may be enough.

In real work

AI engineers meet this the first time a provider has a bad day and the support team asks why the assistant is down. The work that follows is usually small and very worth it:

  • Set timeouts on every model call, a little above your normal answer time.
  • Add one fallback model at a second provider, behind the same function your app already calls. Some teams put an LLM gateway in front of all their models: one service that routes each request and switches providers on failure (taught in [Design an LLM gateway](/ai-engineering/design-llm-gateway/)).
  • Test the fallback on a set of real past requests and compare its answers with the main model's.
  • Decide the no-AI path: the form, the queue or the honest message, and show it in the app.
  • Watch it: a health check, an alert when the circuit breaker trips, and a log of which model answered.

The trade-off is cost against risk. A backup provider costs little while unused if you pay per request, but it costs engineering time to keep its prompts working. Ask what one lost hour costs you. For Aaryan, a lost Friday evening is real money; for a hobby app, it isn't.

Recap

  1. Find the single point of failure: the part everyone depends on with no spare.
  2. Set a timeout so a hanging cloud costs seconds, not minutes.
  3. Retry carefully: a few tries, backoff and jitter, then stop.
  4. Fall back to a tested backup model in a different cloud.
  5. Degrade gracefully: a plain form, a queue or an honest message when both are down.
  6. Notice fast: health checks and a circuit breaker, not only the status page.

Practice

  1. Recall: why does trying again until it works make a big outage worse?
  2. Recall: why isn't a second region of the same cloud a full backup?
  3. Challenge: list every part a request to your own app (or one you use) passes through. Mark each one's blast radius and whether it has a spare. Which row is your single point of failure?
  • A timeout makes the app fail faster

    True or false
    True
    Why
    That's the point: it leaves time for the backup
  • Jitter means retrying at exactly 1, 2, 4 s

    True or false
    False
    Why
    Jitter adds randomness so apps don't retry together
  • A form can keep orders coming with no AI

    True or false
    True
    Why
    That's graceful degradation

Summary

Key takeaways

  • Your app is only as reliable as the one part it can't work without.
  • A single point of failure is a part everyone depends on with no spare; one AI model in one cloud is a common one.
  • A short timeout turns a hanging cloud into a quick, clear failure your code can handle.
  • Retry a few times with backoff and jitter, then stop: unlimited retries feed a retry storm.
  • A tested fallback model in a different cloud, plus a no-AI path, keeps the app working.
  • A backup costs money and testing; weigh it against what one lost hour costs you.

Interview corner

Your product's chat feature calls one LLM provider. It had a three-hour outage last week. What would you change?

First, find the single point of failure: every request goes to one provider. Set a client timeout a little above normal latency, and retry only once or twice with exponential backoff and jitter so we don't add to a retry storm. Add a fallback model at a second provider behind the same interface, with a circuit breaker that switches after a few failures and probes the main provider to switch back. Test the fallback on a sample of real past requests, since prompts behave differently across models. Define a no-AI path: a plain form, a queue with a reply later, or an honest status message. Finally, alert on breaker trips and log which model served each request. Whether a second provider is worth it depends on what an hour of downtime costs versus the extra bill and testing.

Practice

Check your understanding

Question 1

01Aaryan's main model has been down for an hour. Which change helps customers most right now?

Question 2

02Why can unlimited retries make an outage last longer?

Question 3

03Which part has the biggest blast radius in Aaryan's shop?

Question 4

04Aaryan adds a backup model but never tries it. What is the main risk?

0 of 4 answered

Finished this lesson?

Mark it done to track your progress. Saved in this browser only.

FAQ

Frequently asked questions

What happened in the Microsoft outage of November 2026?

On 12 November 2026, Outlook, Teams, Copilot and other Microsoft 365 services failed for users worldwide for many hours. Microsoft said there was no sign of a cyberattack, rolled back a recent network change whose timing matched the start, and promised the full cause in a post-incident report.

How do I keep my AI app running when the LLM API is down?

Set a short timeout on each model call, retry only a few times with backoff and jitter, switch to a tested fallback model at a different provider, and keep a no-AI path such as a plain form or a queue.

What is a single point of failure?

A part of a system that everything depends on and that has no spare. If it stops, the whole system stops. An app that calls one AI model in one cloud has one.

Should every AI app use two providers?

No. A second provider costs money and testing time. It's worth it when an hour of downtime costs more than that; for a side project, a clear error message is often enough.

Sources

Where the facts come from