Suryanand/ Bootcamp
suryanand.com ↗Let's talk
← Safety and governanceAI guideAdvanced#security#incident-response#operations#governance
Frame · ai-engineering / safety-governance / 10-incident-response-for-ai-features.mdGuide 091 / 103

Incident response for AI features

Eventually something will go wrong: a jailbreak screenshot goes viral, an agent sends an email it should not have, a retrieval bug shows one customer another customer's documents, or a model upgrade starts giving dangerous advice. Your existing incident process mostly still applies, but AI incidents have quirks: they are often non-deterministic, they can be triggered by content rather than code, and the "fix" may be a prompt, a guardrail threshold or a model rollback. This doc covers how to prepare for and run them.

Why it matters

Regulators and customers expect it. The EU AI Act includes serious incident reporting duties for providers of high-risk systems and post-market monitoring obligations, and NIST's AI RMF puts incident handling under its Manage function. Industry guidance has caught up: the Coalition for Secure AI (CoSAI), an OASIS Open project, published an AI Incident Response Framework in November 2025 that adapts NIST SP 800-61 and ISO/IEC 27035 to AI-specific incident types such as jailbreaks in production, prompt injection that abuses tool permissions, training data leakage and model weight exfiltration.

Shared knowledge bases help you anticipate what will happen. MITRE ATLAS catalogues adversary tactics and techniques against AI systems in an ATT&CK-style matrix, and the AI Incident Database collects reports of real-world AI harms and near misses.

How it works

The lifecycle is the familiar one, with AI-specific actions at each stage.

Rendering diagram…

Detect. Signals include guardrail block-rate spikes, injection classifier hits in retrieved content, unusual tool-call patterns (new recipients, volume spikes), user reports and thumbs-down clusters, cost anomalies and external reports (social media, bug bounty).

Triage. Classify by type (safety, security, privacy, quality, cost) and severity. A useful question: is this a single bad output, or a reproducible capability an attacker can reuse?

Contain. AI features need containment levers you can pull in seconds, without a deploy: disable a tool, disable an agent, switch to a safer model, tighten a guardrail threshold, turn off retrieval from a poisoned source, or fall back to a non-AI path.

Investigate. Reconstruct the full context: prompt versions, model snapshot, retrieved documents, tool calls and outputs. This is only possible if you logged them (with appropriate redaction) and versioned your prompts and configs.

Eradicate and recover. Fix the root cause (remove poisoned documents, patch the policy engine, add a regression eval), then restore functionality gradually.

Review. Blameless post-incident review, plus a new eval case that reproduces the incident so it cannot silently return.

Reference architecture

The pieces you need in place before the first incident:

Rendering diagram…

Write runbooks per incident type. A prompt injection runbook differs from a data leakage runbook: the first focuses on which data sources and tools were exposed, the second on which tenants' data crossed boundaries and on notification duties.

Code

Kill switches are the most valuable thing to build in advance. This TypeScript wrapper checks runtime flags on every tool call and model selection, so on-call can contain an incident by flipping a flag. The flag store can be any feature-flag service or config store that updates without a deploy.

type Flags = {
  disabledTools: string[];
  disabledAgents: string[];
  modelOverride?: string;          // e.g. roll back to a previous snapshot
  readOnlyMode: boolean;           // block every write or external tool
};

export async function guardedToolCall(
  flags: Flags,
  agentId: string,
  tool: { name: string; writes: boolean },
  run: () => Promise<unknown>,
  audit: (e: Record<string, unknown>) => void,
) {
  const blocked =
    flags.disabledAgents.includes(agentId) ||
    flags.disabledTools.includes(tool.name) ||
    (flags.readOnlyMode && tool.writes);

  audit({ agentId, tool: tool.name, blocked, at: new Date().toISOString() });
  if (blocked) {
    return { error: "This action is temporarily unavailable." };
  }
  return run();
}

export function pickModel(flags: Flags, defaultModel: string): string {
  return flags.modelOverride ?? defaultModel;
}

Test these levers in game days. A kill switch nobody has ever flipped is a kill switch that might not work.

Trade-offs and pitfalls

  • Logging versus privacy. You need full context to investigate, but prompts contain personal data. Redact, restrict access and set retention for incident evidence.
  • Non-reproducibility. Sampling makes incidents hard to replay. Log model snapshot, parameters and seeds where available, and replay with temperature zero plus the exact context.
  • Fixing with prompts only. A system prompt tweak is a quick mitigation, not a root-cause fix. Back it with a guardrail, policy or architecture change and an eval.
  • Silent model changes. Some incidents are caused by an upstream model update. Pin versions so you know when behaviour changed.
  • Unclear ownership. AI incidents straddle security, trust and safety, ML and product. Decide in advance who leads each type.
  • Notification deadlines. Privacy and AI regulations can impose reporting timelines. Involve legal early in triage for anything touching personal data or high-risk systems.

Checklist

  • Log prompts, context, tool calls, model snapshots and config versions with redaction.
  • Build runtime kill switches for tools, agents and models, and test them.
  • Write runbooks for injection, data leakage, harmful output and cost incidents.
  • Map detections to MITRE ATLAS techniques and CoSAI playbooks.
  • Define severity levels, owners and notification paths, including legal.
  • Turn every incident into a regression eval case.
  • Run game days that simulate AI incidents end to end.

Further reading

Why this exists README

I learn best by explaining things, so I record the explanations. Everything here is free, with no sign-up. If a lesson helps you ship something, I'd love to hear about it.