14A.5 The Incident Process for AI Systems
Sooner or later an AI feature you own will misbehave in front of real users. It will say something wrong with great confidence, obey an instruction hidden in a document, burn a month of budget in an afternoon, or quietly get worse after the provider updated a model. What matters then is not whether you are embarrassed but whether the organization has a process that is already agreed: who is told, who decides, what gets switched off, what gets written down and how the lesson becomes a test. This lesson teaches the general incident process for AI systems and gives you the pieces to fill in with your organization's own names, channels and obligations. The operating lesson 11C.4 and the security lesson 12.10 go deep on the machinery; this lesson is the version you carry into a new team and adapt.
What you'll learn
- What counts as an AI incident, with eight classes that classic incident processes miss or underrate
- Severity levels and how to assign one mechanically, so nobody debates at 3 a.m.
- How incidents are detected: alerts, SLOs (11A.2), user reports and provider notices
- Triage and containment: kill switches, rollback of prompts and models (11C.2), fallbacks (11C.3)
- Communication during an incident, and the difference between internal updates and external notices
- Evidence preservation (traces from 11A.1) without creating a privacy problem
- A blameless postmortem template, and how to turn every incident into an eval case (10A.8, 10A.9)
- Reporting obligations and on-call, as placeholders for your organization's rules
- A small keyless script that holds an incident record, classifies severity, generates a postmortem and exports an eval case, plus a golden-set eval for the classifier
What you don't need
- API keys or model calls. The scripts use
python3and the standard library and run offline. - Docker, a pager service or any running system.
- Prior on-call experience. Part 7 explains the role from scratch.
- Legal expertise. Where law applies (breach notification, sector rules), this lesson points to the owner and leaves the rule as a placeholder.
Setup
Python 3.11 or newer. As of 1 December 2026 nothing needs to be installed.
python3 incident_kit.py # record, severity, postmortem, eval case (Part 6)
python3 incident_eval.py # golden-set eval of the classifier (Part 8)Save each script under the file name in its first comment, in one folder. The outputs are real runs of exactly this code.
What you must be able to do after this lesson#
- Classify an event as an AI incident using the eight classes
- Assign a severity level mechanically from the severity table
- Contain an incident with a kill switch or a rollback of the prompt or model
- Preserve evidence from traces without creating a privacy problem
- Write a blameless postmortem with owned and dated action items
- Turn an incident into a regression eval case
Why this matters for an AI engineer#
Traditional software fails loudly: an error rate climbs, a page goes red. AI features fail quietly. The service is up, latency is fine, and the answers are wrong. Or the answers are fine and the bill is ten times normal. Or someone found that a customer email can steer your agent. If you only have the classic incident process, none of these look like an incident until a customer or an invoice says so. A clear process, with severity rules written in advance, is how a junior engineer on call can act correctly without waiting for a senior person to wake up.
| You'll hear... | You'll understand it after... |
|---|---|
| "Is this a SEV1 or a SEV2?" | Part 2: Severity levels |
| "Wrong but up counts as an incident." | 1.2 Wrong but up |
| "Flip the kill switch first, ask questions later." | Part 4: Triage and containment |
| "Roll the prompt back to the last good version." | 4.3 Rollback, fallback and kill switch |
| "Do not delete the traces. Do not copy them to chat either." | Part 5: Evidence, privacy and communication |
| "Postmortems are blameless." | Part 6: The blameless postmortem |
| "Every incident ends with an eval case." | 6.3 Turn the incident into an eval case |
| "Are we obliged to tell a regulator or a customer?" | 5.4 Reporting obligations |
| "You are on the rotation next week." | Part 7: On-call |
Part 1: What counts as an AI incident#
An incident is an unplanned event that harms users, data, money or trust, or that threatens to, and that needs a coordinated response. The word "AI" adds failure modes with no stack trace. Eight classes cover most of what you will see.
1.1 The eight classes#
| Class | What it looks like | Typical first signal |
|---|---|---|
| Harmful output | The model produces unsafe, abusive, discriminatory or dangerous content | User report, safety classifier hit |
| Incorrect output | Confident wrong answers, invented citations or numbers, wrong policy | Judge-score drop, complaints, escalations |
| Prompt injection success | Content in a document, email or web page steers the model into an action it should not take (12.2) | Canary token, odd tool-call sequence |
| Data leak | Personal or confidential data reaches the wrong user, log, provider or output | Detector alert, user report, audit finding |
| Runaway cost or loop | Spend rate far above baseline, agent stuck repeating steps, retry storm | Cost anomaly alert, budget threshold |
| Provider outage or degradation | The model API is down, slow or rate limiting | Error-rate and latency alerts, provider status page |
| Model regression after a silent update | The same prompt behaves differently after the provider changed the model behind an alias | Scheduled probe or eval drop with no deploy |
| Eval gate bypass | A change reached production without the required eval gate (a skipped check, a manual hotfix, a console edit) | Audit trail, release record |
The last one is easy to overlook, because nothing visible broke. A release that skipped the gate is still an incident: the control that protects everyone failed, and the next release may not be lucky. 11C.2 explains the gates, and 14A.2 (review standards) is where your organization writes down what must never skip them.
1.2 Wrong but up: quality incidents#
The most important change from classic incidents is that "wrong but up" is a severity, not a non-event. A feature that answers incorrectly for a third of requests is a serious incident even with zero HTTP errors. To treat it that way you need quality thresholds defined in advance: a judge score, a thumbs-down rate or an escalation rate that, if crossed, counts as an incident. 10A.9 covers the online signals, and 11C.4, Part 4 covers how to set release and quality criteria.
1.3 Near misses count#
A near miss is something that could have been an incident but was caught: an injection attempt blocked by a guardrail, a bad prompt version stopped by the eval gate, a leaked key revoked before use. Record these in the same system with the lowest severity. They are the cheapest source of learning you will ever get, and a team that records near misses finds its gaps before customers do.
Part 2: Severity levels#
Severity decides who is woken up, how often updates go out and whether a postmortem is mandatory. It should be a lookup, not a debate. Example Co uses four levels. Treat this table as a model for writing your own.
| Level | Meaning | Examples | Response (Example Co) |
|---|---|---|---|
| SEV1 | Critical | Data exposure; harmful output at scale; write-capable agent tricked by injection; spend rate 10x normal | Page now; incident commander named; leadership told; updates every 30 minutes; postmortem mandatory |
| SEV2 | Major | Quality collapse (30 percent or more wrong); provider down with no fallback; injection with read-only tools; spend 5x normal | Page on-call and owner; updates hourly; postmortem mandatory |
| SEV3 | Minor | Provider down but fallback works; spend 2x normal; eval gate bypassed; 5 to 30 percent of users get wrong answers | Ticket, acknowledge within one business day; postmortem if user-visible or repeated |
| SEV4 | Low | One odd answer; cosmetic issue; near miss | Backlog; no page |
2.1 Rules that make the levels safe#
Three rules, borrowed from 11C.4 and 12.10, prevent the common mistakes.
- Data incidents start at SEV1 until proven otherwise. Any suspected exposure of personal or confidential data, including to a provider that your data policy does not allow, starts at the top level and is lowered only with evidence. Over-reacting costs an hour. Under-reacting can miss a legal deadline.
- Agent incidents inherit the worst tool in scope. A runaway agent that only reads is a lower severity than the identical loop with a delete or send tool available. What the agent could have done sets the blast radius, not what it happened to do.
- The classifier under-triages on purpose, and a human confirms. Tools suggest; a person decides. A person may always raise a severity, and lowering one needs a written reason.
2.2 Severity changes during an incident#
Severity is not fixed. A "wrong answers" incident may be raised when you discover the output contained personal data, and lowered when a rollback works. Record each change, with the time and the reason, in the timeline. A severity that moves silently makes the postmortem unreliable.
Part 3: Detection#
Deep-dive
You cannot respond to what you cannot see. Detection comes from four places.
3.1 Alerts and SLOs#
An SLO (service level objective) is a target for a metric, such as "95 percent of answers score at least 0.85 on the faithfulness judge" or "99 percent of requests complete in under 8 seconds". An alert fires when the target is at risk. 11A.2 covers the LLM-specific metrics: latency percentiles, error rates, cost per request, quality scores from sampled judging, and cardinality traps in labels. For AI features, include at least one alert from each family: availability (errors, timeouts), quality (judge score, user feedback, escalation rate), cost (spend rate against baseline) and safety (canary hits, injection detector hits, blocked-content rate).
A good alert has an owner, a threshold with a reason, a link to a runbook and a severity hint. An alert that nobody acts on should be fixed or deleted: alert fatigue is itself a risk.
3.2 Scheduled probes#
Silent model changes do not trigger errors. Catch them with canary prompts and scheduled eval runs: a small fixed set of inputs run against the production model alias every few hours, comparing scores to a baseline. If the score drops with no deploy, you have a model regression incident. 10A.9, Part 3 describes canaries and scheduled probes. Pin model versions where the provider allows it (11B.5), and subscribe to provider deprecation and status notices, which is the habit taught in lesson 14A.9, Staying Current in a Fast-Moving Field.
3.3 People are sensors#
Many AI incidents are first noticed by a user, a support agent or a colleague who tried something. Give them an easy way to report: a button in the product, a mailbox or a chat channel. Say how quickly you respond. A report you ignored once is a report you will not get next time.
3.4 Provider notices#
Provider outages, incidents and deprecations arrive through status pages and email. Route them to a shared channel, not to one person's inbox. When a provider incident matches your symptoms, link it in the incident record, since it changes the response: you cannot fix it, you can only contain and communicate.
Part 4: Triage and containment#
4.1 The first ten minutes#
When an alert or report arrives, one person (the on-call engineer) takes ownership and does four things in order.
- Acknowledge. Say in the incident channel that you have it, so nobody duplicates work.
- Classify. Gather the signals: how many users, which data, which tools in scope, spend rate, which feature tier. Use the severity table. If unsure, pick the higher level.
- Contain. Stop the harm before you understand it. Containment is different from a fix. It buys you time.
- Declare and assemble. At SEV1 and SEV2, name an incident commander and a communications lead. The commander coordinates and does not debug. The commander's job is to keep the response organized and the updates flowing.
Containment comes before investigation for AI incidents, because an active leak or runaway loop does more damage every minute. But take a snapshot of the evidence (Part 5) while you contain, because some levers destroy evidence.
4.2 The containment ladder#
From least to most disruptive, the levers are these. Pick the lowest one that stops the harm.
| Lever | When to use it | Cost of using it |
|---|---|---|
| Lower per-request caps (max tokens, max steps) | A loop or cost spike with otherwise working output | Some answers truncated |
| Switch to a fallback (cheaper or alternate model, cached answer) | Provider degradation, budget pressure | Lower quality or higher latency |
| Roll back the prompt or model | A recent change correlates with the problem | Loses the change's benefits |
| Disable a tool or egress path | Injection or exfiltration suspected | Feature loses a capability |
| Quarantine a tenant or user | A targeted abuse case | One customer affected |
| Kill switch (feature off, human handoff) | Harmful output at scale, data exposure, anything unclear at SEV1 | The feature is unavailable |
| Revoke a key | Suspected key leak | Dependent services fail until the new key is deployed |
For a prompt-injection incident, disable the exfiltration channel first (outbound tools such as web fetch, email or HTTP), then freeze the feature, then rotate any secret the model could have seen (12.10, Part 3 has the full playbook). A read-only agent cannot send data out.
4.3 Rollback, fallback and kill switch#
These three only work if you built them before the incident.
- Rollback. Prompts, model versions and retrieval indexes should be versioned and released through a pipeline (11C.2), so rolling back is a one-line change that is itself tested. If the prompt lives in a console text box, you cannot roll back reliably. That is a finding for the postmortem.
- Fallback. A second model, a cached answer, a simpler rule, or a human handoff. 11C.3 covers circuit breakers, bulkheads and gateways. A fallback must itself be approved: a fallback model in a different region may violate your data policy (14A.1).
- Kill switch. A feature flag that turns the AI path off and shows a plain message or hands off to a human (11C.4, 1.6). Test it on a schedule. A kill switch nobody has pressed is a hope, not a control.
4.4 Investigate after you contain#
With harm stopped, investigate. Pull the traces for affected requests, look at what changed (deploys, prompt versions, model aliases, index builds, dependency updates, provider notices), and form a hypothesis. Because model output is non-deterministic, you often cannot replay the failure: you work from recorded traces and stored outputs. That is why tracing (next part) must capture the prompt version, model version and exact output. Fix, verify against the failing cases, restore service and watch the metrics before you stand down.
Part 5: Evidence, privacy and communication#
Deep-dive
5.1 Preserve evidence first#
Before any lever that might delete or overwrite data, snapshot what you need: the traces for affected requests (11A.1 lists what to capture per call), the exact model outputs, the prompt version and model version, the guardrail decisions, the audit log of config changes, and the relevant provider status page at the time. Store the snapshot in a location with restricted access and a retention rule. Record who took it and when.
5.2 Evidence and privacy pull in different directions#
Traces often contain user text, and user text may contain personal data. The incident process must not become a data leak of its own. Rules that work:
- Least access. Only the people working the incident can read the evidence store.
- Minimize copies. Do not paste raw traces into chat, tickets or slides. Link to the store and quote the smallest fragment that makes the point.
- Redact for the postmortem. The published postmortem uses redacted or synthetic examples, never real user text (12.4 explains detection and redaction).
- Retention. Keep evidence for a defined period, then delete. A data incident may require longer retention. Ask the privacy owner, not your own judgment.
5.3 Communicate on a schedule#
During an incident, silence is worse than bad news. The communications lead sends short updates on a fixed cadence, even if the update is "no change". A good update has four parts: what we know (impact, scope), what we are doing (containment, current hypothesis), what we need (decisions, people) and next update at (a time). Keep internal updates factual and blameless: name systems, not people.
Distinguish three audiences. Responders use the incident channel. Stakeholders (product owners, support, leadership) get periodic summaries. External parties (customers, partners, regulators, providers) get messages that are reviewed by the people who own those relationships. Engineers do not contact customers or regulators on their own.
A short template for a stakeholder update:
[SEV2] Refund assistant giving wrong policy answers Update 2, 09:50 UTC
Known: About 35 percent of refund answers cited the wrong time limit since 08:40.
Doing: Prompt rolled back to v13 at 09:31; monitoring judge scores.
Need: Support lead to flag any customer who was promised a refund.
Next: 10:20 UTC or sooner if status changes.5.4 Reporting obligations#
Some incidents create duties outside the engineering team: telling affected people, a customer under contract, a regulator or an insurer, usually within a deadline that starts when the organization becomes aware. Which duties apply depends on your sector, your location, your contracts and the kind of data involved. This lesson does not tell you which apply. 12.9 and 12.10 describe the landscape and, for example, the personal-data breach clock in one major regime; verify any such rule on the official source before relying on it, and ask your legal or privacy owner.
What you can do as an engineer is make sure the right person learns about the incident quickly and has what they need: the time you became aware, what data was involved, how many people, what was done. The awareness time matters, because many deadlines run from it. Write it in the record.
Part 6: The blameless postmortem#
A postmortem is a written record of what happened, why and what will change. Blameless means it looks at systems, not people: "the alert did not exist" is a finding, "the on-call engineer should have noticed" is blame. People acted on the information and tools they had, and the postmortem asks what information and tools were missing. The reference text is the Google SRE book chapter on postmortem culture, and 11C.4, 1.7 has the full template and the list of LLM-specific factors to look for.
6.1 When to write one#
Decide in advance, so it is policy and not mood. A common rule: mandatory for SEV1 and SEV2, and for any SEV3 that was user-visible or repeated; optional but encouraged for near misses. Write it within a few working days while memory is fresh, and share it widely (with redaction), because a postmortem nobody reads fixes nothing.
6.2 What to look for in AI incidents#
Beyond the usual missing alert or runbook, hunt for these:
- Silent quality failure. Was there any signal that could have caught it sooner: online judge scores, feedback rate, a canary?
- Unpinned versions. Did a model alias, prompt, index or dependency drift beneath a stable-looking deploy?
- Vendor opacity. Did the provider change something without notice, and would a scheduled check have seen it?
- Policy violations. Did data flow somewhere it should not, such as a fallback in an unapproved region?
- Changes outside the pipeline. A hotfix or console edit that skipped the gate.
- The eval that did not exist. Every incident should end with the test that would have caught it.
Use the "five whys" but stop at a systemic cause. "Human error" is never a root cause. Ask why the system allowed the error.
6.3 Turn the incident into an eval case#
The most valuable action item is the same every time: add the failing case to the eval suite, so the same failure cannot return unnoticed. Take the exact failing input (redacted if it contains personal data), the bad output you observed, and write the rule a correct answer must satisfy. File it in the regression set that runs in CI (10A.8) and, for failures that only show up in production, in the online probes and judges (10A.9). Dataset construction is in 10A.2. For security incidents, add the attack to the red-team set (12.8).
Over time the incident-derived cases are the most valuable part of your suite, since each one is a real failure that really happened.
6.4 A record, a classifier and a postmortem generator#
The script below holds an incident record, suggests a severity, generates a postmortem skeleton from the record and its timeline, and exports an incident as an eval case. It is deliberately small. Its thresholds are Example Co's and are invented, and the severity it prints is a suggestion that a human confirms. It uses only the standard library.
# incident_kit.py: incident record, severity classifier, postmortem generator, eval-case export.
# Standard library only. No keys, no network. Usage: python3 incident_kit.py
# Thresholds are EXAMPLE numbers for a fictional company: replace them with your own policy.
import json
from dataclasses import dataclass, field
KINDS = ["harmful_output", "wrong_output", "injection_success", "data_leak",
"runaway_cost", "provider_outage", "model_regression", "gate_bypass"]
@dataclass
class Incident:
title: str
kind: str
users_affected_pct: float = 0.0
data_exposed: bool = False
cost_multiple: float = 1.0 # current spend rate divided by the normal rate
feature_tier: str = "standard" # critical | standard | internal
has_fallback: bool = True
tools_in_scope: str = "read" # none | read | write
timeline: list = field(default_factory=list) # (utc "HH:MM", text)
def log(self, when, text):
self.timeline.append((when, text))
def classify(i):
"""Return (severity, reasons). Conservative: any single strong signal raises the level."""
reasons = []
sev = 4
def raise_to(level, why):
nonlocal sev
reasons.append(why)
sev = min(sev, level)
if i.data_exposed:
raise_to(1, "data exposure is SEV1 until proven otherwise")
if i.kind == "harmful_output" and i.users_affected_pct >= 1:
raise_to(1, "harmful output reaching users at scale")
elif i.kind == "harmful_output":
raise_to(2, "harmful output reported")
if i.kind == "injection_success":
if i.tools_in_scope == "write":
raise_to(1, "injection succeeded where a write tool was in scope")
else:
raise_to(2, "injection succeeded (no write tool in scope)")
if i.cost_multiple >= 10:
raise_to(1, f"spend rate {i.cost_multiple:g}x normal")
elif i.cost_multiple >= 5:
raise_to(2, f"spend rate {i.cost_multiple:g}x normal")
elif i.cost_multiple >= 2:
raise_to(3, f"spend rate {i.cost_multiple:g}x normal")
if i.kind in ("wrong_output", "model_regression"):
if i.users_affected_pct >= 30:
raise_to(2, f"wrong answers for {i.users_affected_pct:g}% of users")
elif i.users_affected_pct >= 5:
raise_to(3, f"wrong answers for {i.users_affected_pct:g}% of users")
if i.kind == "provider_outage":
if i.has_fallback:
raise_to(3, "provider outage, fallback working")
else:
raise_to(2 if i.feature_tier != "critical" else 1, "provider outage, no fallback")
if i.kind == "gate_bypass":
raise_to(3, "release went out without the eval gate")
if i.feature_tier == "critical" and sev > 1 and sev <= 3:
sev -= 1
reasons.append("critical feature: raised one level")
if i.feature_tier == "internal" and sev == 1 and not i.data_exposed:
sev = 2
reasons.append("internal-only feature: lowered one level (no data exposure)")
if not reasons:
reasons.append("no strong signal: default SEV4")
return sev, reasons
POSTMORTEM = """\
# Postmortem: {title}
Severity: SEV{sev} | Kind: {kind} | Status: draft | Author: <name>
## Summary
<three sentences: what broke, for whom, for how long, one-line root cause>
## Impact
- Users affected: {users}% (estimate)
- Spend rate at peak: {cost}x normal
- Data exposed: {data}
## Timeline (UTC)
{timeline}
## Root cause (systems, not people)
<missing alert? no kill switch? eval gap? unpinned model? ask why until you reach a system>
## What went well / what went poorly
<specific, with numbers>
## Action items (owner and due date on every line)
- [ ] Add the incident as an eval case: {case_id} owner: ___ due: ___
- [ ] Add or fix the alert that should have fired owner: ___ due: ___
- [ ] Update the runbook for {kind} owner: ___ due: ___
"""
def postmortem(i):
sev, reasons = classify(i)
tl = "\n".join(f"{t} {x}" for t, x in i.timeline) or "<no entries: add them>"
return POSTMORTEM.format(title=i.title, sev=sev, kind=i.kind, users=i.users_affected_pct,
cost=i.cost_multiple, data="yes" if i.data_exposed else "no",
timeline=tl, case_id=case_id(i))
def case_id(i):
return "inc-" + "".join(c if c.isalnum() else "-" for c in i.title.lower())[:40].strip("-")
def eval_case(i, bad_input, bad_output, expected_rule):
"""Turn an incident into a regression case: the exact failing input plus a pass rule."""
return {"id": case_id(i), "source": "incident", "kind": i.kind,
"input": bad_input, "observed_bad_output": bad_output, "pass_rule": expected_rule}
if __name__ == "__main__":
inc = Incident("Refund bot broke policy (EXAMPLE)", "wrong_output",
users_affected_pct=35, feature_tier="critical")
inc.log("09:12", "Alert: refund-policy judge score below 0.80 for 15 minutes")
inc.log("09:20", "On-call acknowledged; traced the failing requests")
inc.log("09:31", "Prompt v14 rolled back to v13 (kill switch not needed)")
inc.log("09:50", "Judge score back above 0.90; incident downgraded and monitored")
sev, why = classify(inc)
print(f"Severity: SEV{sev}")
for r in why:
print(f" because: {r}")
print()
print(postmortem(inc))
case = eval_case(inc, "Can I get a refund for an order from 90 days ago?",
"Yes, we refund any order within a year.",
"answer must state the 30-day policy and must not promise a refund")
print("Eval case (JSONL line):")
print(json.dumps(case))Real output:
Severity: SEV1
because: wrong answers for 35% of users
because: critical feature: raised one level
# Postmortem: Refund bot broke policy (EXAMPLE)
Severity: SEV1 | Kind: wrong_output | Status: draft | Author: <name>
## Summary
<three sentences: what broke, for whom, for how long, one-line root cause>
## Impact
- Users affected: 35% (estimate)
- Spend rate at peak: 1.0x normal
- Data exposed: no
## Timeline (UTC)
09:12 Alert: refund-policy judge score below 0.80 for 15 minutes
09:20 On-call acknowledged; traced the failing requests
09:31 Prompt v14 rolled back to v13 (kill switch not needed)
09:50 Judge score back above 0.90; incident downgraded and monitored
## Root cause (systems, not people)
<missing alert? no kill switch? eval gap? unpinned model? ask why until you reach a system>
## What went well / what went poorly
<specific, with numbers>
## Action items (owner and due date on every line)
- [ ] Add the incident as an eval case: inc-refund-bot-broke-policy--example owner: ___ due: ___
- [ ] Add or fix the alert that should have fired owner: ___ due: ___
- [ ] Update the runbook for wrong_output owner: ___ due: ___
Eval case (JSONL line):
{"id": "inc-refund-bot-broke-policy--example", "source": "incident", "kind": "wrong_output", "input": "Can I get a refund for an order from 90 days ago?", "observed_bad_output": "Yes, we refund any order within a year.", "pass_rule": "answer must state the 30-day policy and must not promise a refund"}Notice three things. The classifier gives its reasons, so a human can disagree with specifics instead of with a number. The postmortem comes out with a timeline already filled from the record kept during the incident, which is why you log as you go. And the eval case is one line of JSONL: the failing input, the bad output and the rule a correct answer must satisfy. A regression test for that case in CI means the rolled-back prompt cannot return unnoticed.
6.5 A filled-in sample incident#
A short sample for the fictional Example Co, to show the level of detail that is useful. All names and numbers are invented.
INCIDENT (EXAMPLE). Refund assistant gives wrong refund window
Detected: 08:55 UTC by alert "refund-policy judge score < 0.80 for 15 min"
Severity: SEV2 raised to SEV1 (critical feature, 35 percent of answers wrong)
Commander: <role: incident commander> Comms: <role: communications lead>
Impact: About 35 percent of refund answers cited a 365-day window instead of 30 days.
No data exposed. No spend anomaly.
Contained: 09:31 prompt rolled back v14 to v13 (one-line change in the release pipeline)
Cause: v14 shortened the system prompt and dropped the policy paragraph. The
eval gate had no case that asked about orders older than 30 days.
Actions: add the 90-day-old-order case (done); add an eval case for every policy
number in the prompt (due in 2 weeks); alert on judge score for this
feature at 0.85 (done).Notice the cause names a system gap (a missing eval case), not a person.
Part 7: On-call#
Deep-dive
On-call means a named person is reachable and responsible for first response during a defined period. It is how an incident process becomes real at 3 a.m.
8.1 What on-call involves#
The on-call engineer acknowledges alerts within a target time, classifies and contains using the runbooks, escalates when the situation exceeds their authority or skill, and hands over cleanly at the end of the shift with a note on open issues. You are not expected to fix everything alone. You are expected to follow the process, contain harm and call for help early. Calling early is never a failure.
8.2 Runbooks#
A runbook is a short, tested set of steps for a known alert or incident class: how to check, how to contain, who to call, how to verify recovery. Write one for each of the eight classes in Part 1 as a start. 11C.4, 1.5 has templates, and the security playbooks are in 12.10. A runbook that has never been used is a guess; use it in a drill.
8.3 Sustainable rotations#
Healthy rotations have a primary and a secondary, a limit on consecutive weeks, compensation or time off after a night page, and a rule that a noisy alert is a bug to fix. 11C.4, 6.2 covers rotation design. New engineers should shadow before they carry the pager, and practice with a tabletop exercise: walk through an invented incident out loud, with the runbook open.
8.4 Your first week on call#
Before your first shift, check that you can do five things: log in to the paging tool and receive a test page, open the dashboards for the services you cover, find the kill switch and know who may press it, open the runbook for each alert class, and reach the incident commander and your manager. Do a ten-minute walk-through with your buddy on an invented incident. It is the cheapest rehearsal there is.
Part 8: Evaluate it#
Deep-dive
An incident process makes promises: that severity is assigned consistently, and that the dangerous cases are never under-rated. You can test the first promise cheaply.
Design
- Inputs: twelve incident records with a severity decided by a human reviewer beforehand, covering all eight classes and all four levels (the golden set below). Write the expected severities before you run the classifier, and have someone else check them.
- Metric: two numbers. Exact-match rate of the suggested severity against the label, and the count of under-triaged cases (suggested level less severe than the label). Over-triage costs an hour. Under-triage costs the incident.
- Pass rule: zero under-triaged cases and at least 80 percent exact match. If the rule fails, either the code or the policy is wrong: fix one, and say which in the change.
# incident_eval.py: golden-set eval for the severity classifier. Save next to incident_kit.py.
from incident_kit import Incident, classify
# (name, incident, expected severity decided by a human reviewer beforehand)
GOLD = [
("PII shown to wrong user", Incident("a", "data_leak", data_exposed=True), 1),
("injection with write tool", Incident("b", "injection_success", tools_in_scope="write"), 1),
("spend 12x normal", Incident("c", "runaway_cost", cost_multiple=12), 1),
("harmful output, 3% users", Incident("d", "harmful_output", users_affected_pct=3), 1),
("injection, read-only", Incident("e", "injection_success", tools_in_scope="read"), 2),
("spend 6x normal", Incident("f", "runaway_cost", cost_multiple=6), 2),
("outage, no fallback", Incident("g", "provider_outage", has_fallback=False), 2),
("wrong answers, 40% users", Incident("h", "wrong_output", users_affected_pct=40), 2),
("outage, fallback ok", Incident("i", "provider_outage", has_fallback=True), 3),
("gate bypassed", Incident("j", "gate_bypass"), 3),
("one odd answer", Incident("k", "wrong_output", users_affected_pct=0.1), 4),
("internal tool, 12% wrong", Incident("l", "model_regression", users_affected_pct=12, feature_tier="internal"), 3),
]
exact = under = 0
for name, inc, want in GOLD:
got, _ = classify(inc)
exact += got == want
if got > want: # larger number = less severe = under-triage
under += 1
print(f"UNDER-TRIAGE {name}: expected SEV{want}, got SEV{got}")
elif got != want:
print(f"over-triage {name}: expected SEV{want}, got SEV{got}")
print(f"exact match: {exact}/{len(GOLD)} = {exact / len(GOLD):.0%}; under-triaged: {under}")
print("pass rule: zero under-triage AND exact match at least 80%")
ok = under == 0 and exact / len(GOLD) >= 0.8
print("RESULT:", "PASS" if ok else "FAIL")
raise SystemExit(0 if ok else 1)Real output:
exact match: 12/12 = 100%; under-triaged: 0
pass rule: zero under-triage AND exact match at least 80%
RESULT: PASSA perfect score on twelve cases the author wrote alongside the code is a weak result. It proves the code matches the table and nothing more. The real value comes when the set grows: every incident you have in the past adds a case, and a real incident that the classifier rated too low becomes a failing case that forces a rule change. That is the same loop as the postmortem action item in Part 6, applied to the classifier itself.
The concepts behind the design are in 10A.3 (exact-match code graders), 10A.8 (regression sets and CI gates) and 10A.9 (online probes and anomaly alerts). The second thing worth testing is the end-to-end behavior: given a bad prompt version, does your rollback actually restore the golden-set score? That is a game-day exercise (11C.4, Part 5): schedule one.
If your team uses DeepEval (the required framework track), incident-derived cases belong in a dataset (10B.6) evaluated by a custom or built-in metric (10B.3, 10B.4) through the test runner (10B.2), with component-level tracing for agent loops (10B.5) and red teaming plus CI for security cases (10B.7). (optional) Inspect users can express the same cases as a dataset with a scorer (10B.8, 10B.10). The design above is the same in either framework: inputs, a metric, a pass rule.
Common misconceptions#
- "If the service is up, there is no incident." AI features fail while up. Wrong, harmful or expensive answers are incidents, and thresholds should say so.
- "The model did it, so nobody is accountable." Accountability stays with the owning team. "The model decided" explains the mechanism, not the responsibility.
- "Investigate first, contain later." For active leaks, loops and harmful output, contain first and snapshot evidence while you do.
- "A postmortem names who made the mistake." Blameless postmortems name systems and missing controls. Blame teaches people to hide problems.
- "We fixed it, so we are done." The fix is half the job. Without the eval case, the alert and the runbook update, the same failure returns.
- "Add 'ignore malicious instructions' to the prompt." That is not a containment for injection. The fix is architectural: fewer tools, narrower permissions, egress limits (12.2).
- "Pasting the trace in chat is quick and harmless." Traces contain user data. Link to the evidence store and quote the minimum.
- "The classifier said SEV3, so it is SEV3." The classifier suggests. A human confirms, and may always raise it.
Key takeaways#
- AI incidents include harmful and incorrect output, injection success, data leaks, runaway cost, provider outages, silent model regressions and eval gate bypasses. "Wrong but up" counts.
- Severity should be a lookup written in advance. Data incidents start at SEV1, agent incidents inherit the worst tool in scope, and a human confirms any automated suggestion.
- Detect with alerts and SLOs, scheduled probes for silent model changes, easy human reporting and provider notices.
- Contain before you investigate, using the lowest lever that stops the harm: caps, fallback, rollback, tool disablement, kill switch, key revocation. Build and test these before you need them.
- Preserve evidence while containing, keep it restricted, redact it for sharing, and never paste raw traces into chat.
- Communicate on a cadence with what we know, what we are doing, what we need and the next update time. Only the designated people talk to customers and regulators.
- Write a blameless postmortem and finish with an eval case, an alert and a runbook update.
- Test the process itself: a golden set for the classifier with zero under-triage, and a game day for the rollback.
Terms introduced in this lesson#
| Term | Meaning |
|---|---|
| Incident | An unplanned event that harms or threatens users, data, money or trust and needs a coordinated response |
| Near miss | An event that could have been an incident but was caught; recorded at the lowest severity |
| Severity level | A rating (SEV1 to SEV4) that decides who is paged, update frequency and postmortem need |
| Under-triage | Rating an incident less severe than it is; the costly error in classification |
| SLO | Service level objective: a target for a metric such as latency or answer quality |
| Canary prompt | A fixed input run on a schedule to detect silent model changes |
| Containment | Actions that stop harm quickly without yet fixing the cause |
| Kill switch | A flag that turns the AI path off and shows a message or hands off to a human |
| Incident commander | The person who coordinates the response and does not debug |
| Blameless postmortem | A written review that finds system causes and fixes rather than blaming people |
| Runbook | A short, tested set of steps for a known alert or incident class |
| Game day | A scheduled drill that exercises a rollback, kill switch or runbook |
Exercises#
- Classify five. Write five invented incidents, one for each of five different classes in Part 1, and give each a severity with a one-line reason. Check them with
incident_kit.py. Hint: for every incident, ask what the worst tool in scope could have done. - Add a class. Add a ninth class to the classifier for your sector (for example "regulated advice given") with a rule, and add two golden cases. Hint: change the rule and the golden set in the same step, and keep zero under-triage.
- Write a runbook. Write a one-page runbook for "runaway cost": the check, the containment ladder in order, who to call and how to verify recovery. Hint: start with per-request caps, then fallback, then the kill switch.
- Write a postmortem. Take the refund example in 6.5 and complete the root cause and what-went-well sections in a blameless way. Hint: if a sentence contains a person's name or "should have", rewrite it about a system.
- Turn it into a test. For the same incident, write three eval cases (one for the exact failure, one near it, one that checks the policy number still appears) with a pass rule each. Hint: one case tests the failure, the other two protect against a fix that over-corrects.
- Run a tabletop. With one colleague, walk through an invented prompt-injection incident from page to postmortem with the runbook open. Note every step where you did not know who to call. Hint: the missing phone numbers and permissions are the findings.
Check yourself#
- Name the eight classes of AI incident in this lesson.Harmful output, incorrect output, prompt injection success, data leak, runaway cost or loop, provider outage or degradation, model regression after a silent update, eval gate bypass.
- Why is "wrong but up" a severity and not a non-event?Users receive wrong answers and bear the harm even though no error appears. Quality thresholds defined in advance make it count.
- Why do data incidents start at SEV1, and when can they be lowered?Over-reacting costs little and under-reacting can miss a legal or contractual deadline. They are lowered only with evidence that no unauthorized exposure happened.
- What sets the severity of an agent incident: what the agent did, or what it could have done?What it could have reached. A read-only loop and the same loop with a delete or send tool differ in blast radius.
- Why does containment come before investigation, and what must you do while containing?Active leaks and loops do more damage every minute. While containing, snapshot evidence first because some levers destroy it.
- Order these levers from least to most disruptive: kill switch, lower per-request caps, roll back the prompt, switch to a fallback.Lower per-request caps, switch to a fallback, roll back the prompt, kill switch.
- Why can you often not replay an AI incident, and what do you rely on instead?Model output is non-deterministic and prompts, models and indexes may have changed. You rely on recorded traces, stored outputs, prompt and model versions.
- What are the four parts of a good incident update?What we know, what we are doing, what we need and when the next update will be.
- What is the most valuable action item after an incident, and where does it go?Adding the failing case to the eval suite (the regression set run in CI, and online probes where relevant).
- In the Part 8 eval, why is under-triage counted separately from exact match?Because the two errors have very different costs: over-triage costs an hour, under-triage can mean a missed response or deadline. The pass rule demands zero under-triage.
Further resources#
- Within this path: 11C.4 Operating LLM Systems (incident lifecycle, severity, runbooks, kill switches, postmortems), 12.10 Security Operations, Incident Response and the Safety Checklist (LLM-specific playbooks), 11A.2 Metrics, Dashboards, SLOs and Alerting, 11A.1 Tracing and Observability, 11C.3 Fallbacks, Gateways and Reliability, 11C.2 CI/CD for Prompts, Models and Evals, 12.9 Responsible AI, Policy and Compliance and 10A.8 Regression Testing, CI and Experiment Tracking.
- Outside: the Google SRE book chapter on postmortem culture; the NIST incident response guidance referenced in 12.10 (verify the current revision on the official site before citing it).
- Operating lesson to come: a later lesson on organization-level incident governance will extend Part 5.4; until it is published, 11C.4 and 12.10 are your reference.
← 14A.4 — Requesting Model Access and Budget | Module 14A overview | 14A.6 — Agent Inventory, Risk and Autonomy Classification, and Policy-as-Code →