AI WORKFLOWS

AI Workflow for Incident Response and Postmortems

Most on-call teams still triage incidents manually: read the alert, open dashboards, copy logs, write a timeline, and draft a postmortem from scratch. This workflow replaces that ad-hoc process with a repeatable AI pipeline that respects severity, cuts noise, and produces a usable postmortem draft within minutes.

FreeLast tested: 2026-07-31Audience: DevOps, SRE, platform engineers

Why Incident Response Needs Its Own Workflow

General-purpose AI assistants are bad at incident response for three reasons. First, they lack severity awareness: a chatty LLM will happily summarize a P0 outage with the same tone it uses for a flaky test. Second, they do not know your runbooks, escalation paths, or blast radius conventions. Third, they often miss the operational details that matter most — deployment timestamps, config changes, and dependent service status.

The workflow below solves all three by splitting incident handling into four stages: intake, context gathering, draft generation, and follow-up routing. Each stage has a clear exit criterion, so you can stop the pipeline at any point without wasting tokens on a resolved issue.

Stage 1: Alert Intake and Severity Classification

The first model call should be cheap and fast. Use a small local model or a low-cost API model to classify the incoming alert into severity, category, and required data sources. The output is a compact JSON object that drives the rest of the pipeline.

{ "severity": "P1", "category": "latency_spike", "affected_services": ["checkout", "payments"], "required_sources": ["metrics", "deploy_log", "config_changes"], "estimated_tokens": 4500, "recommended_model": "haiku" }

If the classifier cannot reach a confident severity assignment, the workflow should escalate to a human instead of guessing. False-positive P0 pages are more expensive than a slightly delayed classification.

Stage 2: Context Gathering with Tool Use

Once classified, the workflow pulls structured context from your observability stack. The exact sources vary by team, but the pattern is the same: query metrics, fetch recent deploy events, grab config diffs, and collect related alerts. The AI's job here is synthesis, not exploration.

A good prompt for this stage looks like:

You are an on-call assistant. The incident classifier returned: {severity_json} Use only the provided context blocks. Do not speculate. Return a timeline with: 1. First detected signal 2. Recent deploys in the last 2 hours 3. Config changes in the last 6 hours 4. Correlated alerts 5. Initial blast-radius estimate

Keep the model tier modest. Context gathering is a retrieval and summarization task, not a reasoning task. A model like claude-3.5-haiku or gpt-4o-mini handles it reliably for a fraction of the cost of a frontier model.

Stage 3: Postmortem Drafting

The third stage produces a structured postmortem draft. The prompt should enforce a fixed schema so the output is immediately usable:

This schema mirrors what you would eventually write manually. By forcing the AI to produce it in one pass, you eliminate the blank-page problem that makes postmortems feel like a chore. If you already use multi-stage workflow architecture for other operations tasks, the postmortem stage fits naturally into the same verification-and-handoff pattern.

Stage 4: Follow-Up Routing

A drafted postmortem is only useful if the right people see it. The final stage routes the draft and action items to the correct channels:

SeverityChannelAction
P0/P1War room + engineering leadPost draft immediately; schedule 30-minute review
P2Team Slack + incident ticketDraft attached to ticket; async review within 24 hours
P3Weekly ops digestBatch into next digest; no immediate notification

Routing by severity prevents notification fatigue. A P3 database query timeout does not need the same attention as a P0 payment outage. The workflow respects that distinction automatically.

Pattern: Cost-Aware Escalation for Long Incidents

Long-running incidents generate repeated context updates. If you re-run the full pipeline every five minutes, costs grow linearly with incident duration. Instead, use an escalation ladder:

  1. Status check — lightweight classifier only; cost is negligible.
  2. Context refresh — pull new metrics and deploys; reuse the existing prompt.
  3. Postmortem update — only if the incident is resolved or status materially changed.

This ladder keeps ongoing incident costs flat instead of linear. It also matches how humans actually work: we do not rewrite the postmortem every five minutes; we append updates until resolution.

Putting It Together: A Real Example

Consider a payment-service latency spike. The classifier tags it P1 and pulls metrics, deploy logs, and config changes. The context stage discovers a new deployment 18 minutes before the spike and a coincident config flag change. The postmortem draft identifies the deployment as the likely root cause and lists the rollback as the immediate remediation. The follow-up stage routes the draft to the payments team lead and opens a P1 ticket.

Total pipeline cost: under $0.15. Total time from alert to draft postmortem: under four minutes. The human reviewer spends their time on judgment calls — confirming root cause, adjusting remediation steps, and scheduling follow-ups — rather than on data gathering and formatting.

If you want a broader view of how this fits into operational automation, see AI workflow for operations and project management and workflow orchestration with agent chaining.

Limits and notes

This workflow works best when your observability stack exposes APIs or log endpoints that the AI can query programmatically. If context gathering requires manual log copy-paste, the workflow degenerates into another prompt template and loses its edge. Invest in read-only data access before automating the pipeline.

Postmortem drafts should always be reviewed by someone familiar with the incident. AI-generated timelines can miss human context — a "coincident" config change might have been planned days in advance. Treat the draft as a first pass, not a final artifact.