Skip to content
AgenticAIWiki
  1. Learn
  2. Part 13
  3. 70. Caching layers and multi-region
  4. 70.3

Lesson 70.3 · 3 of 5 · 4 min read · Reviewed 24 Nov 2026

Multi-region and failover

By the end, you can

  • Design multi-region serving and failover.
  • Plan for a provider or region outage.

Model APIs are very reliable but not perfect. If your product depends on one, plan for when it is slow or unavailable.

Layers of failover

primary: API in region A
   | errors or high latency
   v
fallback 1: same model via another region or cloud platform
   |
   v
fallback 2: a smaller or different model, evaluated for this task
   |
   v
fallback 3: graceful degradation (cached answer, simpler flow, human handoff)

Make it safe

  • Evaluate fallbacks. Run your eval suiteEval suite: A versioned collection of eval cases, graders and thresholds run on every prompt, model or code change. on each fallback route. A different model may need a slightly different prompt.
  • Health checks and circuit breakersCircuit breaker: A pattern that stops calling a failing dependency for a while, so failures do not cascade.. After N failures in a window, stop sending to the failing route for a while instead of timing out on every request.
  • Same data rules. A fallback in another region must still meet your data residencyData residency: A requirement that data is stored or processed in a particular country or region. commitments (70.4).
  • Capacity. Fallback routes need enough rate limitRate limit: A cap on how many requests or tokens you can use in a period, such as per minute. to take the load.

Your own app

Multi-region for your own servers, databases and queues matters too. Keep conversation state replicated, or accept that conversations in progress may be lost during a regional failover.

Practise

Run game days: switch traffic to the fallback on purpose and check latencyLatency: The time from sending a request until you get the response, or until the first token arrives when streaming., quality and cost.

Key points

  • Run your own app in more than one region so a regional outage doesn't take you down.
  • Plan model fallbacks: another region, another platform hosting the same model, or a smaller model.
  • Test failover regularly; an untested fallback often fails when you need it.
Hands-on labRuns in the Playground

Drill a regional failover safely

Choose a fallback that is healthy, supports the request's features and keeps the residency promise.

You will have: A choose() function and a drill log that explains every provider it skipped.

Steps

  1. Run the starter: it fails over to a provider that lacks a needed feature.
  2. Skip providers outside the residency boundary.
  3. Skip providers that lack a feature the request needs.
  4. Run the drill and read the skip reasons.
  5. Mark every EU provider unhealthy and check the result is to queue and alert, not to go global.

Done when

  • chosen: platform-c eu-north is printed.
  • platform-b is skipped for missing citations and the global pool for being outside eu.
  • With no valid fallback the drill prints none: queue and alert.

Open in the Playground No API key needed.

Starter code (Python)
# Drill a regional failover: pick a fallback that is healthy, supports the features and stays in region.
PROVIDERS = [
    {"name": "primary eu-west", "region": "eu", "healthy": False, "features": {"tools", "caching", "citations"}},
    {"name": "platform-b eu-central", "region": "eu", "healthy": True, "features": {"tools", "caching"}},
    {"name": "global pool", "region": "global", "healthy": True, "features": {"tools", "caching", "citations"}},
    {"name": "platform-c eu-north", "region": "eu", "healthy": True, "features": {"tools", "caching", "citations"}},
]
REQUEST = {"needs": {"tools", "citations"}, "residency": "eu"}


def choose(providers, request):
    for p in providers:
        if not p["healthy"]:
            print(f"  skipped {p['name']}: unhealthy")
        # TODO: skip providers outside request["residency"]
        # TODO: skip providers missing any feature in request["needs"]
        else:
            return p
    return None


print("drill: primary region marked down")
chosen = choose(PROVIDERS, REQUEST)
print("chosen:", chosen["name"] if chosen else "none: queue and alert")
Show a solution
# Drill a regional failover: pick a fallback that is healthy, supports the features and stays in region.
PROVIDERS = [
    {"name": "primary eu-west", "region": "eu", "healthy": False, "features": {"tools", "caching", "citations"}},
    {"name": "platform-b eu-central", "region": "eu", "healthy": True, "features": {"tools", "caching"}},
    {"name": "global pool", "region": "global", "healthy": True, "features": {"tools", "caching", "citations"}},
    {"name": "platform-c eu-north", "region": "eu", "healthy": True, "features": {"tools", "caching", "citations"}},
]
REQUEST = {"needs": {"tools", "citations"}, "residency": "eu"}


def choose(providers, request):
    for p in providers:
        if not p["healthy"]:
            print(f"  skipped {p['name']}: unhealthy")
        elif p["region"] != request["residency"]:
            print(f"  skipped {p['name']}: outside {request['residency']}")
        elif not request["needs"] <= p["features"]:
            print(f"  skipped {p['name']}: missing {', '.join(sorted(request['needs'] - p['features']))}")
        else:
            return p
    return None


print("drill: primary region marked down")
chosen = choose(PROVIDERS, REQUEST)
print("chosen:", chosen["name"] if chosen else "none: queue and alert")
Quick checkYour model provider's endpoint in one region is down. What does a good failover plan do?
How sure are you?
Pick an answer and how sure you are