Reliability & Incident Response
- Enumerate the failure modes specific to LLM apps: provider outages, rate limits, bad deploys, quality regressions
- Implement timeouts, bounded retries with jitter, and a circuit breaker around model calls
- Design a fallback chain β secondary model, cached answer, honest degradation β and defend its order
- Run an incident with roles, a timeline, and calm comms, then write a blameless postmortem
- Rehearse a provider-down scenario against your capstone before it happens for real
| Spaced-rep warm-up: due cards incl. Day 46 idempotency & Day 157 SLOs | 10 min |
| ELI5 + tech read; sketch the fallback chain from memory | 15 min |
| Guided: resilient wrapper + tabletop exercise | 45 min |
| Practice: blameless postmortem | 20 min |
| Project: incident runbook | 20 min |
| Quiz + flashcards | 10 min |
Builds on: Day 46 β Distributed systems β retries & idempotency Β· Day 125 β Agent reliability β graceful degradation Β· Day 157 β Monitoring & SLOs β the alarms that start incidents
Professional kitchens do not prevent all fires; they rehearse for them. Every cook knows the drill: who grabs the extinguisher, who moves the guests, who calls it in, and β crucially β the restaurant does not stop serving. The menu shrinks to what the working stations can produce. Cold dishes go out. Nobody stands in the dining room shouting "EVERYTHING IS BROKEN"; someone calmly tells guests there will be a short delay on hot mains.
Production AI systems catch fire on a schedule you don't control: your model provider has an outage, you get rate-limited during your own launch spike, a deploy ships a subtle regression. Reliability engineering is the rehearsed drill: timeouts so one stuck call can't hold a table forever, retries that give up gracefully instead of hammering a downed provider, a circuit breaker that stops sending cooks into a burning station, and a fallback menu β a backup model, a cached answer, or an honest "I can't answer right now, here's a link to the docs." The postmortem afterward asks "what let the fire spread?" never "which cook do we blame?" β because a kitchen that hides mistakes burns down twice.
Your LLM app has a hard dependency on someone else's API, and every major provider has had multi-hour incidents β the question is when, not if. Customers judge you by minute twenty of an outage: did the app degrade honestly or return raw stack traces? Did someone communicate? FDEs are on the sharpest end β Day 172 has you debugging DURING a customer incident, and the difference between "we exercised this fallback last month" and improvising live is the difference between renewal and churn. Interviews probe this too: "what happens when the model API goes down?" is a standard Day 160 follow-up.
Guided practice
Build the resilient call wrapper
25 min- Create
resilient.pyfrom the starter: timeout, bounded retries with jittered backoff, circuit breaker, and a fallback chain, wrapped around two simulated flaky providers. - Run the demo loop: provider A fails 100% for a stretch. Watch the log: retries β circuit opens β calls fail fast to provider B β half-open probe β recovery.
- Tune: set retries to 5 with no backoff and re-run. Count how many useless calls hammer the dead provider before the circuit opens β this is the retry-storm anti-pattern made visible.
- Now integrate the pattern into your capstone's model-call path with a real chain: primary model β cheaper backup model β retrieval-only degraded answer. Ensure each degraded response sets a
degraded: truefield and increments the Day 157 fallback counter.
Tabletop exercise: your provider is down
20 minRun this solo tabletop against your capstone, writing the incident log in real time (timestamps included). Scenario script β reveal one step at a time:
- T+0 β Day 157's canary fails twice; fallback-rate alert pages you. Primary provider returns 529s. Write your first three actions in order.
- T+5m β Provider status page confirms a major incident, no ETA. Decide: wait, or flip traffic to the backup chain? Write the decision AND the one-line stakeholder update you post (audience: your fictional users' Slack channel).
- T+20m β Backup model is up but 30% slower and slightly weaker; fallback rate is 100%, latency SLI is breaching. Does the latency SLO page you into a second incident? What do you tell users now?
- T+90m β Provider recovers. Define your recovery checklist: how do you confirm health before flipping back (hint: half-open probe, canary green, error rate), and what do you monitor for the next hour?
- Compute the total error-budget burn from the incident using Day 157's numbers, and note whether the budget survived.
On your own
Write the blameless postmortem
20 minTurn the tabletop into a one-page postmortem in docs/postmortems/2026-08-provider-outage.md with sections: Summary, Impact (requests affected, budget burned), Timeline (from your log), Contributing causes (find at least three β the outage itself, plus what made it worse on YOUR side), What went well, Action items (owner + date each).
Constraints: no names blamed (it's you anyway β blame the system that let a single provider be a single point of failure); every action item must be verifiable ("add second provider to chain" not "be more careful").
Hints: good candidate causes β no pre-warmed backup, canary interval too long, no status page for users.
The capstone incident runbook
Write docs/runbook.md β the document future-you opens at 3am: (1) service overview with the fallback chain diagrammed in text; (2) "alarm β first moves" table for your top five alerts (canary red, fallback spike, latency breach, error spike, cost spike), each with diagnosis commands and mitigation; (3) rollback procedure (Day 154, verified); (4) provider-outage play from today's tabletop; (5) comms templates β the three-sentence status update and the all-clear; (6) postmortem template. Keep every play executable by a stressed person: numbered commands, no prose walls. This completes the runbook Day 154 started and is required for Day 161's gate.
Common mistakes & misconceptions
- Retrying everything. 4xx errors (bad request, auth) will fail identically forever; retry only 429/5xx/timeouts, with backoff AND jitter, or you synchronize a retry storm.
- No circuit breaker, so every user request eats the full retry-timeout ladder against a dead provider. Fail fast once failure is established; probe for recovery automatically.
- A fallback chain that silently degrades. Unlabeled cached or weaker-model answers destroy trust when discovered; set degraded flags, show users honest banners, count it in metrics.
- Fallback to a same-vendor model tier and calling it redundancy. Shared infrastructure fails together; true redundancy crosses providers (and ideally regions).
- Diagnosing before mitigating. Users are down while you read logs; rollback or flip to fallback first, investigate on a healthy service.
- Postmortems that end with "root cause: human error, action: be careful." Find the systemic causes and write verifiable action items with owners, or the incident repeats.
Q1. Your provider starts returning 529 (overloaded). Naive clients everywhere retry immediately in a tight loop. What pattern-pair prevents your service from making the outage worse?
Q2. During degraded mode, why is "here are the top matching documents" often the right fallback for a RAG app?
Q3. A postmortem concludes: "Cause: the engineer typo'd the config. Action: engineers will double-check configs." What is wrong?
Go deeper β curated resources
- Error-budget policy β The pre-agreed rule for what happens when the budget empties (feature freeze, reliability sprint). Agreeing on it BEFORE the incident is what makes Day 157's budgets enforceable instead of decorative.
- Resilient wrapper integrated: timeouts, jittered retries, breaker, labeled fallbacks
- Tabletop completed with a timestamped incident log
- Postmortem and runbook committed; rollback re-verified
- Quiz β₯ 2/3
β Back: Day 46 gave you retries and idempotency; Day 125 taught graceful degradation for agents; Day 154 rehearsed the rollback you reached for; Day 157's alarms are what page you into today's process.
Forward β: Day 161's cutover gate requires the runbook and a tested fallback. Day 172 replays this discipline inside a customer's environment, where calm comms are half the job β and the Day 160 interviewer will ask "what if the provider goes down?" expecting today's answer.
Unlocks: D160 AI System Design Β· D161 Week 23 Checkpoint: Production Cutover Β· D172 Production Debugging with Customers