11C.4 Operating LLM Systems: Governance, Incidents and the Production Checklist
Every lesson in this module so far has built one piece of a production LLM system: traces and metrics (11A.1, 11A.2), caches (11B.3), cost and latency controls (11B.1), routing (11B.5), fallbacks and gateways (11C.3), open-weight serving (11C.6), deployment and CI/CD (11C.1, 11C.2). This lesson is where those pieces become an operated system: the runbooks someone follows at 3 a.m., the governance that decides who may change a prompt, the retention rules that decide how long a user's question stays in a trace store, and the checklist that decides whether the service is allowed to launch at all.
Most of what follows is not LLM-specific — it is the discipline of running any production service, specialised for the ways LLM systems fail: non-deterministic answers that can be wrong without erroring, providers you do not control, prompts that are code, and data that flows to third parties. The parts that are new get the most space; the parts that are classic SRE get a precise LLM-flavoured version rather than a re-teaching.
What you'll learn
- What changes operationally at launch: on-call for LLM features, what pages you and what doesn't, and the incident lifecycle from detect to postmortem
- How to write and use runbooks — full templates for the nine incident classes an LLM service actually sees (provider outage, rate-limit exhaustion, cost spike, quality regression, retrieval failure, prompt-injection incident, PII leak, runaway agent, leaked key)
- How to run incidents: severity matrix, incident command roles, status communication, kill switches and degraded modes
- How to run blameless postmortems that find the LLM-specific contributing factors, and how to measure incidents (MTTR, repeat incidents, error-budget burn)
- How to govern an LLM system: the system inventory, change management and approvals, access control and separation of duties, audit logs, data classification, and vendor management (DPAs, subprocessors, retention, exit plans)
- How to run the data lifecycle: retention schedules, deletion across every store an LLM system writes to, residency, consent and access reviews
- How to govern cost and quality: budgets and allocation, eval ownership, release criteria, drift reviews, complaint handling, system cards and user-facing limitation notices
- The reliability-engineering calendar: SLO reviews, error-budget policy, game days and tabletop exercises, disaster recovery (RPO/RTO), dependency and upgrade hygiene, capacity reviews
- How to run the team: roles, on-call rotation design, documentation standards, and the LLMOps maturity model
- The production-readiness checklist and launch review that gate a release, plus the consolidated
llm_servicepackage this module built
What you don't need
- A production LLM system already running. Everything here is explained from first principles; the running
llm_serviceis assembled across the module and listed in the appendix. - API keys or paid services. The code in this lesson is pure Python (standard library only) and runs locally; provider-specific facts are cited to official pages.
- Legal or compliance expertise. This lesson teaches the operational side of governance — what to track, who approves, what to ask vendors. It is not legal advice; where law applies, it says so and points at the right owner.
- Prior incident-response experience. If you've run a pager before, skip to 1.4; the concepts map onto what you already know.
Setup
This lesson needs only Python 3.11+ and the standard library — no packages, no keys, no services:
# No install needed. Run each script with:
python3 incident_metrics.py incidents.jsonl
python3 oncall.py --people "ada,grace,linus,margaret" --weeks 4
python3 readiness.py checklist.json
python3 severity.py incident.jsonThe four scripts are self-contained; each section says which file it belongs to. Save them in one folder to run them as above; in the consolidated repository of 8.1 they live under scripts/. Everything provider-specific in the lesson is labelled as such and dated "as of November 2026".
What you must be able to do after this lesson#
- Decide which alerts page someone and which only create a ticket
- Write a runbook for an LLM incident class and contain before diagnosing
- Assign the four incident command roles and use a kill switch
- Run a blameless postmortem and find the LLM-specific contributing factors
- Classify a change as T2 or T3 and name who must approve it
- List every store that holds user data and plan deletion across them
- Use the production-readiness checklist at a launch review
Why this matters for an AI engineer#
Day-2 operations is where the difference between a demo and a product is decided — and where the difference between an average and a good LLM engineer shows fastest. You'll hear:
| You'll hear... | You'll understand it after... |
|---|---|
| "Who is on call for the LLM service this week?" | 1.2 On-call for LLM features, 6.2 On-call rotation design |
| "Page me when the answer quality drops, not when the API 500s." | 1.2, 1.5 Runbooks |
| "Follow the runbook for a provider outage." | 1.5 Runbooks |
| "This is a SEV2, open an incident channel." | 1.4 Severity, incident command and roles |
| "Write it up blamelessly — what in the system failed?" | 1.7 Blameless postmortems |
| "Our MTTR doubled this quarter." | 1.8 Incident metrics |
| "Who approved this prompt change? Show me the audit log." | 2.2 The system inventory, 2.3 Change management, 2.5 Audit logs |
| "The vendor's DPA doesn't cover model training on our data." | 2.7 Vendor management |
| "Delete this user's data — from everywhere." | 3.3 Deletion and erasure |
| "Why is next month's forecast 3× this month's bill?" | 4.1 Cost governance |
| "When did we last re-run the drift review?" | 4.2 Quality governance |
| "What's our RPO for the vector index?" | 5.3 Disaster recovery |
| "Are we Level 2 or Level 3 on the LLMOps maturity model?" | 6.4 The LLMOps maturity model |
| "Go/no-go on Thursday's launch." | 7.1 The production-readiness checklist, 7.2 The launch review |
Part 1: Day-2 operations#
1.1 What changes at launch#
Until launch, an LLM feature is a project: you know every prompt, every model call, every failure mode because you wrote them last week. After launch, the system acquires properties a project never has:
- Users you didn't write the requests for. Real traffic is adversarial, confused, multilingual, and occasionally malicious — inputs your eval set never imagined.
- Dependencies you don't control. The model provider changes weights behind an alias, deprecates an endpoint, has a bad afternoon, or raises prices. Your code didn't change; your behaviour did.
- Time. Prompts rot against drifting data; indexes grow; caches fill with stale answers; costs creep as usage grows.
- People who weren't there. Six months from now, nobody on the team wrote the incident-response code. The system has to explain itself — through runbooks, dashboards, inventory records and audit logs — to people who must operate it blind.
- Money and liability. A runaway agent or a leaked key is a bill or a breach, not a bug ticket.
Day-2 operations is the discipline of owning those properties deliberately instead of discovering them during an incident. Concretely, it is five jobs:
flowchart TB
subgraph day2 ["Day-2 operations: five jobs"]
direction TB
J1["1. Detect and respond<br/>on-call, alerting, runbooks, incidents, postmortems"]
J2["2. Govern<br/>inventory, change control, access, audit, vendor management"]
J3["3. Manage data<br/>retention, deletion, residency, consent"]
J4["4. Govern cost and quality<br/>budgets, evals, drift reviews, complaints"]
J5["5. Engineer reliability<br/>SLOs, game days, disaster recovery, capacity, dependencies"]
end
day2 --> GATE["Launch gate:<br/>production-readiness checklist + launch review"]This lesson walks through all five, then assembles them into the launch gate. The earlier lessons built the machinery each job runs on; this one is the operating manual.
1.2 On-call for LLM features: what actually pages you#
Classic on-call pages you when a service is down. An LLM service adds failure modes that are quiet, expensive, or wrong-but-not-crashing. A good LLM on-call rotation pages on a different set of signals than a classic web service, and — just as important — knows what not to page on.
What should page
| Signal | Why it pages | Where it comes from |
|---|---|---|
| Provider outage or severe degradation across your primary route | Your feature is down or falling back constantly; fallback capacity is finite | Error-rate alerts per provider/model (11C.3 breakers), provider status pages (1.5.1) |
| Error budget burn rate exceeded | You're spending reliability faster than the SLO allows | Multi-window burn-rate alerts (11A.2) |
| Cost anomaly: spend 3–5× the recent baseline | A runaway loop, a prompt regression that doubled output tokens, or abuse | Cost-per-request anomaly alerts (11A.2, 11B.1) |
| Safety or privacy incident: PII detected in outputs at volume, a confirmed injection breach, a key leak | These are incidents by definition — they need humans now, not at standup | Guardrail triggers, DLP-style scans, secret scanners (1.5.7, 1.5.9) |
| Quality regression past threshold: eval pass rate or judge score collapse | The feature is "up" but wrong — users are getting bad answers at scale | Online eval metrics (10A.9), canary evals (11C.2) |
| Retrieval/index failure: near-zero hit rate or stale index serving | RAG silently degrades to "the model guesses" | Retrieval metrics (07.11, 11A.2) |
What should not page (ticket instead)
- A single failed request or a transient 429 that retries absorbed — that's 03.8's job, not yours.
- One bad answer flagged by a user — that's a feedback item for the eval dataset (10A.9), unless the rate of bad answers is anomalous.
- A model deprecation notice — that's a scheduled change-management task (2.3), not a 3 a.m. page.
- Gradual cost drift under 2× baseline — review at the weekly cost meeting; page only on step-changes that imply a loop or abuse.
The rule that separates the two lists: page on symptoms a user would notice within minutes and that need a human decision now; ticket on anything with a next-business-day fix. Alert fatigue is the classic failure mode — a rotation that pages for trivia trains engineers to ignore pages, and then the real page gets ignored too (11A.2 covers alert design; the on-call consequence is yours).
The LLM-specific on-call differences
- Quality is a first-class pager signal. A classic service is "up" or "down"; an LLM service can be fully up and confidently wrong. That means on-call needs dashboards that show answer quality (online eval scores, judge pass rates, user-negative-feedback rate), not just HTTP metrics — and needs to know which dashboards matter per feature.
- The blast radius includes money. A retry storm against a per-token API doesn't just degrade — it bills. Cost anomaly alerts are on-call alerts, and the first response to a suspected runaway is often spend containment (kill switch, per-tenant cap, provider-side spend limit), not debugging.
- The fix may be "switch it off". Because LLM features degrade gracefully (cached answers, smaller models, human handoff — the degraded modes of 1.6), the fastest mitigation for many incidents is disabling a feature or rerouting to a fallback, not patching code. Runbooks must say so explicitly.
- Incidents have a communications surface classic services lack. A wrong answer may have already reached users; a safety incident may require telling users what data was exposed. Status communication is part of the response (1.4), not an afterthought.
1.3 The incident lifecycle#
Google's SRE book describes incident management as a lifecycle with distinct phases; the same phases apply to LLM incidents, with LLM-specific content in each. The phases:
flowchart LR
A["1. Detect<br/>alert, user report,<br/>status page, eval drift"] --> B["2. Triage<br/>severity, commander,<br/>war room / channel"]
B --> C["3. Contain<br/>stop the bleeding:<br/>kill switch, flag, cap"]
C --> D["4. Mitigate<br/>fallback, rollback,<br/>provider switch"]
D --> E["5. Resolve<br/>root cause fixed,<br/>verify on metrics"]
E --> F["6. Communicate<br/>status updates,<br/>user/vendor notice"]
F --> G["7. Postmortem<br/>blameless review,<br/>action items tracked"]
G -.->|"action items become<br/>runbook/checklist updates"| AThe ordering matters more than it looks. Contain before diagnose is the single most common piece of advice in incident management (Managing Incidents, SRE book) — and for LLM systems it is doubly true, because the bleeding may be money or data exposure, not just downtime. An engineer who spends 40 minutes finding the root cause of a runaway agent while it spends $4,000 is optimising the wrong thing.
Phase details
Detect. Three detection paths, in rough order of speed:
- Automated alerts — the SLO burn-rate, cost-anomaly and quality-regression alerts of 11A.2. These are the backbone; everything else is a backstop.
- Synthetic probes and canaries — scheduled requests with known answers (11A.2) catch "the service is up but every answer is broken", which error-rate alerts miss entirely.
- Humans — user reports, support tickets, "the bot said something weird" anecdotes. Treat a credible user report as a detection event even with zero alerts: it means your monitoring has a gap, which is itself a finding for the postmortem.
Triage. Decide severity (1.4), name an incident commander, open the incident channel/war room, and start the living incident document. The triage decision should take minutes, not hours — a wrong severity is cheap to correct, a slow triage is not.
Contain. Stop the damage before understanding it. For an LLM service the containment menu is unusually rich:
- Flip the kill switch or feature flag to disable the affected feature, tool or tenant (1.6; the agent-level version is 08A.14, 7.2).
- Tighten a budget or rate limit to cap spend while you investigate.
- Route to a degraded mode (cached answers, smaller model, retrieval-only, human queue).
- Revoke a leaked key or suspend a tenant whose traffic looks abusive.
- Pause an agent's write tools or drop its autonomy tier (08A.14).
Mitigate. Restore service by whatever works: provider failover (11C.3), rollback of the last deploy or prompt change, index rebuild, cache flush. Mitigation does not require understanding the root cause — it requires restoring the SLO. Understanding comes next, and sometimes in parallel by a second person.
Resolve. The metrics confirm the symptom is gone and stays gone. For LLM incidents, "resolved" often needs a quality check, not just an error-rate check: error rate back to baseline but judge scores still low means the incident isn't over.
Communicate. Internal: the incident channel gets regular updates (what we know, what we're doing, ETA or "no ETA yet"). External: users, support, and — for safety/privacy incidents — potentially regulators and affected users (1.4 covers the matrix). Providers: if the root cause is theirs, a support ticket with the request IDs from 03.8, 12.2 is part of mitigation.
Postmortem. Within days, not weeks — the details decay fast. 1.7 covers the format; the discipline is that every SEV1/SEV2 and most SEV3s get one, and action items get owners and due dates that are actually tracked.
1.4 Severity, incident command and roles#
The severity matrix
Severity decides who gets involved, how fast, and whether it's a postmortem. A workable four-level matrix for an LLM service:
| Level | Name | Examples for an LLM service | Response |
|---|---|---|---|
| SEV1 | Critical | Confirmed PII/data breach; API key leaked and abused; feature producing harmful content at scale; total outage of a revenue-critical feature; runaway spend threatening the monthly budget | Page everyone needed; incident commander + comms lead immediately; exec notification; hourly updates; postmortem mandatory |
| SEV2 | Major | Primary provider down with degraded fallbacks; quality collapse on a core feature; cost anomaly >5× baseline; retrieval serving stale/wrong data broadly | Page on-call + owner; commander named; updates every 1–2 h; postmortem mandatory |
| SEV3 | Minor | Single-model degradation with working fallback; a feature down for a small tenant cohort; cost drift 2–3×; a prompt regression caught by evals before users noticed | Ticket + on-call ack within business hours; postmortem if user-visible or recurring |
| SEV4 | Low | Cosmetic issues, single weird answers, non-urgent dependency deprecations | Backlog; no page |
Two LLM-specific rules for the matrix:
- "Wrong but up" is a severity, not a non-event. A feature answering incorrectly for 30% of requests is at least SEV2 even with zero HTTP errors — define the quality thresholds that make it so (4.2 sets them).
- Data incidents are SEV1 until proven otherwise. Any confirmed exposure of user data to an unauthorised party — including to a model provider in violation of your data policy — starts at SEV1 and is downgraded only with evidence.
severity.py: a first-pass classifier
Severity calls at 3 a.m. should be mechanical, not debated. Below, severity.py maps structured incident signals to a suggested SEV level — a starting point the commander confirms, not a verdict. It's pure Python and runs on the incident record you already have.
# severity.py — suggest an incident severity from structured signals.
# Stdlib only. Usage: python3 severity.py incident.json
#
# incident.json fields (all optional — missing signals are treated as
# absent, so the classifier under-triages by design; the human confirm
# step printed at the end is the safeguard):
# users_affected_pct: float share of users impacted (0-100)
# data_exposed: bool confirmed unauthorised data exposure
# cost_burn_usd_per_hour: float current spend rate anomaly
# feature_tier: "critical" | "standard" | "internal"
# quality_impact: "none" | "degraded" | "wrong_answers" | "harmful"
# provider_outage: bool upstream provider down/degraded
#
# The thresholds below (1000 and 5 dollars an hour, 50% and 10% of users) are
# illustrative absolute numbers: the matrix above talks in multiples of your own
# baseline, so replace them with values derived from your traffic and budget.
import json
import sys
def classify(sig: dict) -> tuple[str, list[str]]:
"""Return (severity, reasons). Highest applicable level wins."""
reasons = []
# SEV1 triggers — any one is enough.
if sig.get("data_exposed"):
reasons.append("confirmed data exposure")
if sig.get("quality_impact") == "harmful":
reasons.append("harmful outputs at scale")
if sig.get("cost_burn_usd_per_hour", 0) >= 1000:
reasons.append(f"cost burn ${sig['cost_burn_usd_per_hour']}/h")
if (sig.get("users_affected_pct", 0) >= 50
and sig.get("feature_tier") == "critical"):
reasons.append("critical feature, >50% users affected")
if reasons:
return "SEV1", reasons
# SEV2 triggers.
if sig.get("provider_outage") and sig.get("feature_tier") == "critical":
reasons.append("critical feature on degraded provider")
if sig.get("quality_impact") == "wrong_answers":
reasons.append("quality impact: wrong_answers")
if 5 <= sig.get("cost_burn_usd_per_hour", 0) < 1000:
reasons.append(f"cost burn ${sig['cost_burn_usd_per_hour']}/h")
if sig.get("users_affected_pct", 0) >= 10:
reasons.append(f"{sig['users_affected_pct']}% users affected")
if reasons:
return "SEV2", reasons
# SEV3 triggers.
if sig.get("quality_impact") == "degraded":
reasons.append("degraded quality")
if sig.get("provider_outage"):
reasons.append("provider degraded (non-critical feature)")
if sig.get("users_affected_pct", 0) >= 1:
reasons.append(f"{sig['users_affected_pct']}% users affected")
if reasons:
return "SEV3", reasons
return "SEV4", ["no SEV1-3 signals — likely cosmetic or internal"]
def main(path: str) -> None:
with open(path, encoding="utf-8") as f:
sig = json.load(f)
sev, reasons = classify(sig)
print(f"suggested severity: {sev}")
for r in reasons:
print(f" - {r}")
print("(confirm against the severity matrix — this is a first pass)")
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("usage: python3 severity.py incident.json")
main(sys.argv[1])Sample incident.json and real output (deterministic):
{"users_affected_pct": 35, "data_exposed": false, "cost_burn_usd_per_hour": 0,
"feature_tier": "critical", "quality_impact": "wrong_answers", "provider_outage": false}$ python3 severity.py incident.json
suggested severity: SEV2
- quality impact: wrong_answers
- 35% users affected
(confirm against the severity matrix — this is a first pass)The classifier encodes the matrix's logic, not its judgement — a human still confirms, because severity is also about context the signals can't see (is it launch week? is a regulator watching?). What the script buys you is a consistent first pass and a written record of why the suggested level was suggested.
Incident command
Google's incident management is based on the Incident Command System — a structure where roles are explicit so people don't freelance during a crisis (Managing Incidents). For an LLM service:
flowchart TB
IC["Incident Commander<br/>owns the response, delegates everything,<br/>keeps the living incident doc"]
OPS["Ops lead<br/>the only role that changes the system:<br/>flags, routes, rollbacks, caps"]
COMMS["Comms lead<br/>internal updates, status page,<br/>stakeholder/vendor messages"]
PLAN["Planning lead<br/>timelines, action items, bug filing,<br/>tracking divergence from normal"]
SME["SMEs on demand<br/>the engineer who wrote the prompt,<br/>the person who owns the vendor account"]
IC --> OPS
IC --> COMMS
IC --> PLAN
IC -.->|"pulls in"| SMEThe roles scale down for small teams — one person can hold two — but the separation matters: the person debugging should not also be the person deciding what to tell customers, because both jobs degrade when combined. The two rules that prevent the classic spiral:
- Only Ops modifies the system. Freelancing — a well-meaning engineer deploying a "quick fix" nobody else knows about — is how incidents get worse. If you want to try something, you say so in the incident channel first.
- The incident document is living. A shared doc (or the incident tool's timeline) records: severity, commander, current hypothesis, actions taken with timestamps, open questions. It is the postmortem's raw material and the answer to "wait, did we already try that?"
1.5 Runbooks: the operational memory#
A runbook is a step-by-step procedure for a recurring operational task or incident class — written so that someone at 3 a.m. who has never seen the system can execute it. Runbooks are where organisational knowledge survives turnover; a system without runbooks has its knowledge in people's heads, and those people go on holiday.
Runbook anatomy
Every runbook in this lesson follows the same skeleton:
# <incident class>
Trigger: which alert / symptom / report starts this runbook
Severity: default severity and when to escalate
Owner: the team/person accountable for keeping it current
Last tested: date of the last tabletop or real use
1. Confirm — verify it's really this problem (rules out lookalikes)
2. Assess — size the blast radius: which features, tenants, providers
3. Contain — the safe first actions (flags, caps, routes) with exact steps
4. Mitigate — restore service; ordered options with trade-offs
5. Verify — the metrics that prove it's actually fixed
6. Communicate— who to tell, what to say, when
7. Escalate — when to pull in vendor support / execs / legal
8. Follow-up — postmortem trigger, action items, runbook updatesTwo disciplines make runbooks actually work:
- Write for the reader at 3 a.m. Exact commands, exact dashboard names, exact flag names — not "check the monitoring". Include the links, not descriptions of where things live.
- Test them. A runbook never executed is a hypothesis. Tabletop exercises (5.2) and real incidents both count; log the date in the runbook.
1.5.1 Provider outage or degraded
Trigger: error-rate or latency alerts across one provider/model; provider status page shows an incident; fallbacks engaging en masse.
Trigger: primary provider error rate > threshold for >5 min, or status page incident
Severity: SEV2 (SEV1 if all providers degraded)
Owner: on-call + LLM service owner
1. Confirm: check status pages — status.openai.com, status.claude.com,
aistudio.google.com/status, status.openrouter.ai (as of Nov 2026).
Check your own dashboards: is it one model, one region, or everything?
2. Assess: which of your routes depend on the affected provider/model?
Check the routing table (11B.5) and fallback chain (11C.3) — what fires next?
3. Contain: if fallback quality is unacceptable for a feature, flip that
feature's flag to degraded mode (cached answers / human queue) rather
than letting it serve bad answers. Cap per-tenant spend if retries are
amplifying cost.
4. Mitigate: confirm the fallback chain is healthy (it may be the thing
now serving all traffic — watch ITS limits). If the outage is partial
(one model only), repin traffic to unaffected models via the router.
If using OpenRouter, check whether routing preferences can avoid the
degraded host.
5. Verify: error rate and latency back within SLO on the surviving route;
quality metrics (judge scores) acceptable on fallback outputs — a
fallback model can be "up" and worse.
6. Communicate: status page update if user-visible; support macro for
"answers may be slower/less accurate"; notify the vendor account owner.
7. Escalate: provider support ticket with request IDs (03.8, 12.2) if the
status page is silent but your metrics say otherwise — your data is
often faster than their status page.
8. Follow-up: postmortem if SEV2+; check whether fallback capacity was
adequate; consider a second provider for the affected capability.1.5.2 Rate-limit exhaustion
Trigger: 429s above threshold, Retry-After storms, queue depth growing; or the softer version — rising latency from queued requests.
Trigger: 429 rate or queue depth above SLO for >10 min
Severity: SEV3 (SEV2 if user-visible latency breach)
Owner: on-call
1. Confirm: which limit? RPM vs TPM vs budget vs concurrency. Check
provider dashboards / your rate-limiter metrics (03.8, 03.9).
A 429 can also mean "out of money" (03.8, 4.2) — check billing first.
2. Assess: is it your growth (legit traffic up), a retry storm amplifying
load, one tenant abusing quota, or a provider-side limit reduction?
3. Contain: enable load shedding / queue prioritisation (11C.3); tighten
per-tenant quotas; if one tenant is the cause, cap or suspend them.
Do NOT increase global retries — that makes it worse.
4. Mitigate: if provider limit, request a limit increase (business hours)
and meanwhile route overflow to fallback providers/models (11B.5/11C.3).
If self-inflicted (retry storm), fix the retry layer, not the limit.
5. Verify: 429 rate and queue depth normal; p95 latency back in SLO.
6. Communicate: internal note; user-facing only if latency was visible.
7. Escalate: provider account team if you need a higher tier urgently.
8. Follow-up: capacity review — was the limit sized for real growth?
Add the missing alert BEFORE it pages next time.1.5.3 Cost spike
Trigger: spend anomaly alert; monthly forecast exceeding budget; cost-per-request metric stepping up.
Trigger: spend >3x trailing baseline, or forecast > budget
Severity: SEV2 (SEV1 if existential — e.g. > monthly budget in a day)
Owner: on-call + finance/product owner for the feature
1. Confirm: WHERE is the money going? Break down by feature, model,
tenant, prompt version (11B.1 cost attribution). Rule out a legitimate
launch or marketing campaign first — check the launch calendar.
2. Assess: loop or abuse? Check for: agent retry loops, a prompt change
that doubled output tokens, a caching regression (hit rate dropped),
a tenant scraping the API, eval/CI jobs accidentally hitting prod.
3. Contain: THIS IS A MONEY BLEED — act in minutes. Tighten per-tenant
budgets and rate limits; flip expensive features to cheaper models
or degraded modes; revoke keys that look abusive; pause non-essential
batch jobs. Provider-side spend limits are the last-resort cap.
4. Mitigate: identify the loop (trace a few expensive traces end to end —
11A.1); fix the cause: prompt, router, cache key, or code.
5. Verify: cost-per-request back to baseline; spend rate flattened.
6. Communicate: finance + feature owner immediately (they own the bill);
execs if SEV1. Be honest about the amount — early disclosure is cheaper
than late discovery.
7. Escalate: provider billing support for disputed charges; security if
abuse is suspected (it may be an attack, not a bug).
8. Follow-up: postmortem; add the missing budget alert or attribution
dimension that would have caught it sooner; review whether hard caps
(not just alerts) should exist for this feature.1.5.4 Quality regression after a model or prompt change
Trigger: online eval score or judge pass-rate drop after a deploy; user complaint spike; canary eval failure.
Trigger: eval metric down > threshold vs baseline, post-deploy
Severity: SEV2 if user-visible and broad; SEV3 if caught early
Owner: on-call + the change owner
1. Confirm: WHAT changed? Check the deploy/prompt-registry/model-pin
timeline (11C.2). Diff the actual prompt versions and model IDs —
don't assume it's the thing you deployed last.
2. Assess: scope — all users or a slice (language, tenant, query type)?
Check per-slice eval metrics. Is it format (schema failures), content
(wrong answers), or refusal (over-cautious)?
3. Contain: if a prompt/model change caused it, roll back via the
pipeline's rollback path (11C.2) or repin the previous model version.
Feature-flag off the affected slice if rollback is slow.
4. Mitigate: root-cause with traces — pull failing traces (11A.1) and
compare against the eval cases that regressed. Common causes: model
alias drifted to a new snapshot, prompt cache serving stale prefix,
retrieval index changed underneath a prompt tuned for the old one.
5. Verify: eval metrics back to baseline AND spot-check real traces —
metric recovery without trace verification has fooled teams before.
6. Communicate: change owner + product; users only if they saw bad output.
7. Escalate: if the "regression" is actually the provider silently
updating a model behind an alias — that's a vendor conversation AND
an argument for pinning snapshots (02.9, Part 8).
8. Follow-up: the regression MUST become an eval case (10A.8/10A.9) —
the suite that didn't catch it is the real bug. Postmortem if SEV2.1.5.5 Retrieval or index failure
Trigger: retrieval hit-rate collapse, zero-hit spike, stale-content complaints, index build failure alerts.
Trigger: retrieval metrics outside SLO; "answers ignore the docs" reports
Severity: SEV2 for customer-facing RAG; SEV3 internal
Owner: on-call + data/index owner
1. Confirm: WHICH stage failed? Retrieval (no/few hits), rerank (bad
order), or generation ignoring context? Check retrieval metrics and
a few traces end-to-end (07.11).
2. Assess: is the index stale (ingestion pipeline broken — 05.9), empty
(bad deploy/migration), corrupted (bad embedding model swap), or is
the QUERY side broken (query rewrite/embedder down)?
3. Contain: if retrieval is down, decide per feature: serve without
retrieval (acknowledge it — don't pretend), serve cached answers,
or degrade to a smaller trusted corpus. NEVER silently serve
ungrounded answers as if retrieved — that's a quality AND a
trust incident.
4. Mitigate: replay the index build / fix the ingestion pipeline /
repin the previous index alias (blue/green promotion from 05.9/11C.2).
For embedding-model drift: the index and query embedder must match —
check both.
5. Verify: hit rate, NDCG-ish quality proxies, and end-to-end eval
scores recovered; freshness timestamps current.
6. Communicate: users if answers were ungrounded; support macro.
7. Escalate: data team if source systems are the cause.
8. Follow-up: postmortem; add the missing freshness/hit-rate alert;
verify the blue/green index promotion actually protects this path.1.5.6 Prompt-injection incident
Trigger: confirmed injection success (model followed injected instructions), guardrail alerts at volume, a report of exfiltrated data via the assistant.
Trigger: confirmed or strongly suspected successful injection;
spike in guardrail triggers on one feature
Severity: SEV1 if data exfiltrated or actions taken; SEV2 if contained
Owner: on-call + security owner + feature owner
1. Confirm: WHAT was achieved? Reconstruct from traces: what did the
injected content say, what did the model do, what data/actions
resulted? The trace (11A.1) + audit log (08A.14/2.5) is the evidence.
2. Assess: blast radius — which users/tenants/sessions? Which tools or
data did the injection reach? Was private data + untrusted content +
exfiltration channel all present (the trifecta)?
3. Contain: disable the affected tool or feature flag; tighten the
policy layer (raise risk tiers, require approval); block the attack
pattern at the guardrail; if a specific document/source is the
injection vector, quarantine it.
4. Mitigate: revoke/rotate any exposed credentials; purge injected
content from indexes/caches if it's persistent; patch the specific
gap the attack exploited.
5. Verify: replay the attack trajectory against the fix (deterministic
replay from 08A.14); the eval suite's injection tasks pass; guardrail
metrics back to baseline.
6. Communicate: security owner + legal/compliance IMMEDIATELY if user
data was exposed — notification obligations may have clocks.
Status page only if user-visible.
7. Escalate: security team leads; potentially law enforcement/regulators
per the data involved. Document EVERYTHING — this may be evidence.
8. Follow-up: mandatory postmortem; the attack becomes an eval/regression
task; review whether the trifecta leg that was cut should have been
cut architecturally, not just by a guardrail.1.5.7 PII leak
Trigger: PII detected in logs/traces/outputs at volume; a user reports their data appearing in another user's context; DLP alert.
Trigger: confirmed PII exposure beyond approved scope
Severity: SEV1 — data incidents start at the top until proven otherwise
Owner: on-call + privacy/security owner + legal
1. Confirm: WHAT data, WHERE exposed, WHO could see it? Check: logs,
traces, caches, vector stores, provider-side storage (did it go to
a model provider against policy?), support tickets, analytics.
2. Assess: scope — one user or many? Internal-only exposure or external?
Is it still ongoing (a logging bug still writing)?
3. Contain: stop the leak source (flag off the feature, fix the logging
config, revoke access); if it's in a shared store (cache, index),
purge the affected entries — remember caches and indexes are stores
too (11B.3, 05.9, 3.3).
4. Mitigate: remediation per data-protection obligations — deletion,
notification, access-review. Check provider-side retention: if data
went to a provider, their retention/ZDR terms govern how long it
persists (02.9, Part 9).
5. Verify: scans show no residual exposure; deletion confirmed across
ALL stores including backups' expiry windows.
6. Communicate: legal/privacy owner drives user/regulator notification —
do NOT wing this; notification duties have legal clocks.
7. Escalate: legal + privacy lead; provider if their systems are involved.
8. Follow-up: mandatory postmortem; the leak path becomes a test;
review retention schedules and access controls (Part 3).1.5.8 Runaway agent
Trigger: cost/step/token alerts on an agent feature; a user reports an agent doing hundreds of actions; audit log shows a loop.
Trigger: agent run cost/steps >> normal, or loop detected
Severity: SEV2 (SEV1 if side-effects happened — wrong orders, sent mail)
Owner: on-call + agent owner
1. Confirm: WHICH run(s)? Pull the trace (11A.1): is it looping (same
tool call repeating), thrashing (plan→fail→replan), or legitimately
long? Check the audit log for side-effects already taken.
2. Assess: blast radius — how many runs affected? What side-effects
occurred (08A.14 audit trail)? Is it one tenant's input triggering it
or systemic?
3. Contain: kill the run(s); tighten the agent's budgets (steps, tokens,
cost, wall-clock — 08A.14); drop autonomy tier or disable the looping
tool via policy layer; if it's input-triggered, block that pattern.
4. Mitigate: for side-effects, execute rollback/compensation (08A.14,
2.7) — refunds, reversals, notifications. Fix the loop cause:
missing budget check, tool that never signals completion, prompt
that rewards retrying.
5. Verify: no new runaway runs; budgets enforced in code (not prompts);
replay the incident trajectory passes.
6. Communicate: affected users if side-effects touched them; support
macro; finance if cost was material.
7. Escalate: agent owner + whoever owns the affected tool's backend.
8. Follow-up: postmortem; the trajectory becomes an eval task; verify
every side-effecting tool has idempotency (08A.14) so retries are safe.1.5.9 Leaked API key
Trigger: secret-scanner alert, key found in a repo/log, provider abuse notification, anomalous usage from an unknown source.
Trigger: confirmed or suspected key exposure
Severity: SEV1 — treat as compromised until proven otherwise
Owner: on-call + security owner
1. Confirm: WHICH key, WHERE exposed? Check: git history, CI logs,
container images, trace/log stores, frontend bundles (a key in
client-side code is public by definition — Module 12).
2. Assess: what can the key do? Its scope (provider-side permissions,
spend limits, allowed models/endpoints) determines blast radius.
Check provider usage logs for unauthorized calls.
3. Contain: REVOKE/ROTATE THE KEY NOW — this is the fastest containment
and it's irreversible-by-design (a leaked key is dead). Then audit:
what did the attacker do with it before revocation?
4. Mitigate: issue a new key via the secret manager (03.1, 3.8); update
all consumers; if the key was broad-scope, create a narrower one —
the leak is the argument for least-privilege keys.
5. Verify: old key returns 401/403 everywhere; new key works; no
residual exposure in the location it leaked from.
6. Communicate: security owner; finance if abuse incurred charges;
provider if their abuse systems flagged it.
7. Escalate: security lead; if customer data was reachable via the key,
this becomes a data incident too (1.5.7).
8. Follow-up: postmortem; the exposure path becomes a control (pre-commit
secret scanning, CI checks, shorter-lived keys); review ALL keys for
the same exposure pattern.1.6 Kill switches, feature flags and degraded modes#
Containment needs mechanisms that pre-date the incident. Three layers, cheapest first:
Kill switches and feature flags
A kill switch is an external control — outside the code path it disables — that instantly turns a feature off or reverts it. The agent-level version (revert to last-known-good) is 08A.14, 7.2; the service-level version covers:
| Switch | Scope | Example |
|---|---|---|
| Feature flag | whole feature on/off | support_bot_v2_enabled → off serves "try again later" or routes to human queue |
| Tool kill switch | one tool disabled | agent's issue_refund tool off; reads still work |
| Tenant switch | one customer | suspend an abusive or affected tenant without touching others |
| Model/route switch | which model serves | repin primary to fallback provider/model |
| Autonomy dial | agent permission level | drop from autonomous to approval-required or read-only |
Rules for kill switches that actually work in an incident:
- External to the thing they kill. A flag checked inside the agent's own loop can fail with the agent. The switch lives in config/DB/flag-service the service reads per-request.
- Tested, not hypothetical. Fire every kill switch in staging (and once in prod deliberately) — a switch you've never flipped is a hypothesis. 08A.14 makes this explicit for agents; it applies to every flag.
- Fast. Per-request flag reads cached for seconds, not deploys. If disabling requires a redeploy, it's not a kill switch, it's a rollback.
- Logged. Every flip is an audit event with who/when/why — you'll need it for the postmortem and possibly for compliance.
Degraded modes
A degraded mode is a designed lesser-functionality path that keeps the feature useful when the full path is broken. For LLM features the menu is richer than classic services:
| Full mode | Degraded alternatives (pick per feature) |
|---|---|
| Live model answers | Cached answers (with staleness label), smaller/cheaper model, retrieval-only (no generation), human handoff queue, "we're degraded, try later" |
| Agent with write tools | Read-only agent, approval-required for every action, workflow-only (no open-ended loop) |
| Multi-provider routing | Single-provider pinned mode (fewer moving parts in an incident) |
| Real-time voice | Text-only fallback, async transcription |
Design rule: decide degraded modes at design time, not during the incident. A degraded mode invented mid-incident is a code change under pressure. Each feature's degraded mode should be in its runbook (1.5) and on the readiness checklist (7.1).
1.7 Blameless postmortems#
After a SEV1/SEV2 (and most SEV3s), write a postmortem: a blameless written record of what happened, why, and what will prevent recurrence. Google's SRE book is the canonical reference — Postmortem Culture — and its core tenets:
- Blameless means systems, not people. "The on-call engineer should have noticed sooner" is blame; "the alert didn't exist" is a system finding. People did the best they could with the information and tools they had — the postmortem asks what information and tools were missing.
- Written for the widest useful audience. Share beyond the immediate team; an unreviewed postmortem "might as well never have existed" (SRE book).
- Action items have owners and dates. A postmortem whose actions aren't tracked is a story, not a fix.
- Triggers defined in advance. Decide which incidents get postmortems before they happen, so it's policy, not judgement — Google's list includes user-visible degradation, data loss, on-call intervention, and resolution time over a threshold.
The postmortem template
# Postmortem: <incident title>
Date: <date> | Author: <name> | Status: draft → reviewed → published
Severity: SEV<n> | Duration: <detect→resolve> | Detected by: alert / user / synthetic
## Summary (3 sentences max)
What broke, for whom, for how long, and the one-line root cause.
## Impact
- Users affected: <n / % / which segments>
- Duration of impact: <window>
- Cost: <$ spent, tokens wasted, refunds, credits>
- Data: <any exposure — link the privacy review if any>
## Timeline (UTC, every entry)
HH:MM event — include detection, pages, containment, mitigation,
resolution, and COMMUNICATIONS (who was told what when)
## Root cause
The technical cause AND the systemic causes: missing alert? untested
runbook? no kill switch? eval gap? vendor change unmonitored?
Ask "why" repeatedly — but stop at systemic causes, not "human error".
## What went well / what went poorly
Specific, not generic ("comms was good" → "status page updated every
47 min").
## Action items (each with owner + due date + tracking ticket)
- [ ] <fix the cause> owner: ___ due: ___
- [ ] <add the missing alert> owner: ___ due: ___
- [ ] <update the runbook> owner: ___ due: ___
- [ ] <add the eval case> owner: ___ due: ___
- [ ] <fix the process gap> owner: ___ due: ___LLM-specific contributing factors to hunt for
Generic postmortems find "missing alert" and "no runbook". LLM postmortems should specifically look for:
- Silent quality failures. The system was "up" while answers were wrong — was there any signal that could have caught it sooner (online eval, judge score, user-feedback rate, canary)?
- Unpinned versions. Did a model alias, prompt registry entry, index, or dependency drift underneath a stable-looking deploy? (11C.2 owns the pinning machinery; the postmortem checks it was used.)
- Vendor opacity. Did the provider change something without notice — model weights behind an alias, a deprecation, a pricing change? Is there a scheduled check that would have caught it?
- Data-policy violations. Did data flow somewhere it shouldn't (a fallback provider outside the approved region, a log store without the right retention)? That's a governance finding, not just an incident.
- Prompt-as-code gaps. Was a prompt changed outside the pipeline (a hotfix, a console edit)? The audit trail should make that impossible — if it didn't, that's the finding.
- The eval that didn't exist. Every incident should end with "the eval/regression task that would have caught this" added to the suite (10A.8).
1.8 Incident metrics: MTTR, MTBF and repeat incidents#
You can't improve incident response without measuring it. The core metrics, all computable from a simple incident log:
| Metric | What it measures | Good direction |
|---|---|---|
| MTTD (mean time to detect) | users first affected → your alert fires (needs a started_at filled in after the fact, from the postmortem) |
down — faster detection |
| MTTA (mean time to acknowledge/triage) | alert fires → a human acknowledges and takes it | down |
| MTTR (mean time to resolve) | detect (or start) → service restored | down |
| MTBF (mean time between failures) | one incident's detection → the next incident's detection (the script's definition) | up — fewer incidents |
| Repeat-incident rate | % of incidents that are recurrences — a class with n occurrences contributes n−1 | down — learning is happening |
| Error-budget burn | how fast SLO budget is consumed by incidents | down |
The subtle one for LLM systems is repeat-incident rate: if the same incident class keeps recurring, your postmortem actions aren't landing — the system isn't learning. Track incidents by class (provider outage, cost spike, quality regression...) and watch the distribution shift.
Below is incident_metrics.py — a pure-Python tool that reads an incident log (JSONL, one incident per line) and reports all of these. It's deliberately dependency-free so it can run anywhere, including inside a CI job or a notebook.
# incident_metrics.py — incident metrics from a JSONL log. Stdlib only.
#
# Usage: python3 incident_metrics.py incidents.jsonl
#
# incidents.jsonl — one JSON object per line:
# {"id": "INC-101", "class": "provider_outage", "severity": "SEV2",
# "started_at": "2026-10-14T03:02:00Z", "detected_at": "2026-10-14T03:12:00Z",
# "ack_at": "2026-10-14T03:15:00Z", "resolved_at": "2026-10-14T05:40:00Z"}
#
# Times are ISO-8601 UTC. started_at/detected_at/ack_at/resolved_at are when
# users first felt the impact (known only after the fact: take it from the
# postmortem) / the alert fired / a human acknowledged / service was verified
# restored. started_at is optional: without it MTTD cannot be computed.
# "class" groups recurrences (provider_outage, cost_spike, ...).
# detected_at is optional: incidents without it are counted but excluded
# from MTBF and the span calculation.
import json
import sys
from datetime import datetime, timezone
from collections import Counter, defaultdict
def parse_ts(s: str) -> datetime:
"""Parse an ISO-8601 timestamp (the Z suffix means UTC)."""
return datetime.fromisoformat(s.replace("Z", "+00:00"))
def hours(a: datetime, b: datetime) -> float:
return (b - a).total_seconds() / 3600.0
def load_incidents(path: str) -> list[dict]:
incidents = []
with open(path, encoding="utf-8") as f:
for n, line in enumerate(f, 1):
line = line.strip()
if not line:
continue
try:
incidents.append(json.loads(line))
except json.JSONDecodeError as e:
sys.exit(f"{path}:{n}: invalid JSON: {e}")
return incidents
def durations(inc: dict) -> dict[str, float | None]:
"""Per-incident durations in hours; None when a timestamp is missing."""
out = {}
det = parse_ts(inc["detected_at"]) if inc.get("detected_at") else None
ack = parse_ts(inc["ack_at"]) if inc.get("ack_at") else None
res = parse_ts(inc["resolved_at"]) if inc.get("resolved_at") else None
start = parse_ts(inc["started_at"]) if inc.get("started_at") else None
out["mttd"] = hours(start, det) if start and det else None # impact -> alert
out["mtta"] = hours(det, ack) if det and ack else None # alert -> human
out["mttr"] = hours(det, res) if det and res else None
out["mtbf"] = None # computed across incidents below
return out
def mean(xs: list[float]) -> float:
return sum(xs) / len(xs) if xs else 0.0
def fmt_mean(xs: list[float]) -> str:
"""'0.17 h (n=4)' — or 'N/A (n=0)' when no incident has the data."""
if not xs:
return "N/A (n=0)"
return f"{mean(xs):.2f} h (n={len(xs)})"
def main(path: str) -> None:
incidents = load_incidents(path)
if not incidents:
sys.exit("no incidents found")
# Per-incident durations.
for inc in incidents:
inc["_d"] = durations(inc)
# MTBF needs ordering by detection time; incidents without
# detected_at can't be ordered, so they're excluded (and counted).
timed = sorted((i for i in incidents if i.get("detected_at")),
key=lambda i: i["detected_at"])
untimed = len(incidents) - len(timed)
# MTBF: average gap between consecutive incident detections.
gaps = [hours(parse_ts(p["detected_at"]), parse_ts(c["detected_at"]))
for p, c in zip(timed, timed[1:])]
mtbf = mean(gaps) if gaps else None
# Aggregate.
sev = Counter(i.get("severity", "?") for i in incidents)
classes = Counter(i.get("class", "?") for i in incidents)
mttds = [i["_d"]["mttd"] for i in incidents if i["_d"]["mttd"] is not None]
mttas = [i["_d"]["mtta"] for i in incidents if i["_d"]["mtta"] is not None]
mttrs = [i["_d"]["mttr"] for i in incidents if i["_d"]["mttr"] is not None]
open_incidents = [i for i in incidents if i["_d"]["mttr"] is None]
# Repeat incidents: a class with n occurrences contributes n-1
# recurrences — the first occurrence is the original, not a repeat.
repeats = {c: n for c, n in classes.items() if n > 1}
repeat_count = sum(n - 1 for n in repeats.values())
repeat_rate = repeat_count / len(incidents)
if timed:
first = parse_ts(timed[0]["detected_at"])
last = parse_ts(timed[-1]["detected_at"])
span_days = max(hours(first, last) / 24.0, 1e-9)
print(f"incidents: {len(incidents)} over {span_days:.1f} days "
f"({len(incidents) / span_days:.2f}/day)")
else:
print(f"incidents: {len(incidents)} (no detected_at timestamps)")
if untimed:
print(f"note: {untimed} incident(s) missing detected_at — "
f"excluded from MTBF and span")
print(f"severity: {dict(sorted(sev.items()))}")
print(f"classes: {dict(classes.most_common())}")
print(f"MTTD: {fmt_mean(mttds)} (impact -> alert)")
print(f"MTTA: {fmt_mean(mttas)} (alert -> acknowledged)")
print(f"MTTR: {fmt_mean(mttrs)}")
if mtbf is None:
print("MTBF: N/A (fewer than 2 timestamped incidents)")
else:
print(f"MTBF: {mtbf:.1f} h between detections")
print(f"repeat incidents: {repeat_count}/{len(incidents)} "
f"({repeat_rate:.0%}) in classes {sorted(repeats)}")
if open_incidents:
print(f"OPEN: {len(open_incidents)} incident(s) unresolved")
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("usage: python3 incident_metrics.py incidents.jsonl")
main(sys.argv[1])Sample incidents.jsonl (illustrative — your log will differ):
{"id": "INC-101", "class": "provider_outage", "severity": "SEV2", "started_at": "2026-10-14T03:02:00Z", "detected_at": "2026-10-14T03:12:00Z", "ack_at": "2026-10-14T03:15:00Z", "resolved_at": "2026-10-14T05:40:00Z"}
{"id": "INC-102", "class": "cost_spike", "severity": "SEV2", "started_at": "2026-10-21T13:40:00Z", "detected_at": "2026-10-21T14:02:00Z", "ack_at": "2026-10-21T14:20:00Z", "resolved_at": "2026-10-21T16:05:00Z"}
{"id": "INC-103", "class": "quality_regression", "severity": "SEV3", "started_at": "2026-10-28T09:20:00Z", "detected_at": "2026-10-28T09:44:00Z", "ack_at": "2026-10-28T10:01:00Z", "resolved_at": "2026-10-28T11:30:00Z"}
{"id": "INC-104", "class": "provider_outage", "severity": "SEV2", "started_at": "2026-11-02T22:25:00Z", "detected_at": "2026-11-02T22:31:00Z", "ack_at": "2026-11-02T22:33:00Z", "resolved_at": "2026-11-03T00:10:00Z"}incidents: 4 over 19.8 days (0.20/day)
severity: {'SEV2': 3, 'SEV3': 1}
classes: {'provider_outage': 2, 'cost_spike': 1, 'quality_regression': 1}
MTTD: 0.26 h (n=4) (impact -> alert)
MTTA: 0.17 h (n=4) (alert -> acknowledged)
MTTR: 1.98 h (n=4)
MTBF: 158.4 h between detections
repeat incidents: 1/4 (25%) in classes ['provider_outage']Reading it: the metrics say the process is fast (~2 h MTTR, about 10 minutes from alert to human) and that detection is the slower half (~15 minutes of user impact before an alert fires, a gap that 11A.2's alerting is meant to shrink), but that learning is failing — one in four incidents (25%) is a recurrence of provider_outage. Either the provider keeps having incidents (external, accept it) or the postmortem actions for it never landed (internal, fix it). That distinction is exactly what the class-level breakdown is for. Note the repeat-rate definition: a class with n occurrences contributes n−1 recurrences — the first occurrence is the original, not a repeat — so provider_outage's two incidents count as one repeat. And on a log with a single incident (or missing detected_at timestamps), the script prints N/A rather than a misleading 0.0 h.
1.9 The decision table: the operational choices#
This lesson poses a handful of recurring decisions. Each has a rule of thumb; the sections named have the detail.
| Decision | The options | The rule of thumb | Covered in |
|---|---|---|---|
| Page or ticket? | page the on-call / file a ticket | Page when a user notices within minutes and a human decision is needed now; everything else tickets | 1.2 |
| What severity? | SEV1–SEV4 | Data exposure starts at SEV1 until disproven; "wrong but up" is at least SEV2; cosmetic is SEV4 | 1.4 |
| Contain with what? | kill switch, budget cap, route repin, degraded mode, tool disable, source quarantine | The cheapest reversible action that stops the bleeding — never a hotfix under pressure | 1.5, 1.6 |
| Which degraded mode? | cached answers, smaller model, retrieval-only, human queue, "try later" | Decided per feature at design time and labelled to users — never invented mid-incident | 1.6 |
| How much review for a change? | T0–T4 | Match review depth to blast radius; eval evidence beats prose review of prompts | 2.3 |
| Checklist item status? | done / open / na + note |
Gate items block unless done or na with a reason; track items need an owner and a date |
7.1 |
| Vendor review off-cycle? | scheduled cadence / triggered | Deprecation, price change, new data class, or a vendor incident reopens the vendor file | 2.7 |
| Where's the DR risk? | primary DB, vector index, prompt/eval registry, audit log | The derived stores are the risk — the index rebuild is the long pole; game-day it | 5.3 |
1.10 The failure gallery: how operated systems fail#
The incident runbooks cover failures of the service. This gallery covers failures of the operating machinery itself — the ways day-2 ops quietly rots. Each row is a pattern worth checking for in your own system.
| Failure | What it looks like | Catch it with |
|---|---|---|
| Runbook rot | The 3 a.m. responder finds steps that don't match the dashboards | The Last tested field + tabletop exercises (5.2) |
| Untested kill switch | The flag flip errors, or silently does nothing, in prod | Fire every switch in staging and once in prod deliberately (1.6) |
| Alert fatigue | Pages get ignored; the real page is lost in noise | The page-vs-ticket list (1.2) + quarterly alert hygiene (7.3) |
| Silent degradation | The degraded mode serves weaker answers with no label | Tell the user they're getting reduced service; quality metrics in the SLOs (1.6, 4.2) |
| Postmortem without actions | The same incident class keeps recurring | The repeat-incident rate (1.8); action items with owners and dates (1.7) |
| Inventory drift | The deployed prompt/model isn't in the registry | CI check against ai_inventory.yaml (2.2) |
na without a reason |
A gate item waived with no justification | readiness.py requires a note for na (7.1) |
| Misspelt checklist group | Items silently unscored — a false GO | readiness.py warns on unknown groups and still counts their gate items (7.1) |
| Deletion misses a store | The "deleted" user is still retrievable from a cache, index or trace | The per-store deletion runbook + re-query verification (3.3) |
| Console bypass | Prod prompt differs from the repo | Access control + inventory drift check (2.3, 2.4) |
| Stale vendor file | Terms changed; nobody re-reviewed | The quarterly vendor cadence (2.7) |
| Key-person on-call | Only one engineer knows the runbooks | Rotation sizing, shadowing, searchable postmortems (6.2, 6.3) |
Part 2: Governance and risk management#
2.1 What governance means here#
"Governance" sounds like corporate overhead, but for an LLM system it is concrete and mostly engineering-shaped: knowing what AI systems you run, who may change them, what data they touch, and who answers when something goes wrong. Frameworks like NIST's AI Risk Management Framework (AI RMF, first released January 2023, with a generative-AI profile NIST-AI-600-1 from July 2024, both still the published versions as of November 2026; NIST's own AI RMF page says "The AI RMF 1.0 is being revised as part of the White House AI Action Plan", so check nist.gov before an audit) and ISO/IEC 42001:2023, the AI management system standard (iso.org), give the vocabulary; this part gives the machinery.
The reason LLM systems need explicit governance where a normal web service doesn't:
- The "code" includes natural language. A prompt is behaviour specification written in English — it can be changed by anyone with console access, in ways no diff review catches unless you look. Prompts, model versions and tool definitions are all changeable production artefacts (04.10, 11C.2).
- Data flows to third parties by design. Every request may carry user data to a provider, a gateway, a fallback host and a trace store — the "supply chain" of an LLM feature includes vendors you never signed a contract with directly (02.9, Part 9).
- Outputs have liability. Wrong answers, biased answers, leaked data and harmful content are product defects and potentially legal events. Someone must own the answer to "who approved this behaviour?"
- The inventory is invisible. Models get swapped, prompts get edited in consoles, indexes get rebuilt, evals get skipped — and six months later nobody can say what the system was. Governance starts with knowing what exists.
Governance is not a committee. At this scale it is five mechanisms — inventory, change control, access control, audit, and vendor management — each cheap to run and expensive to lack.
flowchart TB
subgraph gov ["Governance mechanisms"]
INV["1. Inventory<br/>every model, prompt, tool,<br/>index, eval, key — with owner"]
CHG["2. Change control<br/>what needs review/approval<br/>before it ships"]
ACC["3. Access control<br/>who can change prompts, models,<br/>keys, indexes — least privilege"]
AUD["4. Audit<br/>append-only record of who did what,<br/>when, approved by whom"]
VEN["5. Vendor management<br/>DPAs, subprocessors, retention,<br/>regions, exit plans"]
end
gov --> OUT["Answerable questions:<br/>what runs, who changed it,<br/>what data it saw, who approved it"]2.2 The system inventory#
The inventory (or registry, or "AI bill of materials" in the OWASP vocabulary — genai.owasp.org's AI-BOM initiative) is the single source of truth for every AI artefact in production. If you can't list it, you can't govern it, audit it, or answer a regulator's question.
What goes in the inventory
| Artefact | Example entries | Why it's inventoried |
|---|---|---|
| Models | gpt-6-luna via OpenAI API; claude-haiku-5-5 via Anthropic; self-hosted Qwen3-32B on vLLM |
Deprecation tracking, data policy, cost, eval results per model |
| Prompt versions | support_triage v14 (prod), v15 (staging) |
Every behaviour change traces to a version; rollback target |
| Tools/functions | issue_refund, search_kb, send_email |
Risk tiers, permissions, side-effects — the agent's "API surface" |
| Indexes/stores | docs_kb_v3 vector index; tickets Postgres |
Data classification, freshness, deletion coverage |
| Eval suites | support_agent_v2 evalset + thresholds |
Release criteria, regression evidence |
| Keys/secrets | provider keys per environment, rotation dates | Least privilege, rotation cadence, leak response |
| Routes/config | which model serves which feature, budgets | The "wiring diagram" an incident responder needs |
| Data flows | which user data goes to which provider/region | Privacy review, residency compliance, vendor scope |
A registry schema
The inventory should be data, not a wiki page — a table or YAML file in the repo (or a small service) that code and reviews can read. Minimum fields per entry:
# ai_inventory.yaml — one entry per AI artefact (excerpt)
- id: support-triage-prompt
type: prompt # model | prompt | tool | index | eval | key | route | dataflow
name: support_triage
version: "14" # pinned, not "latest"
owner: team-support # the accountable human/team
purpose: "Classify and route inbound support tickets"
provider: openai # or anthropic | gemini | openrouter | self-hosted
model_id: gpt-6-luna # exact snapshot, not alias
data_classes: [ticket_text, account_id] # what user data it touches
regions: [us] # where inference/data processing happens
eval_suite: support_triage_eval
eval_gate: "pass_rate >= 0.92"
approved_by: j.doe # who signed off (2.3)
approved_at: "2026-10-28"
status: production # development | staging | production | deprecated
deprecation_watch: false
runbook: runbooks/quality_regression.mdThis schema answers the audit questions directly: what data does it touch (data_classes), where does it go (provider, regions), is it allowed (approved_by, status), what proves it's good (eval_suite, eval_gate), who fixes it (owner, runbook).
2.3 Change management and approvals#
Not every change needs a committee — that would strangle the team. Change management for LLM systems is risk-tiered: match the review depth to the blast radius.
The change tiers
| Tier | Examples | Review required |
|---|---|---|
| T0 — no review | typo fix in an internal doc, dependency patch that doesn't touch model paths | normal PR review |
| T1 — peer review | prompt wording tweak within the same eval gate; new eval case; runbook edit | one reviewer + eval gate pass |
| T2 — owner + eval gate | new prompt version to production; model version bump; new tool added (read-only); index rebuild | feature owner approval + full eval suite + canary plan |
| T3 — named approver + evidence | new provider or region (data-policy change); model swap affecting a regulated feature; new data class flowing to a vendor; autonomy-tier increase for an agent; price-affecting routing change | named approver (eng lead + product + privacy if data classes change) + eval evidence + rollback plan |
| T4 — change board | new vendor relationship; self-hosted model in production; feature handling regulated data (health/finance/PII at scale); anything the contracts team hasn't seen | scheduled review with security/legal/privacy |
The eval gate is what makes this workable: a T2 prompt change isn't "reviewed by a human who reads English prompts" — it's evaluated against the suite (10A.8, 11C.2). The human approves the evidence, not just the diff. That's faster and better than prose review.
What change management must cover that code review doesn't
- Console changes. Someone edits the prompt in the provider's playground or a prompt registry UI, bypassing the repo. Either forbid it technically (access control, 2.4) or detect it (inventory drift check — the deployed version doesn't match the registry).
- Model alias drift.
gpt-6-lunamay point at a new snapshot tomorrow; your "no change" deploy silently changed behaviour. Pin snapshots for anything in the inventory (02.9, Part 8) and treat an alias bump as a T2 change. - Vendor-side changes. Deprecation notices, price changes, policy changes arrive by email/webhook, not PR. The vendor-management process (2.7) owns watching for them; change management owns acting on them.
- Emergency changes. Incidents need fast changes — define the expedited path (incident commander approves, postmortem reviews it after) so people don't route around the process under pressure. A process that can't handle emergencies gets bypassed entirely.
2.4 Access control and separation of duties#
Who can change what is a security and a governance question. The principle is least privilege per artefact type, and the separation that matters most for LLM systems:
| Capability | Who should have it | Who should NOT |
|---|---|---|
| Deploy prompt versions | engineers on the feature team, via the pipeline | anyone with console access bypassing the pipeline |
| Change model routes / provider config | team lead or on-call lead | individual contributors unsupervised |
| Rotate provider keys | on-call + secret owner, via secret manager | everyone (keys live in the manager, not in .env on laptops) |
| Edit the eval suite / thresholds | eval owner + one reviewer | the person whose change the eval gates (self-grading conflict) |
| Change data-retention settings | privacy owner + eng | anyone unilaterally |
| Approve T3/T4 changes | named approver per the tier table | the author of the change |
| View production traces containing user data | on-call, support with cause, privacy team | broad engineering access by default |
Three separations deserve emphasis:
- Author ≠ approver. The person who wrote the prompt/model change cannot be its only approver — same as code review, extended to AI artefacts. This is separation of duties, and it's the cheapest governance control there is.
- Pipeline ≠ console. Production AI artefacts change through the deploy pipeline (which runs evals and writes audit events), not through provider dashboards. Console access is for reading state and declaring incidents, not for editing behaviour. If the console must be editable (break-glass), its use is an audit event and triggers a postmortem review.
- Eval author ≠ evaluated author. Whoever changes the eval thresholds or suite that gates their own change has a conflict — the suite can be "fixed" to pass. Threshold changes are T3 changes with a second reviewer.
2.5 Audit logs#
An audit log answers "who did what, when, and who approved it" after the fact — for incidents, compliance reviews, and access audits. For LLM systems the audit surface is wider than code:
| Event | Must be logged |
|---|---|
| Prompt/model/index deploys | who, what version, which eval evidence, who approved |
| Route/config changes (model swaps, budgets, flags) | who, old→new value, timestamp |
| Key issuance, rotation, revocation | who, which key (ID, not value), scope |
| Access to production traces/user data | who queried what, when, why (where feasible) |
| Kill-switch/flag flips | who, which flag, old→new, reason |
| Vendor-side changes you acted on | deprecation notice received, decision, migration PR |
| Retention/deletion jobs run | what was deleted, when, covering which stores |
Two properties make an audit log an audit log rather than a debug log:
- Append-only and tamper-evident. Ship audit events to write-once storage (object lock, append-only tables, or a service like a managed audit log) — not a mutable DB row anyone with write access can edit. 08A.14, 7.4 makes this point for agent action logs; the same standard applies to system changes.
- Complete for the questions asked. You don't need to log every request (that's tracing, 11A.1) — you need every change and every access to sensitive data. Completeness on changes, not on traffic.
The audit log is also the evidence layer for governance reviews: "show me who approved the model swap that caused the regression" should be a query, not an archaeology project.
2.6 Data classification and handling#
Before you can govern data, classify it. For an LLM system the data classes that matter:
| Class | Examples | Handling rules |
|---|---|---|
| Public | marketing copy, public docs, published content | anything goes |
| Internal | code, internal wikis, non-personal business data | approved providers OK; still prefer no-training tiers |
| Personal (PII) | names, emails, user IDs, conversation content | minimisation before the model; approved providers/regions only; retention limits; deletion on request |
| Sensitive/regulated | health, finance, government IDs, children's data | ZDR or self-hosted; BAA/DPA; region pinning; encryption; the strictest vendor tier |
| Secrets | API keys, credentials, tokens | never in prompts, logs, traces, or evals — full stop |
The classification drives everything downstream: which providers a feature may use (02.9, Part 9), which regions, which retention, which vendors need DPAs, and which features need the heavier change tiers. A feature that handles "personal" data cannot fall back to a provider whose terms allow training on inputs — the fallback chain must respect data policy (11C.3 covers the technical side; governance covers the rule).
Practical output: every inventory entry (2.2) declares its data_classes, and every feature has a one-line data classification in its docs. When in doubt, classify up — over-classifying costs a bit of flexibility; under-classifying is a breach.
2.7 Vendor management: DPAs, subprocessors and exit plans#
Your LLM system's vendors are part of its attack and privacy surface. The major providers' data policies are compared in 02.9, Part 9; this section is the operational process around them.
The vendor file
For each provider, gateway, and subprocessors they use, keep a vendor file containing:
| Item | What to record |
|---|---|
| Contract | DPA (data processing agreement) signed? Enterprise agreement? BAA if health data? Key terms: training use, retention, liability |
| Certifications | SOC 2 Type II, ISO 27001 — report availability and date reviewed (you request reports; you don't assume them) |
| Subprocessors | Who else touches the data downstream (the provider's vendors, the gateway's hosts, cloud regions) — OpenRouter's downstream-provider problem is the canonical example (02.9, 9.3) |
| Data posture | training-on-inputs? retention period? ZDR availability and eligibility? which features are excluded? regions? |
| SLA | what the provider actually promises (usually little for model quality; availability terms vary — verify per contract) |
| Exit plan | how you'd leave: data export, model portability, transition time, cost of switching |
| Review cadence | when you last reviewed, next review date, what triggers an off-cycle review |
The review cadence
- At onboarding: full review before any production data flows — DPA, subprocessors, data posture, exit plan.
- Quarterly or per contract cycle: re-check the data page (policies change — the Gemini API's paid/unpaid split and Anthropic's Covered-Model retention rules are examples of policy that shifted), the subprocessors list, and the pricing page.
- On trigger: a deprecation notice, a price change, a new feature you want to use, a security incident at the vendor, or a new data class entering the system — any of these reopens the review.
- Annually at minimum: the whole vendor portfolio, because the cheapest vendor risk is the one you forgot you had.
Exit plans
Vendor lock-in for LLM features is real but bounded: prompts are text, models have alternatives, and the provider-agnostic client (03.11) exists precisely so the exit isn't a rewrite. The exit plan answers three questions per vendor:
- Data: can you export/delete your data (conversations, files, fine-tunes, eval data stored with them)? In what format, within what window?
- Capability: which features would you lose — a fine-tuned model you can't take with you, a proprietary tool, a region you can't replicate? What's the migration path for each?
- Time/cost: how long to switch routes for real traffic, and what does dual-running cost during transition?
You don't need a rehearsed exit for every vendor — you need the plan for the ones holding critical or regulated data, and a multi-provider routing strategy (11B.5, 11C.3) so no single vendor's outage or terms-change is existential.
2.8 Contracts, IP and compliance awareness#
A short list of non-privacy legal surfaces that land on the AI engineer's desk — overview level, with "check with legal" as the standing advice (02.9, 9.6 covers the details):
- Output-use restrictions. Major API providers' terms typically forbid using outputs to develop competing models — material if you distil or fine-tune on generated data (13A.8). Open-weight licences vary; check each.
- IP/copyright indemnity. Several providers offer business customers indemnity against copyright claims on generated output, with conditions (don't disable safety features, etc.). It's a real procurement criterion — verify current terms per plan.
- Regulation. The EU AI Act's timeline moved in 2026, so check dates rather than remembering them. As of November 2026: the general-purpose-AI obligations have applied since 2 August 2025; the Article 50 transparency duties (telling people they are talking to an AI, marking synthetic content) apply from 2 August 2026, with providers of generative systems already on the market before that date given until 2 December 2026 to meet the Article 50(2) marking requirement; and the "Digital Omnibus" amendment (Regulation (EU) 2026/1744, in force 27 July 2026) pushed the high-risk obligations to 2 December 2027 for the Annex III use cases (such as recruitment, credit scoring and education) and 2 August 2028 for AI embedded in products regulated under Annex I (sources: the AI Act explorer's Digital Omnibus page and Gibson Dunn's summary, both opened 8 November 2026). Which duties fall on you as a deployer versus the model provider depends on your use case; sector rules (health, finance) and GDPR apply on top. Module 12 owns the compliance treatment. Your compliance team may need documentation from providers — the inventory's
data_classesand the vendor files are what you hand them. - Country availability. Providers publish supported-country lists; check every market you serve and every country your team operates from.
None of this is legal advice — it's the checklist of questions to route to the right owner before launch, which is exactly what the launch review (7.2) is for.
Part 3: Data lifecycle operations#
Deep-dive
3.1 The data an LLM system accumulates#
An LLM feature doesn't just process data — it stores copies of it in places classic services don't. Before governing retention and deletion, enumerate every store:
flowchart TB
subgraph stores ["Where LLM data lives"]
direction TB
REQ["Request/response logs<br/>(app logs, access logs)"]
TRC["Traces & spans<br/>(prompts, outputs, metadata — 11A.1)"]
FB["User feedback<br/>(thumbs, comments, corrections)"]
EV["Eval datasets<br/>(frozen cases, sometimes from prod)"]
VC["Vector index<br/>(chunks + embeddings — 05/06/07)"]
CH["Caches<br/>(exact + semantic responses — 11B.3)"]
PR["Prompt registry<br/>(versions, maybe few-shot examples)"]
BK["Backups<br/>(DB, index snapshots, log archives)"]
PV["Provider-side storage<br/>(stored responses, files, fine-tunes,<br/>abuse logs — per provider terms)"]
endEach store has different sensitivity, retention needs and deletion mechanics. The classic failure is deleting from the primary store and forgetting the copies — the trace store still has the prompt, the cache still serves the answer, the eval dataset still contains the user's question, the vector index still has their document chunk.
3.2 Retention schedules#
A retention schedule says how long each data class lives in each store, and why. The schedule is a policy document — usually a table reviewed by privacy/legal — that engineering implements per store.
Designing the schedule
Start from the principle: keep the minimum, for the minimum time, for a stated purpose. For each store × data class:
| Store | Typical retention | Driver |
|---|---|---|
| Request/response logs | days–weeks | debugging; access-controlled; PII-safe by default (03.10) |
| Traces/spans | 30–90 days typical | debugging + eval sampling; content capture opt-in (11A.1) |
| User feedback | life of feature + dispute window | product improvement; may contain user text |
| Eval datasets | indefinite if scrubbed; never raw prod PII | regression evidence (10A.2) |
| Vector index | until source deleted + reindex lag | mirrors source-of-truth retention |
| Caches | minutes–hours (TTL-bound) | correctness; PII in cache is a leak waiting (11B.3) |
| Prompt registry | indefinite | it's code, not user data |
| Backups | backup-window bound (days–weeks) | DR; deletion propagates on backup expiry |
| Provider-side | per provider terms (30-day abuse logs, ZDR=none, stored responses until deleted) | contract, not your choice (02.9, 9.2) |
Two LLM-specific wrinkles:
- Traces are the highest-risk store. They contain prompts and outputs — the user's actual words — plus metadata. Treat trace content capture as opt-in/sampled (11A.1), give traces the shortest retention that debugging needs, and remember they're a data store for deletion purposes.
- Eval datasets freeze user data. A production failure becomes an eval case (08A.14, 4.7) — scrub the PII before freezing, or the "test data" becomes an unmanaged PII store with indefinite retention.
Implementing retention
Retention isn't a document — it's jobs: TTLs on caches and trace stores, scheduled deletion jobs for logs/indexes/feedback, backup expiry policies, and a periodic review that the jobs actually ran (a retention job that silently failed is a compliance incident). Where a store can't enforce TTLs natively (some vector DBs, some log vendors), the schedule must name the mechanism — a cron job, a lifecycle policy, a vendor setting — and the owner who checks it.
3.3 Deletion and erasure across every store#
A user's deletion request (GDPR erasure, CCPA delete, contract exit) must propagate to every store in 3.1. The deletion runbook:
Deletion request runbook
1. Identify the user: which IDs link them across stores? (user_id,
hashed IDs in traces — 03.2 pseudonymous IDs may need the hash key
to reverse; session IDs; tenant membership)
2. Enumerate affected stores from the data map (3.1): app DB, trace
store, feedback, eval datasets (if their case was frozen), vector
index (their chunks), caches (their keys), backups (expiry window),
provider-side (request deletion per provider process).
3. Delete or anonymise per store, respecting each store's mechanics:
hard delete vs tombstone vs crypto-shred (delete the key).
4. Provider-side: invoke their deletion API/process; record the
request ID and their stated completion window.
5. Backups: can't selectively delete — document that backups expire
on schedule and the data dies with them; verify the window is the
one policy promised.
6. Verify: re-run the lookup across stores; confirm zero residual hits.
7. Log the deletion as an audit event (2.5): who requested, what was
deleted, when, verification result.The hard parts, honestly:
- Hashes aren't anonymous. Pseudonymous user IDs (03.2) let you find a user's traces — which means you must also be able to delete by them, and the hash key is itself a deletion-relevant secret.
- Vector stores and caches are stores. A user's document chunks live in the index; their answers live in caches keyed by their queries. Deletion must cover them or the "deleted" user's data still answers queries.
- Provider-side is outside your delete button. Stored responses, files and fine-tunes on a provider need their deletion process; abuse-monitoring logs may be retained regardless (per their terms — that's why the vendor file records it).
- Backups lag reality. You cannot selectively delete from backups; the honest answer is "deleted from live systems now; purged from backups on the backup-expiry schedule" — which is why backup windows belong in the retention schedule.
3.4 Residency, consent and access reviews#
Three lighter-weight lifecycle duties:
- Residency. If user data must stay in a region (GDPR, data-sovereignty contracts, sector rules), every store in 3.1 needs a region answer — including the processing region, not just storage (02.9, 9.2 shows which providers offer regional processing and which don't). Moving regions later is painful; pick before launch.
- Consent. If the product uses conversation data for training/fine-tuning/evals, consent and terms must cover it — and opting out must actually propagate to the stores and vendors. Most teams' LLM features don't train on user data at all (the API defaults don't), which is itself a governance decision to record.
- Access reviews. Periodically (quarterly is typical) re-verify who can access production traces, the vector index, the eval datasets and the vendor consoles — access accumulates as people change roles. The review output is an audit event; the input is your access-control table (2.4).
3.5 Privacy impact assessments#
A privacy impact assessment (PIA/DPIA — data protection impact assessment under GDPR Art. 35) is a structured review of a feature's privacy risks before launch. For an LLM feature the assessment asks: what personal data enters, where does it go (every vendor in the chain), how long is it kept, who can see it, what are the risks (leakage, inference, memorisation — 02.10), and what mitigations exist.
You don't need to be the privacy lawyer — you need to produce the artefact they review: the data-flow map (3.1), the vendor file (2.7), the retention schedule (3.2), and the inventory's data_classes. Features handling sensitive data should have a PIA on file before launch; it's a T4-tier change (2.3).
Part 4: Cost and quality governance#
Deep-dive
4.1 Cost governance: budgets, allocation and forecasting#
Cost governance is what keeps "the bill" from becoming an incident. The machinery from 11B.1 (budgets, quotas, attribution) and 11A.2 (cost alerts) needs an owner and a cadence:
| Mechanism | What it does | Cadence |
|---|---|---|
| Budgets & hard caps | per-feature/tenant/model spend limits that stop spend, not just alert | continuous |
| Allocation/showback | attribute cost to features/teams for chargeback or showback | monthly |
| Unit economics review | cost per request/resolution/user over time — is the feature economically viable? | monthly/quarterly |
| Price monitoring | provider price changes, new cheaper models, contract renewals | per vendor review (2.7) |
| Forecasting | project next period's spend from usage growth | monthly |
| Approval for expensive models | a T3-tier change: routing to a premium model needs an owner sign-off with the cost delta | per change |
The governance questions cost reviews answer: Is spend growing faster than usage justifies? Which feature is the cost driver? Did a price change or a routing change cause the step? Is the expensive model earning its premium on the eval frontier? (11B.5 covers the routing economics; governance owns the review.)
A useful habit: every cost anomaly that pages (1.5.3) should end with either a budget fix, an attribution fix, or an accepted-risk note — so the same anomaly doesn't page twice.
4.2 Quality governance: eval ownership and release criteria#
Quality governance is the answer to "who decides the answers are good enough?" — and for LLM systems the answer is evals plus humans, owned explicitly.
The roles
| Role | Owns |
|---|---|
| Eval owner (per feature) | the eval suite, thresholds, dataset quality, judge calibration (10A.5) |
| Release approver | signs off that eval evidence meets the release criteria for a change |
| Human reviewers | periodic review of real outputs — evals sample; humans catch what metrics miss |
| Feedback owner | user-feedback triage: complaints → eval cases → fixes (10A.9) |
Release criteria
Each feature declares, in its inventory entry, what "good enough to ship" means — typically: eval suite pass rate ≥ threshold, no regression vs baseline beyond a margin, safety suite passes, cost/latency within budget, canary plan defined. The eval gate enforces it mechanically (10A.8, 11C.2); governance owns setting and reviewing the criteria, and reviewing exceptions.
The operating cadence
- Continuous: online evals and drift signals (10A.9) feed dashboards; thresholds page when breached.
- Per release: eval evidence attached to the change (the pipeline does this — 11C.2).
- Weekly/biweekly: human review session — sample real production outputs (scrubbed), look for failure patterns evals miss, check the feedback queue.
- Monthly/quarterly: drift review — eval scores over time, new model releases vs your pinned versions, judge calibration drift, dataset staleness (is the eval set still representative of real traffic?).
- On model-update notice: vendor model changes trigger a scheduled re-evaluation — the "silent model update" problem (11C.3, 02.9, Part 8).
Complaints and feedback
User complaints are quality data, not just support tickets. The loop: complaint → triage (real failure vs expectation mismatch vs abuse) → if real, becomes an eval case → tracked to fix. The complaint-handling SLA and the "this becomes an eval case" rule should be written down — it's how production failures become permanent regression guards (08A.14, 4.7).
4.3 Documentation duties#
Governance produces documents that outlive any individual:
- System cards / model cards. For each major feature: what it does, what models it uses, known limitations, intended use, out-of-scope uses. Provider model cards exist (02.9, Part 7); your system card is the product-level version — and it's what you show users, auditors and your own future self.
- User-facing limitation notices. Where outputs can be wrong (most LLM features), the product says so — in the UI, the terms, or the response itself. Module 13A owns the UX patterns; governance owns requiring the notice exists for features where wrong answers matter.
- Runbooks (1.5), SLO doc (11A.2), inventory (2.2), vendor files (2.7), retention schedule (3.2), postmortems (1.7). Each has an owner and a review date; documentation without an owner is archaeology.
Part 5: Reliability engineering practices#
Deep-dive
5.1 SLO reviews and error-budget policy#
SLOs aren't set-and-forget. The reliability calendar includes:
- SLO definition review (quarterly/half-yearly): are the SLIs still the right ones? Did the feature change shape (new modality, new tenant tier) such that the SLO no longer measures what users feel?
- Error-budget policy: the pre-agreed rule for what happens when the budget burns — e.g., "if the monthly error budget is >50% consumed by day 15, freeze non-critical releases" or "exhausted budget → incident review + reliability work takes priority over features". The policy is decided in advance so it's not negotiated mid-incident. 11A.2 covers SLO mechanics; governance owns the policy and the review.
- SLO report: a periodic (monthly) reliability review per service — budget remaining, incidents, MTTR trend, top incident classes — attended by eng + product. This is where "are we reliable enough?" gets answered with data.
5.2 Game days, chaos drills and tabletop exercises#
Reliability is a practice, not a state. Two drill formats:
- Tabletop exercise: a facilitated discussion — "it's 3 a.m., the provider is down, walk me through it." Use a realistic scenario (below), follow the actual runbooks, find the gaps. Cheap, safe, and shockingly effective at exposing missing runbooks and unclear roles. Run one per quarter per critical feature; log it in the runbook's "last tested" field.
- Game day / chaos drill: actually break something in a controlled environment — inject a provider timeout, a 429 storm, malformed responses, a slow first token (11C.3 owns the fault-injection machinery). Verify the alerts fire, the runbook works, the kill switch flips. The difference from a real incident: you planned it, so the learning is clean.
Tabletop scenario library (write your own; these are starters):
- Provider outage mid-launch: primary provider down during a marketing-driven traffic spike; fallback at 30% capacity.
- Prompt regression discovered by a customer: a user reports the bot gives wrong advice; evals are green.
- Runaway agent: an agent is issuing refunds autonomously; finance notices the pattern before engineering does.
- PII in traces: a privacy reviewer finds user emails in a trace store that was supposed to be redacted.
- Leaked key in CI logs: a provider key appears in a public CI artifact; unknown dwell time.
- Silent model update: answers degraded for a week; nobody noticed because error rates were fine.
- Vendor price change: provider doubles prices on your main model with 30 days' notice.
- Region loss: your primary cloud region is unavailable; index and service must fail over.
5.3 Disaster recovery: RPO and RTO#
Disaster recovery (DR) plans for losing infrastructure — a provider region, a cloud account, the vector database, or (worst case) a vendor. Two numbers define it:
- RPO (Recovery Point Objective): how much data loss is acceptable — how far back you can restore from. For an LLM service: the index/vector store, the prompt registry, the eval datasets, the audit log. Conversation history and traces are usually not RPO-critical (they're observability, not source-of-truth) — decide explicitly.
- RTO (Recovery Time Objective): how long to restore service. For LLM features the binding constraint is often the index rebuild time (re-embedding a corpus can take hours) and provider failover — the model itself is someone else's problem unless you self-host (11C.6).
The DR plan per store:
| Store | Backup mechanism | RPO | RTO driver |
|---|---|---|---|
| Primary DB (users, configs) | managed backups/PITR | minutes–hours | restore time |
| Vector index | snapshot or rebuild-from-source | source data's RPO; index is derived | re-embed time — the long pole |
| Prompt/eval registry | git (it's code) | zero — versioned | redeploy time |
| Audit log | append-only store w/ replication | zero-ish — never lose audit | replication lag |
| Traces/feedback | object storage lifecycle | best-effort | not user-critical |
| Provider-side | n/a — their problem; your exit plan covers leaving | per contract | migration time |
The insight for LLM systems: the derived stores are the risk. Your source documents live in systems you already back up; the index is a rebuildable derivative — but only if the rebuild pipeline is tested. An untested index-rebuild is a DR plan on paper. Game-day it: deliberately rebuild the index from source and time it — that number is your RTO for retrieval.
5.4 Dependency inventory and upgrade cadence#
Your LLM service's dependency tree is wider than a normal app's: provider SDKs (openai, anthropic, google-genai), the provider-agnostic layer (03.11), gateways/proxies (LiteLLM, Portkey — supply-chain risk is real: the March 2026 LiteLLM compromise is the canonical example, 03.11, 13.9), eval tooling, observability SDKs, and the model providers themselves (a "dependency" you can't pin).
The operating cadence:
- Inventory:
pip list/lockfile is the machine-readable inventory; the reviewed inventory notes which deps touch model paths, which are pinned, which are floating. - Pin everything: exact versions + lockfile with hashes (03.1, 03.11, 13.9). Floating ranges are how a malicious or breaking release reaches prod.
- Upgrade cadence: scheduled (monthly/quarterly) review of updates — not ad-hoc "latest". Each upgrade is a change with eval evidence if it touches model paths (11C.2 owns the CI mechanics).
- Security advisories: subscribe to provider/dependency security feeds; a critical advisory on a model-path dependency is an incident-class event, not a backlog item.
- Deprecation calendar: provider model deprecations, API version sunsets, SDK breaking changes — tracked per vendor file (2.7); a deprecation with no owner is an incident scheduled for a date.
5.5 Capacity reviews#
Periodic (monthly/quarterly) capacity planning for LLM services differs from classic capacity because the unit is tokens and concurrency, not just RPS:
- Concurrency vs rate limits: your provider tier's RPM/TPM limits vs expected peak concurrency — streaming connections hold slots for seconds-to-minutes (11A.2 covers load testing).
- Token throughput: output tokens/second sustained — does your concurrency plan fit the provider's tier, or do you need batching/priority tiers (03.9)?
- Cost capacity: the budget at projected growth — does next quarter's forecast fit the budget, and what's the plan if it doesn't (cheaper models, caching, self-host break-even — 11B.1, 11C.6)?
- Headroom: N+1 on critical paths — if your primary provider is at 80% of its rate limit at peak, a modest traffic growth becomes an outage.
Part 6: Team, process and maturity#
Deep-dive
6.1 Roles and ownership#
LLMOps fails when everyone owns it and nobody does. Minimum viable ownership:
| Role | Owns |
|---|---|
| Feature owner (per LLM feature) | the feature end-to-end: quality, cost, its runbooks, its eval suite, its inventory entries |
| LLM service owner / on-call lead | the shared service: routing, fallbacks, provider relationships, cross-feature incidents |
| Eval owner | eval infrastructure, judge calibration, suite quality (10.x) |
| Data/index owner | ingestion pipelines, vector indexes, freshness, deletion coverage (05.x, 06.x, 07.x) |
| Security/privacy owner | threat model, access reviews, PIA sign-off, incident escalation for data events (Module 12) |
| Vendor/procurement contact | contracts, DPAs, renewals, vendor reviews (2.7) |
| Product/support liaison | user-facing comms, complaint intake, limitation notices |
Small teams collapse roles — one person wears several hats — but each hat should still be named in the inventory/runbooks, because "everyone's responsible" means no one's accountable when it matters.
6.2 On-call rotation design#
An on-call rotation for an LLM service needs the classic machinery plus LLM-specific readiness:
- Rotation size: enough people that weekends/holidays don't burn people out — typically 4–8 for a small team; too small and on-call becomes a retention problem, too large and nobody builds the system knowledge to be effective.
- Handoff: a written handoff at rotation change — open incidents, pending changes, known-flaky alerts, vendor issues in flight. The handoff is a document, not a verbal "it's fine".
- Escalation path: on-call → service owner → eng lead → exec (for SEV1). Written down, with contact info, tested by actually calling it once.
- Compensation/recognition: on-call is work; acknowledge it in reviews and pay where the org does.
- LLM-specific readiness: the on-call engineer needs dashboards they can read at 3 a.m. (which quality metrics matter?), runbooks they can follow blind, and the authority to flip kill switches without waiting for approval — pre-authorised containment, decided in advance.
Below, oncall.py generates a weekly rotation and checks its coverage — a small piece of the machinery, pure Python.
# oncall.py — weekly on-call rotation generator + coverage check. Stdlib only.
#
# Usage: python3 oncall.py --people "ada,grace,linus,margaret" --weeks 4
#
# Generates ISO-week rotations: each person covers one week, cycling in
# the order given. Then checks that every week has exactly one primary
# and that consecutive weeks have no gaps or overlaps.
import argparse
from datetime import date, timedelta
def iso_weeks(start: date, n: int) -> list[tuple[str, date, date]]:
"""Return (label, monday, sunday) for n consecutive ISO weeks from start."""
monday = start - timedelta(days=start.weekday())
out = []
for i in range(n):
wk_monday = monday + timedelta(weeks=i)
wk_sunday = wk_monday + timedelta(days=6)
iso = wk_monday.isocalendar()
out.append((f"{iso.year}-W{iso.week:02d}", wk_monday, wk_sunday))
return out
def build_rotation(people: list[str], n_weeks: int,
start: date | None = None) -> list[tuple[str, str, date, date]]:
"""Assign one primary per week, round-robin over `people`."""
if not people:
raise ValueError("at least one person required")
start = start or date.today()
weeks = iso_weeks(start, n_weeks)
return [(label, people[i % len(people)], mon, sun)
for i, (label, mon, sun) in enumerate(weeks)]
def coverage_check(rotation: list[tuple[str, str, date, date]]) -> list[str]:
"""Return problems: weeks without exactly one primary, or date gaps."""
problems = []
if not rotation:
return ["empty rotation"]
# Exactly one primary per week label.
per_week: dict[str, list[str]] = {}
for label, person, _, _ in rotation:
per_week.setdefault(label, []).append(person)
for label, ps in per_week.items():
if len(ps) != 1:
problems.append(f"{label}: {len(ps)} primaries {ps}")
# No gaps between consecutive weeks (each sunday + 1 day == next monday).
ordered = sorted(rotation, key=lambda r: r[2])
for (_, _, _, sun), (_, _, nmon, _) in zip(ordered, ordered[1:]):
if nmon != sun + timedelta(days=1):
problems.append("gap or overlap between consecutive weeks")
return problems
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--people", required=True,
help="comma-separated names in rotation order")
ap.add_argument("--weeks", type=int, default=4)
ap.add_argument("--start", help="YYYY-MM-DD (default: today)")
args = ap.parse_args()
people = [p.strip() for p in args.people.split(",") if p.strip()]
start = date.fromisoformat(args.start) if args.start else None
rotation = build_rotation(people, args.weeks, start)
print(f"{'week':<10} {'primary':<12} {'monday':<12} {'sunday':<12}")
print("-" * 48)
for label, person, mon, sun in rotation:
print(f"{label:<10} {person:<12} {mon.isoformat():<12} {sun.isoformat():<12}")
problems = coverage_check(rotation)
if problems:
print("\ncoverage problems:")
for p in problems:
print(f" - {p}")
else:
print(f"\ncoverage OK: {len(rotation)} weeks, "
f"{len(people)} people, no gaps or double-bookings")
if __name__ == "__main__":
main()$ python3 oncall.py --people "ada,grace,linus,margaret" --weeks 4 --start 2026-11-09week primary monday sunday
------------------------------------------------
2026-W46 ada 2026-11-09 2026-11-15
2026-W47 grace 2026-11-16 2026-11-22
2026-W48 linus 2026-11-23 2026-11-29
2026-W49 margaret 2026-11-30 2026-12-06
coverage OK: 4 weeks, 4 people, no gaps or double-bookings6.3 Documentation standards and onboarding#
The documentation set an LLM service needs (each owned per 6.1):
- Service README: architecture, how to run locally, env vars, links to dashboards/runbooks.
- Runbooks per incident class (1.5).
- SLO doc with SLIs, targets, error-budget policy (11A.2).
- Inventory (2.2) and vendor files (2.7).
- Retention schedule and data map (3.1, 3.2).
- Postmortem archive — searchable, so "has this happened before?" is a query.
Onboarding an engineer to an LLM service should include: shadowing a real incident or tabletop, walking the runbooks, seeing a trace end-to-end, knowing where the kill switches are and firing one in staging, and understanding the data-classification rules before touching production data. The goal: a new on-call engineer can handle a provider outage on day one of their rotation.
Knowledge sharing is what keeps the documentation honest and the team capable — documentation that nobody reads is the same as no documentation:
- Incident reviews as teaching forums. Postmortem review meetings aren't just for the people involved — invite the wider team (and rotate attendance). The LLM-specific failure modes (silent quality regressions, alias drift, cost bleed) are exactly the things people can't learn from a runbook; hearing how a real incident unfolded is the fastest way to build the judgement the runbooks can't encode.
- Pairing and shadowing in on-call. New on-call engineers shadow the first few pages of a rotation — not to take over, but to watch severity calls, containment choices and comms decisions being made live. Reverse-shadowing works too: the experienced on-call narrates their reasoning during a quiet week.
- Runbook co-ownership. Every runbook has two owners, not one — the primary who was there for the last incident, and a secondary who reviews it quarterly. Co-ownership spreads the "only Alice knows the cost-spike drill" failure mode (1.10) and gives the secondary a reason to actually read it.
- Internal tech talks on LLM incidents. A monthly or quarterly slot where someone walks through a postmortem, a near-miss, or a tabletop finding — especially the ones that were close calls. These are cheaper than incidents and teach the same lessons; a "we almost had a PII leak because the trace store wasn't in the deletion runbook" story changes behaviour faster than any policy document.
6.4 The LLMOps maturity model#
Teams mature through recognisable stages. A useful four-level model for self-assessment:
flowchart LR
L0["Level 0: Ad-hoc<br/>prompt in a notebook,<br/>no observability, hero-driven"] --> L1["Level 1: Monitored<br/>tracing, basic alerts,<br/>documented prompts"]
L1 --> L2["Level 2: Measured<br/>SLOs, evals in CI,<br/>runbooks, on-call"]
L2 --> L3["Level 3: Governed<br/>inventory, change control,<br/>vendor mgmt, DR tested"]
L3 --> L4["Level 4: Optimised<br/>cost/quality frontier managed,<br/>maturity reviewed, learning loops"]| Level | Characteristics | Typical gaps to next level |
|---|---|---|
| 0 — Ad-hoc | Works on a laptop; no tracing; prompts in chat history; "it broke? restart it" | observability, version control, anyone-can-change-anything |
| 1 — Monitored | Traces/metrics/logs exist; alerts on errors; prompts versioned | no evals, no SLOs, no runbooks, incidents are heroics |
| 2 — Measured | SLOs + error budgets; eval gates in CI; runbooks written; on-call rotation; postmortems happen | governance informal, vendor/data lifecycle unmanaged, DR untested |
| 3 — Governed | Inventory + change tiers; access control; audit log; vendor files + retention schedule; DR game days; tabletop exercises | cost/quality actively optimised; maturity itself reviewed |
| 4 — Optimised | cost-quality frontier managed deliberately; routing/caching tuned on data; learning loops (incident→eval→fix) institutionalised; regular maturity reviews | — (this is the target; maintain it) |
The maturity model's use: honest self-assessment per dimension (observability, evals, reliability, governance, cost, data lifecycle, team), not a single score. A team can be Level 3 on reliability and Level 1 on governance — the model shows where the gap is. Re-assess quarterly; the goal isn't Level 4 everywhere day one, it's knowing where you are and closing the gap that hurts most.
Part 7: The production-readiness checklist and launch review#
7.1 The production-readiness checklist#
The checklist is the launch gate: a one-page, grouped list where every item must be done (not "planned") before a feature serves real users. It consolidates everything in this module — each item links to the lesson that owns the detail. Items are marked [gate] (must pass to launch) or [track] (must have an owner and a date, may complete shortly after).
PRODUCTION-READINESS CHECKLIST — <feature name> — <date> — <reviewer>
Legend: [x] done [ ] not done [N/A] not applicable (with reason)
PRODUCT & UX
[ ] User-facing limitation notice where outputs can mislead [gate]
[ ] Degraded-mode UX defined and labelled [gate]
[ ] Feedback mechanism (thumbs/comments) wired to eval pipeline [track]
[ ] Human-handoff path for failures the model can't handle [gate]
EVALUATION
[ ] Eval suite exists, covers happy path + known failure modes [gate]
[ ] Release criteria defined (pass thresholds, regression margin) [gate]
[ ] Eval evidence attached to this release [gate]
[ ] Online evals / drift signals wired to dashboards [track]
SAFETY & SECURITY (Module 12 owns detail)
[ ] Threat model reviewed; injection surface assessed [gate]
[ ] Guardrails/policy layer in place for agent features [gate]
[ ] Security review or pentest-equivalent for high-risk features [track]
[ ] Secrets in secret manager; no keys in code/images/logs [gate]
PRIVACY & COMPLIANCE
[ ] Data classification declared per feature [gate]
[ ] Vendor file complete: DPA, subprocessors, retention, regions [gate]
[ ] Retention schedule covers all stores (logs, traces, caches,
index, evals, backups, provider-side) [gate]
[ ] Deletion runbook tested or tabletop-exercised [track]
[ ] PIA/DPIA completed if handling sensitive data [gate]
[ ] Residency requirements met for all stores + processing [gate]
OBSERVABILITY (11A.1, 11A.2, 11A.3 own detail)
[ ] Tracing on all model calls with trace IDs [gate]
[ ] Traces use OpenTelemetry GenAI conventions (11A.1) [track]
[ ] Latency SLOs set per step and end to end, with alerts (11A.3) [gate]
[ ] Dashboards: health, latency, cost, quality per feature [gate]
[ ] Alerts defined for the "what pages you" list (1.2) [gate]
[ ] Synthetic probes / canaries scheduled [track]
[ ] Request IDs captured for vendor support tickets [track]
RELIABILITY (11C.3, 11C.1 own detail)
[ ] Timeouts, retries (bounded), fallbacks configured [gate]
[ ] Kill switches exist AND tested for every feature flag [gate]
[ ] Degraded modes implemented and documented [gate]
[ ] Load test done at expected concurrency [track]
[ ] DR: RPO/RTO defined; index rebuild timed [track]
COST (11B.1, 11B.6, 11B.7 own detail)
[ ] Budgets + hard caps set per feature/tenant [gate]
[ ] Quotas and rate limits per team/tenant configured (11B.6/7) [gate]
[ ] Spend alerts wired; cost kill switch exists and tested (11B.7) [gate]
[ ] Cost attribution working (cost per request visible) [gate]
[ ] Forecast fits budget at projected growth [gate]
[ ] Cheaper-model/fallback path evaluated [track]
DEPLOYMENT & RELEASE (11C.1, 11C.2, 11C.5 own detail)
[ ] Deploy pipeline with eval gate green [gate]
[ ] Rollback plan tested (prompt + code + index) [gate]
[ ] Feature flags for risky changes [gate]
[ ] Model versions pinned (snapshots, not drifting aliases) [gate]
[ ] Deprecation calendar: retirement dates, owners, deadlines [gate]
OPERATIONS (this lesson, 14A.6, 14A.7 own detail)
[ ] Runbooks written for the feature's incident classes [gate]
[ ] On-call rotation staffed; escalation path tested [gate]
[ ] Inventory entries complete with owners [gate]
[ ] Agent inventory entry has risk class and autonomy class (14A.6) [gate]
[ ] Standards mapping reviewed: NIST AI RMF, ISO/IEC 42001 (12.9, 14A.7) [track]
[ ] Audit logging on for changes + sensitive-data access [gate]
[ ] Postmortem template + archive ready [track]
[ ] Tabletop exercise scheduled within 30 days of launch [track]
DOCUMENTATION
[ ] Service README current [gate]
[ ] SLO doc published [track]
[ ] System card / limitation notes written [track]
[ ] Vendor files current [gate]The newer items point to lessons that were added after this checklist was first drawn up. Each one links to the lesson that owns the detail:
- Quotas, rate limits, spend alerts and a kill switch: 11B.6, Part 1: the budget model and 11B.6, Part 4: where to enforce for quotas; 11B.7, Part 1 for rate limits; 11B.7, Part 4: kill switches and Part 5: spend alerts.
- OpenTelemetry tracing and latency SLOs: 11A.1, Part 3: OpenTelemetry for GenAI and 11A.3, Part 4: dashboards, alerts and SLOs for agents (latency percentiles are in Part 1).
- Deprecation calendar: 11C.5, Part 2: models get retired, plan the switch and the registry in Part 5.
- Agent inventory, risk and autonomy class: 14A.6, Part 1: the agent inventory and Part 2: risk and autonomy classification.
- NIST AI RMF and ISO/IEC 42001 awareness: 12.9, 6.8 to 6.11 (start at 6.8; 6.11 maps your controls to a framework) and 14A.7, Part 4.
The sample checklist.json below stays a shortened set, so its output does not change when you add these items.
Below, readiness.py scores a filled-in checklist — the same checklist as JSON — and produces the launch-gate verdict. It's the kind of script you could wire into CI or a launch-review tool.
# readiness.py — score a production-readiness checklist. Stdlib only.
#
# Usage: python3 readiness.py checklist.json
#
# checklist.json — a list of items:
# [{"group": "OBSERVABILITY", "item": "Tracing on all model calls",
# "status": "done", "gate": true, "note": ""}, ...]
# status: "done" | "open" | "na" gate: true = blocks launch unless the
# item is "done", or "na" WITH a non-empty "note" giving the reason.
# "na" is a claim ("this doesn't apply to us") — a claim needs evidence,
# so an "na" with no note blocks exactly like "open".
import json
import sys
from collections import defaultdict
ORDER = ["PRODUCT & UX", "EVALUATION", "SAFETY & SECURITY",
"PRIVACY & COMPLIANCE", "OBSERVABILITY", "RELIABILITY",
"COST", "DEPLOYMENT & RELEASE", "OPERATIONS", "DOCUMENTATION"]
def load(path: str) -> list[dict]:
with open(path, encoding="utf-8") as f:
return json.load(f)
def gate_satisfied(it: dict) -> bool:
"""A gate item passes when done, or na with a written reason."""
if it.get("status") == "done":
return True
return it.get("status") == "na" and bool(it.get("note"))
def score(items: list[dict]) -> dict:
by_group: dict[str, dict] = defaultdict(
lambda: {"done": 0, "open": 0, "na": 0, "gate_open": []})
for it in items:
g = by_group[it["group"]]
status = it["status"]
g[status if status in ("done", "open", "na") else "open"] += 1
if it.get("gate") and not gate_satisfied(it):
g["gate_open"].append(it["item"])
return by_group
def ordered_groups(by_group: dict) -> list[str]:
"""Known groups in checklist order, then unknown groups sorted."""
return ORDER + sorted(set(by_group) - set(ORDER))
def verdict(by_group: dict) -> tuple[bool, list[str]]:
"""Launch is GO only if no gate item is open anywhere — including in
groups the checklist doesn't know about. A misspelled group is a
silent hole, so unknown groups still count toward the verdict."""
blockers = []
for group in ordered_groups(by_group):
for item in by_group[group]["gate_open"]:
blockers.append(f"[{group}] {item}")
return (not blockers), blockers
def main(path: str) -> None:
items = load(path)
if not items:
sys.exit("checklist is empty")
by_group = score(items)
groups = ordered_groups(by_group)
unknown = set(by_group) - set(ORDER)
print(f"{'group':<24} {'done':>5} {'open':>5} {'n/a':>4} gate-open")
print("-" * 70)
total_done = total_open = total_na = 0
for group in groups:
g = by_group[group]
n_gate = len(g["gate_open"])
marker = " ?" if group in unknown else ""
print(f"{group:<24} {g['done']:>5} {g['open']:>5} {g['na']:>4} "
f"{n_gate if n_gate else '-'}{marker}")
total_done += g["done"]; total_open += g["open"]; total_na += g["na"]
if unknown:
print(f"\nwarning: unknown group(s) {sorted(unknown)} — not in the "
f"standard checklist; check spelling. Their items still "
f"count toward the verdict.")
go, blockers = verdict(by_group)
total = total_done + total_open + total_na
print("-" * 70)
print(f"{'TOTAL':<24} {total_done:>5} {total_open:>5} {total_na:>4}")
print(f"\nitems: {total} gate items open: {len(blockers)}")
if go:
print("\nVERDICT: GO — all gate items satisfied")
else:
print("\nVERDICT: NO-GO — gate items still open:")
for b in blockers:
print(f" - {b}")
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit("usage: python3 readiness.py checklist.json")
main(sys.argv[1])Sample checklist.json (a shortened but representative set — illustrative):
[
{"group": "PRODUCT & UX", "item": "User-facing limitation notice", "status": "done", "gate": true},
{"group": "PRODUCT & UX", "item": "Human-handoff path", "status": "done", "gate": true},
{"group": "EVALUATION", "item": "Eval suite exists", "status": "done", "gate": true},
{"group": "EVALUATION", "item": "Release criteria defined", "status": "done", "gate": true},
{"group": "EVALUATION", "item": "Online evals wired", "status": "open", "gate": false},
{"group": "SAFETY & SECURITY", "item": "Threat model reviewed", "status": "done", "gate": true},
{"group": "SAFETY & SECURITY", "item": "Secrets in secret manager", "status": "done", "gate": true},
{"group": "SAFETY & SECURITY", "item": "Agent guardrails/policy layer", "status": "na", "gate": true},
{"group": "PRIVACY & COMPLIANCE", "item": "Vendor file complete", "status": "done", "gate": true},
{"group": "PRIVACY & COMPLIANCE", "item": "Retention schedule covers all stores", "status": "open", "gate": true},
{"group": "PRIVACY & COMPLIANCE", "item": "PIA completed", "status": "na", "gate": true, "note": "PIA not required — feature handles no personal data"},
{"group": "OBSERVABILITY", "item": "Tracing on all model calls", "status": "done", "gate": true},
{"group": "OBSERVABILITY", "item": "Alerts defined", "status": "done", "gate": true},
{"group": "RELIABILITY", "item": "Timeouts/retries/fallbacks", "status": "done", "gate": true},
{"group": "RELIABILITY", "item": "Kill switches tested", "status": "open", "gate": true},
{"group": "RELIABILITY", "item": "Load test done", "status": "open", "gate": false},
{"group": "COST", "item": "Budgets + hard caps", "status": "done", "gate": true},
{"group": "DEPLOYMENT & RELEASE", "item": "Eval gate green", "status": "done", "gate": true},
{"group": "DEPLOYMENT & RELEASE", "item": "Model versions pinned", "status": "done", "gate": true},
{"group": "OPERATIONS", "item": "Runbooks written", "status": "done", "gate": true},
{"group": "OPERATIONS", "item": "On-call staffed", "status": "done", "gate": true},
{"group": "OPERATIONS", "item": "Tabletop scheduled", "status": "open", "gate": false},
{"group": "DOCUMENTATION", "item": "Service README", "status": "done", "gate": true},
{"group": "DOCUMENTATION", "item": "SLO doc", "status": "open", "gate": false}
]group done open n/a gate-open
----------------------------------------------------------------------
PRODUCT & UX 2 0 0 -
EVALUATION 2 1 0 -
SAFETY & SECURITY 2 0 1 1
PRIVACY & COMPLIANCE 1 1 1 1
OBSERVABILITY 2 0 0 -
RELIABILITY 1 2 0 1
COST 1 0 0 -
DEPLOYMENT & RELEASE 2 0 0 -
OPERATIONS 2 1 0 -
DOCUMENTATION 1 1 0 -
----------------------------------------------------------------------
TOTAL 16 6 2
items: 24 gate items open: 3
VERDICT: NO-GO — gate items still open:
- [SAFETY & SECURITY] Agent guardrails/policy layer
- [PRIVACY & COMPLIANCE] Retention schedule covers all stores
- [RELIABILITY] Kill switches testedRead the three gate-open rows carefully — they demonstrate the rule. Retention schedule covers all stores and Kill switches tested are open: not done, so they block. Agent guardrails/policy layer is na without a note — and it blocks too, because "not applicable" is a claim that needs evidence. PIA completed, by contrast, is na with a note ("PIA not required — feature handles no personal data") and does not count against the verdict. The verdict is deliberately binary: a gate item passes only when it is done, or na with a written reason in the note field; an na with an empty note blocks exactly like open. Track items can lag launch by a defined window (e.g., 30 days), gate items cannot. And a misspelled group can't smuggle items past the gate — groups outside the checklist's ORDER are printed with a ?, counted, and their gate items still block the verdict.
7.2 The launch review#
The launch review is the meeting where the checklist gets walked and the go/no-go is decided — Google's SRE book has a whole chapter on launch coordination (Reliable Product Launches) and its checklist philosophy applies directly. The book's two curation rules for its launch checklist: "Every question's importance must be substantiated, ideally by a previous launch disaster," and "Every instruction must be concrete, practical, and reasonable for developers to accomplish." For an LLM service the "previous launch disaster" is usually a postmortem — the checklist item exists because something broke before.
The launch review template
LAUNCH REVIEW — <feature> — <date> — <attendees>
Required: feature owner, on-call rep, eval owner, security/privacy rep,
product owner. Optional: vendor contact, support lead.
1. WHAT IS LAUNCHING
Feature summary, target users, launch date, rollback criteria.
2. CHECKLIST WALKTHROUGH
Walk the production-readiness checklist (7.1) item by item.
Every [gate] must be done; every [track] needs owner + date.
Disagreements get resolved in the room, not deferred.
3. RISK REVIEW
Top 3 ways this launch fails. For each: likelihood, impact,
mitigation in place, detection if it fails.
(Use the runbook classes in 1.5 as prompts.)
4. ROLLBACK CRITERIA
Define NOW, in metrics: "we roll back if eval score < X, error rate
> Y, cost/request > Z, or safety trigger rate > W." Vague rollback
criteria become "we'll know it when we see it" — which is never.
5. COMMUNICATION PLAN
Who tells users/support what, when; status-page ownership during
launch window; on-call coverage for launch + 48h after.
6. VENDOR/CONTRACT CHECK
Confirm vendor file current; any new vendor/subprocessor flagged;
data-classification sign-off for privacy rep.
7. GO / NO-GO + CONDITIONS
Decision, conditions attached ("GO if track item X done by date Y"),
and who owns watching each condition.The review's output isn't just a decision — it's the record that the decision was informed: checklist state, risks acknowledged, rollback criteria committed, owners named. That record is what a postmortem or audit asks for later.
7.3 The operating cadence after launch#
Launch isn't the end of governance — it's when the operating rhythm starts:
| Cadence | Meeting/artefact | Purpose |
|---|---|---|
| Daily/weekly | on-call handoff, incident review, alert hygiene | keep the response sharp; prune noisy alerts |
| Weekly | cost review (spend vs budget, anomalies), quality spot-check (sample outputs, feedback queue) | catch drift early |
| Monthly | SLO/error-budget review, capacity review, dependency/upgrade review, vendor price check | reliability + cost + supply chain |
| Quarterly | maturity self-assessment, access review, retention-schedule review, tabletop exercise, DR game day, postmortem-action audit | the governance heartbeat |
| Per trigger | vendor notice, model deprecation, security advisory, incident, contract renewal | off-cycle reviews |
The quarterly maturity review (6.4) closes the loop: where are we now, what gap hurts most, what's next quarter's governance investment? Governance that never reviews itself becomes the paperwork it was meant to prevent.
Part 8: Module wrap-up — the consolidated llm_service#
Reference
llm_service#8.1 The consolidated llm_service package#
The module's running project is one deployable unit — a llm-service repository built across the lessons. The package is flat (no app/ subpackage), provider_agnostic is a top-level package (not under client/), and the CI/eval assets live at repo level beside the service.
llm-service/ # the module's running project
├── pyproject.toml # uv-managed deps: fastapi, uvicorn,
│ # pydantic-settings, openai, anthropic,
│ # google-genai, httpx, tenacity, ...
├── .env.example # provider key placeholders — never commit .env
├── Dockerfile # multi-stage uv build, non-root, pinned base — 11C.1
├── compose.yaml # local dev stack — 11C.1
├── nginx/llm_service.conf # SSE-safe reverse proxy (buffering off) — 11C.1
│
├── llm_service/ # the FastAPI service package (flat layout — 11C.1)
│ ├── settings.py # pydantic-settings: env config, model aliases — 11C.1
│ ├── schemas.py # public API request/response models — 11C.1
│ ├── deps.py # client wiring, auth, limits — 11C.1
│ ├── errors.py # LLMError → HTTP mapping — 11C.1
│ ├── serialize.py # provider_agnostic types → API schemas — 11C.1
│ ├── jobs.py # accept-and-poll background jobs — 11C.1
│ ├── logging.py # request IDs + JSON logs — 11C.1
│ ├── main.py # app factory + routes (/healthz, /readyz,
│ │ # /v1/chat, /v1/chat/stream, /v1/jobs,
│ │ # /v1/jobs/{job_id}, /metrics)
│ │ # + metrics middleware — 11C.1, wired by 11A.2
│ ├── telemetry.py # OTel GenAI tracing facade — 11A.1
│ ├── tracekit.py # dependency-free JSONL trace core — 11A.1
│ ├── pipeline.py # traced pipeline stages — 11A.1
│ ├── trace_view.py # trace debugging CLI — 11A.1
│ ├── demo.py # sample-trace generator — 11A.1
│ ├── metrics.py # metrics catalogue + backend-agnostic facade — 11A.2
│ ├── metrics_prometheus.py # Prometheus backend — 11A.2
│ ├── metrics_hook.py # provider_agnostic hook → metrics — 11A.2
│ ├── otel_metrics.py # OTel metrics path — 11A.2
│ ├── cache.py # exact + semantic cache, single-flight — 11B.3
│ ├── economics.py # cost & latency model — 11B.1
│ ├── budget.py # token-bucket quotas, per-tenant budgets,
│ │ # hedged requests — 11B.1
│ ├── waste_report.py # trace-JSONL waste analyser — 11B.1
│ ├── router.py # rules, cascade, canary splits, decision log — 11B.5
│ ├── router_eval.py # offline router evaluator — 11B.5
│ ├── resilience.py # breakers, bulkheads, fallback chains,
│ │ # shared rate limiter, deadlines — 11C.3
│ ├── stream_fallback.py # fallback for streaming calls (stdlib) — 11C.3
│ └── demo_router.py demo_allowlist.py # 11B.5 demos, saved beside router.py
│ economics_demo.py hedge_demo.py quota_demo.py buildvsbuy_demo.py make_fixture.py
│ # 11B.1 driver scripts, saved beside economics.py/budget.py
│ demo_stream.py # 11C.3 streaming-fallback demo, beside stream_fallback.py
│
├── slo_calc.py cost_anomaly.py probe.py provider_health.py locustfile.py # 11A.2 stdlib tools
├── cache_economics.py # 11B.3 calculator (stdlib)
├── test_resilience_attacks.py # 11C.3 attack tests (unittest); run beside llm_service/
├── gpu_sizing.py breakeven.py fake_server.py bench_openai_compatible.py # 11C.6 (stdlib)
├── prepare_dataset.py ftecon.py fteval.py # 13A.8 (stdlib)
│ # the standalone calculators and demos: none is imported by
│ # the service, each runs with plain python3
│
├── provider_agnostic/ # the 03.11 client package — a TOP-LEVEL
│ ├── __init__.py # package copied in beside llm_service:
│ ├── types.py # canonical types, error hierarchy,
│ ├── errors.py # registry + models.yaml (aliases,
│ ├── registry.py # capabilities, limits; models.local.yaml
│ ├── models.yaml # is the local stand-in copy), schemas,
│ ├── models.local.yaml # per-provider adapters/,
│ ├── schemas.py # LLMClient (retries, timeouts,
│ ├── client.py # deadline, fallback, hooks),
│ ├── hooks.py # hooks + redactor + cost,
│ ├── redact.py # refresh.py — all 03.11
│ ├── cost.py
│ ├── refresh.py
│ └── adapters/ # base, openai_responses, openai_chat,
│ # anthropic_messages, gemini_generate,
│ # gemini_interactions — 03.11
├── cost_calc.py prices.py prices.yaml llm_errors.py retry_after.py check_response.py
│ # the six top-level files provider_agnostic borrows
│ # from 03.7/03.8 (11C.1 Setup; not needed with the wheel)
│
├── tests/test_app.py # fake-client suite, no keys — 11C.1
├── tests/test_chaos.py # chaos suite for resilience.py — 11C.3
│
├── ops/ # THE DAY-2 ARTEFACTS (this lesson)
│ ├── runbooks/ # the nine incident-class runbooks (1.5)
│ ├── ai_inventory.yaml # the system inventory (2.2)
│ ├── vendor_files/ # per-vendor DPA/subprocessor/exit file (2.7)
│ ├── retention_schedule.yaml # data lifecycle policy (3.2)
│ ├── slo.md # SLOs + error-budget policy (11A.2)
│ ├── readiness_checklist.json # the launch gate (7.1)
│ ├── postmortems/ # blameless postmortem archive (1.7)
│ └── maturity.md # LLMOps maturity assessment (6.4)
│
└── scripts/ # repo-level tooling (CI + ops)
├── eval_gate.py # CI eval-gate decision — 11C.2
├── check_model_deprecations.py # model lifecycle/deprecation checks — 11C.2
├── diff_prompts.py # prompt diff for reviewers — 11C.2
├── severity.py # this lesson — severity classifier
├── incident_metrics.py # this lesson — incident stats
├── oncall.py # this lesson — rotation + coverage
└── readiness.py # this lesson — checklist scorerThree honest caveats about the consolidated picture:
- CI/eval assets live beside the service, not inside it. 11C.2 built its pipeline in a
release-gateslayout —.github/workflows/{ci,eval,release,nightly}.ymlplus.gitlab-ci.yml,gates/*.yamlthreshold configs,release/models.json,fixtures/and theevalkitpackage inherited from Module 10A. In a merged repo they sit at the top level next tollm_service/; the service itself doesn't import them. - 11C.6 and 13A.8 ship standalone calculators, not service modules.
gpu_sizing.py,breakeven.py,bench_openai_compatible.py(11C.6) andprepare_dataset.py,ftecon.py,fteval.py(13A.8) are decision tooling that live outsidellm_service— they analyse economics, hardware sizing and fine-tuning datasets rather than serving requests. - The metrics wiring lives in
main.py. 11A.2's metrics-wiring excerpt is headedllm_service/main.py, the same file as 11C.1's composition root. In the finished packagemain.pyhosts the metrics middleware, so put 11A.2's wiring insidecreate_app().
The ops/ directory is this lesson's contribution: the runbooks, inventory, vendor files, retention schedule, SLO doc, readiness checklist, postmortem archive and maturity assessment are the operating system for everything the other lessons built. Code without ops/ is a demo; ops/ without the code is paperwork. The service is the union.
8.2 The module's artefacts#
What a team finishing this module actually has:
| Artefact | Lesson | What it gives you |
|---|---|---|
| Traced, metered service | 11A.1, 11A.2 | you can see what the system does and whether it's healthy |
| Cost/latency-optimised paths | 11B.3, 11B.1 | the feature is affordable and fast |
| Routed, resilient calls | 11B.5, 11C.3 | provider failures don't take you down |
| Serving options | 11C.6 | the build-vs-buy decision is yours to make |
| Decision discipline | 13A.8 | you know when NOT to fine-tune |
| Deployable, CI-gated service | 11C.1, 11C.2 | changes ship safely with evidence |
| Operated system | 11C.4 (this lesson) | runbooks, governance, data lifecycle, launch gate — it survives contact with production |
8.3 Where next: Modules 12–14#
- Module 12: Safety & Security goes deep on what this lesson pointed at: prompt-injection defences, jailbreaks, PII protection, guardrails, output validation, and securing tools and agents. The governance and incident machinery here is the container; Module 12 fills in the security content.
- Modules 13A and 13B: Product Engineering and Capstones covers the product side: AI UX patterns, the capstone project, and taking an LLM feature from prototype to product — where the readiness checklist and launch review get their first real use.
- Module 14B: Career Appendix translates the skills into career capital: portfolio projects, interview prep, and how to talk about production LLM systems.
What this means for you#
If you take one thing from this lesson, take this: an LLM feature isn't done when it works — it's done when the team can run it at 3 a.m. without you. That means runbooks someone else can follow, kill switches they've actually flipped, an inventory that answers "what changed and who approved it", a deletion path that reaches every store, budgets that cap the blast radius of a loop, and a launch gate that says no when the evidence isn't there. None of it is exotic — it's the same operational discipline as any production service, specialised for the ways LLM systems fail: quietly, expensively, and sometimes wrong but up. The maturity model (6.4) exists so you can be honest about where you are; the checklist (7.1) exists so "ready" is a claim with evidence, not a feeling. Start with the five mechanisms of 1.9 and the failure gallery of 1.10 — they're the cheapest insurance in the whole module.
Common misconceptions#
| Misconception | Reality |
|---|---|
| "Monitoring and alerting is enough; incidents will tell us what's wrong." | LLM systems fail quietly — wrong answers, silent quality drift, cost creep. You need quality metrics, runbooks and drills, not just error alerts (1.2, 4.2). |
| "On-call for an LLM service is the same as for a web service." | The pager set differs: quality regressions, cost anomalies and safety incidents page alongside outages; "wrong but up" is a severity, not a non-event (1.2, 1.4). |
| "During an incident, fix the root cause first." | Contain first — the bleeding may be money or data exposure, not downtime. Containment is flags/caps/routes, never a hotfix under pressure (1.3, 1.6). |
| "A kill switch you haven't tested works." | A switch you've never flipped is a hypothesis. Test every flag in staging and once in prod deliberately (1.6, 08A.14). |
| "Blameless postmortems mean no accountability." | Blameless means systems, not people: find the missing alert, runbook or eval — not the human who lacked them. Accountability lives in the action items (1.7). |
| "Governance is a committee that slows things down." | At this scale it's five mechanisms — inventory, change tiers, access control, audit, vendor files — that make the system answerable, and they're cheap to run (2.1). |
| "If it's in the repo, it's governed." | Prompts get edited in consoles, models drift behind aliases, vendors change terms unilaterally. Governance covers the changes that never touch your git history (2.3). |
| "Deleting a user from the database deletes their data." | LLM systems copy data into traces, caches, indexes, eval sets, backups and provider-side stores. Deletion is a per-store runbook (3.3). |
| "The vendor's 'zero retention' covers everything." | Retention promises are per-endpoint and per-feature; files, batch, stored responses and abuse logs often differ. Read the feature small print (02.9, 9.2, 2.7). |
| "SOC 2 certified means the vendor is secure." | It's a report over defined controls with exceptions, not a badge. The LLM-specific terms (training, retention, ZDR) live in the DPA, not the certification (2.7). |
| "A checklist is paperwork; real teams just ship." | The checklist is the evidence that the launch was informed — and the thing a postmortem or audit asks for. Google's launch-checklist guidance: every item must be concrete and actionable (7.2). |
| "Once it passes the checklist, governance is done." | Launch starts the operating cadence: weekly cost/quality reviews, monthly SLO/vendor/dependency reviews, quarterly maturity/access/DR reviews (7.3). |
| "You need a big team to do LLMOps properly." | The mechanisms scale down: one person can hold several hats if each is named; the maturity model meets you where you are (6.1, 6.4). |
Key takeaways#
- Day-2 ops is five jobs: detect/respond (on-call, runbooks, incidents, postmortems), govern (inventory, change control, access, audit, vendors), manage data (retention, deletion, residency), govern cost and quality (budgets, evals, reviews), and engineer reliability (SLOs, drills, DR, dependencies).
- The incident lifecycle is contain-first: detect → triage → contain → mitigate → resolve → communicate → postmortem. For LLM systems, containment is flags/caps/routes — never a hotfix under pressure — and "resolved" means quality metrics recovered, not just error rates.
- Write runbooks for the nine incident classes (provider outage, rate limits, cost spike, quality regression, retrieval failure, injection, PII leak, runaway agent, leaked key) in a shared skeleton; test them; they're the system's operational memory.
- Governance = five mechanisms: the inventory (what exists, who owns it), risk-tiered change control (T0–T4), least-privilege access with separation of duties, append-only audit logs, and vendor files with DPAs/subprocessors/exit plans.
- Data lifecycle is per-store: enumerate every place LLM data lives (logs, traces, feedback, evals, index, caches, registry, backups, provider-side), set retention per store, and run deletion as a cross-store runbook — hashes aren't anonymous and backups expire on schedule.
- Cost and quality governance are cadences, not events: budgets with hard caps, unit-economics reviews, eval ownership, release criteria, drift reviews, and complaint→eval-case loops.
- Reliability is practised: SLO/error-budget reviews, tabletop exercises and game days, DR with tested RPO/RTO (the index rebuild is the long pole), dependency pinning and upgrade cadence, capacity reviews in tokens-and-concurrency.
- Name the hats even on a small team — feature owner, eval owner, data owner, security, vendor contact — and size the on-call rotation so coverage is verifiable.
- The launch gate is the readiness checklist + launch review: gate items block, track items need owners and dates; rollback criteria are defined in metrics before launch; the operating cadence starts the day after.
- The module's output is
llm_service+ops/: the code built across ten lessons plus this lesson's runbooks, inventory, vendor files, retention schedule, SLO doc, checklist, postmortems and maturity assessment — a system that survives contact with production.
Terms introduced in this lesson#
| Term | One-line definition |
|---|---|
| Day-2 operations | The discipline of running a service after launch: on-call, incidents, governance, data lifecycle and reliability reviews |
| Runbook | A step-by-step operational procedure for a recurring task or incident class, written to be followed under pressure |
| On-call / on-call rotation | The engineer currently responsible for a service outside business hours, and the schedule that hands that responsibility around |
| Incident lifecycle | The phases of incident response: detect, triage, contain, mitigate, resolve, communicate, postmortem |
| Severity matrix (SEV1–SEV4) | The agreed classification of incidents by user/data/cost impact, driving response speed and escalation |
| Incident commander | The role owning the incident response, delegating all other roles and keeping the living incident document |
| Containment | Stopping the damage before diagnosing it — for LLM services, flags, caps, routes and degraded modes |
| Degraded mode | A designed lesser-functionality path that keeps a feature useful when the full path fails |
| Kill switch | An external control, outside the code path it disables, that instantly turns a feature off or reverts it |
| Blameless postmortem | A written incident record focused on systemic causes, not individual blame, ending in tracked action items |
| MTTD / MTTA / MTTR / MTBF | Mean time to detect (impact → alert) / to acknowledge (alert → human) / to resolve (alert → restored) / between failures — the core incident metrics |
| Repeat-incident rate | The share of incidents that are recurrences of a known class — a measure of whether learning is working |
| System inventory / AI-BOM | The registry of every model, prompt, tool, index, eval, key and data flow in production, with owners |
| Change tiers (T0–T4) | Risk-graded change management: review depth matched to blast radius, from no review to change board |
| Separation of duties | The rule that the author of a change cannot be its only approver, extended to AI artefacts |
| Audit log | An append-only, tamper-evident record of who changed what and who accessed sensitive data |
| Data classification | The labelling of data by sensitivity (public → secrets) that drives provider, region, retention and vendor decisions |
| Vendor file | The per-vendor record of contract, certifications, subprocessors, data posture, SLA and exit plan |
| Subprocessor | A third party that touches your data downstream of a vendor — part of the compliance chain |
| Retention schedule | The policy table saying how long each data class lives in each store, and why |
| Erasure/deletion runbook | The cross-store procedure for honouring a user's data-deletion request |
| Privacy impact assessment (PIA/DPIA) | A structured pre-launch review of a feature's privacy risks and mitigations |
| Unit economics review | The recurring check of cost per request/resolution/user to confirm a feature is economically viable |
| Release criteria | The declared, measurable bar (eval pass rates, regression margins, safety) a change must meet to ship |
| Error-budget policy | The pre-agreed rule for what happens when an SLO's error budget burns at a given rate |
| Game day / chaos drill | A planned exercise that breaks something in a controlled environment to verify response machinery |
| Tabletop exercise | A facilitated walkthrough of an incident scenario against the actual runbooks, to find gaps |
| RPO / RTO | Recovery Point Objective (acceptable data loss) and Recovery Time Objective (acceptable restore time) |
| Dependency inventory | The reviewed list of libraries, SDKs, gateways and providers with pinning and upgrade policy |
| LLMOps maturity model | A staged self-assessment (levels 0–4) of how operationalised an LLM practice is |
| Production-readiness checklist | The grouped launch-gate list of must-done and must-track items across all operational domains |
| Launch review | The go/no-go meeting that walks the checklist, reviews risks, and commits rollback criteria |
| Operating cadence | The recurring schedule of reviews (weekly → quarterly) that keeps governance alive after launch |
All terms are also collected in the glossary.
Exercises#
-
Write a runbook (1.5). Pick one incident class from the nine and write its runbook for your project (the Module 07 RAG app or the Module 08A agent). Fill every field of the skeleton — trigger, severity, owner, the eight steps. Where do your dashboards, flags and kill switches actually live? Note every place you had to write "check with the team" — those are the runbook gaps.
-
Tabletop exercise (5.2). Run scenario 2 or 6 from the library with a colleague (or alone, timed). Follow your runbook literally. Record: where did you get stuck, what information was missing, which step was ambiguous? Feed the findings back into the runbook and log the exercise date.
-
Fill the readiness checklist (7.1). Take the checklist JSON structure from
readiness.py's sample and fill it honestly for a real feature you've built. Runpython3 readiness.py checklist.json. Which gate items are open? For each, decide: is it genuinely not-done, or is the checklist wrong for your context (marknawith a reason)? -
Compute your incident metrics (1.8). Create an
incidents.jsonlfor the last quarter of your project's real incidents (or fabricate plausible ones for practice). Runincident_metrics.py. What's your MTTR, and what's your repeat-incident rate? Which class repeats, and did its postmortem action items land? -
Design the inventory (2.2). Write
ai_inventory.yamlentries for every AI artefact in one of your projects: each prompt, model, tool, index, eval suite and key. Which entries are missing fields — owner, data_classes, eval_gate? What's the first thing you'd enforce in CI? -
Vendor file (2.7). For one provider you use, fill the vendor file: contract status, certifications you've actually seen, subprocessors, data posture, SLA, exit plan. What's the exit plan for your most critical vendor — can you actually leave in 30 days?
-
Retention schedule (3.2). List every store your project writes user data to (logs, traces, caches, index, backups, provider-side). For each, write the retention period and the mechanism that enforces it. Which stores have no enforcement today?
-
On-call rotation (6.2). Run
oncall.pyfor your team (or a pretend team). Check the coverage output. Then answer: what's the handoff document for the next rotation? Who do you escalate to at 3 a.m., and have you tested calling them? -
Severity classifier (1.4). Write three
incident.jsonfiles — one SEV1, one SEV3, one borderline — and runseverity.pyon each. Where does the classifier's suggestion diverge from your judgement? What signal is missing that a human would use? -
Postmortem (1.7). Write a postmortem for a real or imagined incident using the template. Specifically hunt the LLM contributing factors: was there a silent quality failure, an unpinned version, a vendor opacity issue, a data-policy violation, a prompt changed outside the pipeline, or an eval that didn't exist?
-
Maturity assessment (6.4). Score your current project on each maturity dimension (observability, evals, reliability, governance, cost, data lifecycle, team). Which level are you really at — and what's the single highest-leverage move to the next level?
Hints and worked checks for the exercises
- A good runbook names exact dashboards, flag names and commands. If you wrote "check with the team" anywhere, that line is a gap: fix the gap, not the wording.
- Time-box it to 30 minutes. The useful output is a list of ambiguities ("which flag?", "who can approve a cap?"), each turned into a runbook edit with a date in
Last tested. - Start from the sample in 7.1. Expect
NO-GOuntil everygate: trueitem isdoneornawith a note. If you find yourself writingnafor most of a group, ask whether the checklist is wrong for your context or you are avoiding work. - With the sample log in 1.8 the output shows MTTR 1.98 h, MTTD 0.26 h and MTTA 0.17 h. For your own data, fill
started_atfrom the postmortem, because the alert time alone cannot tell you how long users were affected before you noticed. - A good first CI rule: fail the deploy if the prompt version or model ID in the release is missing from
ai_inventory.yaml, or if an entry lacksowner,data_classesoreval_gate. - The exit-plan test is concrete: could you move real traffic to a second provider within 30 days, with prompts, evals and data export already in hand? If the answer needs "it depends", write down what it depends on.
- For every store without enforcement, name the mechanism you would add (a TTL, a lifecycle rule, a scheduled job) and who checks that it ran.
- The handoff document lists open incidents, pending changes, flaky alerts and vendor issues in flight; the escalation test is an actual call to the person two levels up.
- For instance
{"data_exposed": true}gives SEV1;{"quality_impact": "degraded", "users_affected_pct": 3}gives SEV3 (degraded quality plus 3% of users);{"users_affected_pct": 12, "feature_tier": "standard", "quality_impact": "none"}gives SEV2 from the 10% rule alone, which many teams would call SEV3 for a non-critical feature: the classifier has no concept of feature importance beyondfeature_tierand no concept of launch week or regulators, which a human supplies. - Check that every action item has an owner and a date, and that one of them is an eval case or a runbook edit.
- Score each dimension separately; the single highest-leverage move is usually the lowest-scoring dimension that has caused an incident.
Check yourself#
- Name the five jobs of day-2 operations and one artefact each produces.Detect/respond (runbooks, incident process, postmortems), govern (inventory, change tiers, access control, audit, vendor files), manage data (retention schedule, deletion runbook, data map), govern cost/quality (budgets, eval ownership, release criteria, reviews), engineer reliability (SLO policy, drills, DR plan, dependency cadence).
- What's the difference between an alert that should page and one that should ticket?Page on symptoms a user notices within minutes that need a human decision now (provider outage, cost anomaly, safety incident, quality collapse); ticket on next-business-day fixes (single failed request, one bad answer, deprecation notice, gradual cost drift).
- Why is "contain before diagnose" especially important for LLM incidents?Because the bleeding may be money or data exposure, not downtime — a runaway agent or PII leak costs more per minute of diagnosis than a classic outage, and containment is cheap and reversible.
- List three containment actions available for an LLM service that a classic web service wouldn't have.Feature-flag kill switches, per-tenant spend caps/budgets, degraded modes (cached answers, smaller model, human queue), tool kill switches for agents, route/model repinning — all reversible without a deploy.
- What are the four roles of incident command, and why does only Ops modify the system?Incident commander (owns response, delegates, keeps the doc), Ops (the only role that changes the system), Comms (internal + external updates), Planning (timelines, bugs, handoffs). Only Ops modifies so nobody freelances uncoordinated changes mid-incident.
- What makes a postmortem "blameless", and what are the LLM-specific contributing factors to hunt for?Blameless = focus on systemic causes (missing alert, untested runbook, eval gap) not individual fault; everyone had good intentions with the information they had. LLM factors: silent quality failures, unpinned versions/aliases, vendor opacity, data-policy violations, console prompt edits, missing eval cases.
- What are the five governance mechanisms, and which artefact answers "who approved this model swap"?Inventory, change control, access control, audit, vendor management. The audit log (who changed what, when, approved by whom) answers the model-swap question.
- What's the difference between a T2 and a T3 change, and give an example of each.T2 = owner + eval gate (prompt version to prod, model bump, read-only tool); T3 = named approver + evidence (new provider/region, regulated-feature model swap, new data class to vendor, agent autonomy increase). T3 needs a named human sign-off beyond peer review.
- Why can't the author of a prompt change be its only approver?Because the author has a conflict of interest — they may be blind to their own change's risks, and self-approval removes the check. Separation of duties extends code review to AI artefacts.
- List the stores an LLM system accumulates user data in beyond the primary database.Request/response logs, traces/spans (prompts+outputs), user feedback, eval datasets, vector index, caches, prompt registry, backups, provider-side storage.
- Why are hashed/pseudonymous user IDs still a deletion concern?Because you need to find a user's data to delete it — the hash key reverses the pseudonymisation, so it's deletion-relevant; and "anonymous" IDs that you can still query aren't anonymous for erasure purposes.
- What's the difference between RPO and RTO, and which store is usually the RTO long pole for a RAG service?RPO = acceptable data loss (how far back you can restore); RTO = acceptable restore time. For a RAG service the vector-index rebuild (re-embedding the corpus) is usually the RTO long pole.
- What does a vendor file contain, and what triggers an off-cycle vendor review?Contract/DPA status, certifications seen, subprocessors, data posture (training/retention/ZDR/regions), SLA, exit plan, review cadence. Off-cycle triggers: deprecation, price change, new feature, vendor security incident, new data class.
- What's the difference between a tabletop exercise and a game day?Tabletop = facilitated discussion walking a scenario against runbooks (find gaps cheaply); game day = actually breaking something in a controlled environment to verify the machinery works.
- In the readiness checklist, what distinguishes a [gate] item from a [track] item?[gate] = must be done before launch, blocks the go/no-go; [track] = must have an owner and date, may complete within a defined window after launch.
Further resources#
- Google SRE Book, Managing Incidents: the incident-command structure and lifecycle this lesson adapts.
- Google SRE Book, Postmortem Culture: Learning from Failure: the canonical blameless-postmortem guidance.
- Google SRE Book, Being On-Call and Emergency Response: the classic on-call and incident-response chapters.
- Google SRE Book, Reliable Product Launches at Scale and Appendix E: Launch Coordination Checklist: launch-gate philosophy and checklist curation.
- NIST AI Risk Management Framework (nist.gov/itl/ai-risk-management-framework): the Govern-Map-Measure-Manage vocabulary for AI governance; includes the Generative AI Profile (NIST-AI-600-1).
- ISO/IEC 42001:2023 (iso.org/standard/42001): the AI management system standard for organisational AI governance.
- OWASP GenAI Security Project (genai.owasp.org): the Top 10 for LLM Applications, Agentic Security initiative, and AI Bill of Materials work that inform the inventory and threat-model items.
- 03.8, Part 12: provider status pages and what to put in a vendor support ticket.
- 08A.14, Part 7: agent-level versioning, kill switches, incident playbooks and audit trails — the agent-specific sibling of this lesson's service-level ops.
- 10A.9: online evaluation and drift signals — the quality-governance data source.
- 02.9, Part 9: the provider data-policy snapshot the vendor files operationalise.
← 11C.3 — Fallbacks, Gateways and Reliability | Module 11C overview | 11C.5 — Model Lifecycle on One Page →