Inferensys

Prompt

Chain-of-Thought Root Cause Analysis Prompt Template

A practical prompt playbook for using Chain-of-Thought Root Cause Analysis Prompt Template in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the ideal conditions, required inputs, and limitations for using the Chain-of-Thought Root Cause Analysis prompt in production incident investigations.

This prompt is designed for SREs, on-call engineers, and technical leads who are actively investigating a production incident and have already gathered initial telemetry. The primary job-to-be-done is to transform a collection of symptoms, logs, metrics, and timeline events into a structured, auditable causal chain. It forces the model to reason step-by-step from an observed symptom to the most likely root cause, requiring explicit evidence for each causal link. This is not a first-responder alerting tool or a replacement for automated runbook execution. Use it when the incident is complex enough that a linear narrative will help the team align on what is known, what is assumed, and what still needs to be proved.

The ideal user has already triaged the immediate blast radius and collected relevant data: error logs, latency spikes, deployment markers, infrastructure changes, and any correlated alerts. The prompt works best when you provide a structured [INCIDENT_TIMELINE] and a set of [OBSERVED_SYMPTOMS] as input. It is particularly effective for incidents involving multiple services, asynchronous failures, or subtle interactions where a single obvious cause does not exist. Do not use this prompt when the incident is still unfolding and you lack any concrete data, or when the resolution requires immediate automated rollback rather than analysis. It is also a poor fit for simple, well-understood failure modes that a runbook already covers.

The output is a causal chain that separates verified facts from assumptions, making it suitable for inclusion in postmortems or handoff documents. However, the model cannot access your live systems, so every claim it makes must be validated against real data before action is taken. Treat the generated analysis as a structured hypothesis, not a confirmed diagnosis. After receiving the output, your next step should be to review each 'Assumption' flag, gather the missing evidence, and update the chain. Avoid the temptation to copy-paste the analysis into an incident retrospective without human review, especially for customer-impacting or security-sensitive incidents where an incorrect root cause can misdirect remediation efforts.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Chain-of-Thought Root Cause Analysis prompt works and where it does not. Use this prompt for structured, evidence-based incident investigation. Avoid it when you need a quick answer, lack observability data, or face a novel failure mode with no known patterns.

01

Good Fit: Structured Production Incidents

Use when: you have a clear symptom, access to logs, metrics, and deployment history, and need a traceable causal chain. Why it works: the prompt forces step-by-step reasoning with evidence requirements at each link, preventing premature conclusions.

02

Bad Fit: Novel or Unprecedented Failures

Avoid when: the failure mode has never been seen before and no relevant patterns exist in the model's training data. Risk: the model may confabulate a plausible-sounding but incorrect causal chain. Guardrail: require human-led investigation for truly novel incidents; use the prompt only for documentation assistance after the fact.

03

Required Inputs: Observability Data

What you need: error logs, metric dashboards, deployment timestamps, recent change records, and service dependency maps. Risk without it: the model will invent plausible intermediate causes to fill gaps. Guardrail: validate that every causal link in the output cites a specific log line, metric anomaly, or change event.

04

Operational Risk: Logical Leaps

What to watch: the model may skip from symptom to root cause without establishing intermediate causal links. Guardrail: add a post-generation validation step that checks each link in the chain for an explicit 'because' statement backed by evidence. Flag and re-prompt any link that relies on correlation alone.

05

Operational Risk: Unverified Assumptions

What to watch: the model may treat a hypothesis as confirmed without checking it against all available evidence. Guardrail: require the prompt output to list assumptions explicitly and mark their verification status. Escalate to a human when a root cause conclusion depends on an unverified assumption.

06

Process Fit: Post-Incident Review

Use when: the incident is resolved and you need a structured postmortem or timeline reconstruction. Avoid when: the incident is still active and you need immediate mitigation. Guardrail: pair this prompt with a separate triage prompt for live incidents; use the CoT analysis for the blameless postmortem phase.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for performing a structured, evidence-grounded root cause analysis using chain-of-thought reasoning.

This section provides the core prompt template for the Chain-of-Thought Root Cause Analysis workflow. It is designed to be pasted directly into an AI harness and forces the model to reason step-by-step from an observed symptom to the most likely root cause, explicitly stating the evidence required at each link in the causal chain. The template is structured to prevent the most common failure mode in incident analysis: jumping to a conclusion based on a single, unverified hypothesis.

text
You are an SRE investigator performing a root cause analysis for a production incident. Your goal is to construct a causal chain from the initial symptom to the most probable root cause, not to generate a list of unrelated possibilities.

**Incident Summary:**
[Symptom]: [Describe the observed failure, e.g., 'HTTP 500 errors on the checkout service at 14:03 UTC']
[Alert Context]: [Paste the alert payload, dashboard link, or initial triage notes]
[Timeline of Events]: [Provide a timestamped list of deployments, config changes, or metric anomalies]
[Available Evidence]: [Paste relevant logs, graphs, error messages, or runbook links]

**Instructions:**
1.  **State the Initial Symptom:** Restate the observed failure in precise terms.
2.  **Generate Hypotheses:** List 2-4 distinct, plausible causal chains that could explain the symptom. For each hypothesis, state the key assumption that must be true.
3.  **Chain-of-Thought Analysis:** For the most likely hypothesis, construct a step-by-step causal chain from the symptom back to the root cause. At each step, you must:
    - State the causal link (e.g., 'The checkout service returned 500 errors because it could not connect to the payment gateway.').
    - List the **Required Evidence** to confirm this link (e.g., 'Checkout service connection logs showing timeout to payment-gateway.internal:443').
    - If the evidence is missing, flag it as an **[UNVERIFIED ASSUMPTION]**.
4.  **Identify the Probable Root Cause:** Conclude with the single most probable root cause based on the completed chain.
5.  **Evidence Gap Analysis:** List all [UNVERIFIED ASSUMPTION] flags from your chain. These are the highest-priority items for immediate investigation.

**Constraints:**
- Do not propose a fix until the root cause is identified.
- Distinguish between correlation and causation. A timeline match is not proof.
- If two hypotheses are equally likely, state that you are at a decision point and cannot proceed without more evidence.
- Do not fabricate evidence. If you are inferring a state, mark it as an assumption.

To adapt this template, replace the square-bracket placeholders with incident-specific data. The quality of the output is directly proportional to the quality of the [Available Evidence]. If you provide only a vague symptom, the model will generate a shallow analysis full of unverified assumptions. For high-severity incidents, the output of this prompt should be treated as a structured starting point for a human investigation, not a final verdict. The [UNVERIFIED ASSUMPTION] flags are the most critical output; they define the immediate next steps for the on-call engineer.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Chain-of-Thought Root Cause Analysis prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to programmatically verify the input before incurring inference cost.

PlaceholderPurposeExampleValidation Notes

[INCIDENT_SYMPTOM]

The observed system behavior or alert that triggered the investigation

HTTP 500 spike on /checkout at 14:03 UTC, p99 latency jumped from 200ms to 4500ms

Must be non-empty string with at least 20 characters. Reject vague inputs like 'it broke'. Check for timestamp presence if time-series data is expected.

[SYSTEM_CONTEXT]

Architecture description, service topology, and relevant component relationships

Checkout service calls Inventory API and Payment Gateway. Inventory uses PostgreSQL primary. Payment Gateway is external SaaS.

Must include at least one dependency relationship. Parse for service names and connections. Flag if no upstream/downstream links are described.

[OBSERVABILITY_DATA]

Logs, metrics, traces, or dashboards available for the investigation window

CloudWatch log group /ecs/checkout between 13:50-14:10 UTC. Datadog dashboard link: checkout-latency. Trace ID: abc123.

Must contain at least one concrete data source reference. Validate that timestamps or time ranges are specified. Reject if only narrative descriptions without data pointers.

[RECENT_CHANGES]

Deployments, config changes, feature flags, or infrastructure modifications near the incident window

v2.4.1 deployed at 13:45 UTC. Feature flag CHECKOUT_TIMEOUT_MS changed from 2000 to 5000 at 13:30 UTC. DB migration #847 completed at 12:00 UTC.

Parse for change timestamps. Compare against incident symptom timestamp. Flag if no changes are listed within a reasonable window. Allow null if genuinely no changes occurred.

[KNOWN_CONSTRAINTS]

Explicit boundaries, assumptions, or limitations that narrow the investigation scope

Payment Gateway SLA is 99.9% with 500ms p99. Inventory DB is single-region us-east-1. No access to customer PII in logs.

Check for at least one constraint that limits hypothesis space. Flag if constraints contradict system context. Allow null if no constraints are known.

[INVESTIGATION_DEPTH]

How far to trace the causal chain before stopping

Stop at the deepest actionable system component. Do not trace into third-party vendor internals. Maximum 5 causal links.

Must be one of: 'surface', 'standard', 'deep'. Default to 'standard' if not specified. Validate against allowed enum values. Reject values like 'infinite' or 'until found'.

[OUTPUT_FORMAT]

Desired structure for the causal chain output

Markdown with numbered causal steps, evidence block per step, and a final root cause summary section

Must match one of: 'markdown', 'json', 'structured_log'. Validate against allowed enum. If 'json', also validate that [OUTPUT_SCHEMA] is provided and parseable.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Chain-of-Thought Root Cause Analysis prompt into an incident response application or SRE workflow.

This prompt is designed to be integrated into an incident management or observability platform, not used as a one-off chat interaction. The harness must enforce a structured input contract—symptom description, timeline, affected services, recent changes, and available telemetry—before the model receives the prompt. Because root cause analysis in production environments carries high operational risk, the implementation should treat the model's output as a hypothesis generator, not an authoritative diagnosis. The harness must include a human-in-the-loop review step before any remediation actions are taken based on the analysis.

Wire the prompt into a backend service that assembles the [INPUT] variables from incident tickets, monitoring alerts, and deployment logs. Use a structured JSON schema for the output, enforcing fields like causal_chain (an ordered list of cause-effect pairs), evidence_map (a mapping of each causal link to supporting telemetry), confidence_scores (per-link confidence estimates), and unverified_assumptions (explicitly flagged gaps). Implement a validation layer that checks for logical leaps: if a causal link lacks corresponding evidence in the evidence_map, flag it for human review. Use a model with strong reasoning capabilities (such as Claude 3.5 Sonnet or GPT-4o) and set a low temperature (0.1–0.2) to prioritize deterministic, traceable reasoning over creative exploration. Log every invocation with the full prompt, model response, and validator results for post-incident review and prompt iteration.

Build a retry-and-escalation path into the harness. If the output fails schema validation or the model returns a refusal, retry once with a simplified prompt that asks only for the top three hypotheses with evidence requirements. If the retry also fails, escalate to the on-call engineer with the raw incident context and a note that automated analysis was inconclusive. For high-severity incidents, consider running the prompt in parallel across two different models and diffing the causal chains—divergent analyses are a strong signal that human judgment is required. Avoid wiring this prompt directly to automated remediation runbooks; the causal chain is an input to human decision-making, not a trigger for unsupervised action.

IMPLEMENTATION TABLE

Expected Output Contract

Define the exact fields, types, and validation rules your application must enforce on the model's JSON output. Use this contract to build a parser, validator, and retry harness.

Field or ElementType or FormatRequiredValidation Rule

root_cause_statement

string

Must be a single, concise sentence. Cannot be empty or a generic placeholder like 'unknown'.

causal_chain

array of objects

Array length must be >= 2. Each object must pass the causal_link schema check.

causal_chain[].step_id

integer

Must be a sequential integer starting from 1. No gaps or duplicates.

causal_chain[].observation

string

Must reference a specific symptom, log line, metric, or event from [INCIDENT_CONTEXT].

causal_chain[].hypothesis

string

Must be a falsifiable statement. Cannot be a tautology or a restatement of the observation.

causal_chain[].evidence

array of strings

Each string must be a direct quote or a precise reference (e.g., timestamp, line number) from [INCIDENT_CONTEXT].

causal_chain[].confidence

string

Must be one of the enum values: 'high', 'medium', 'low'. Cannot be null or empty.

unverified_assumptions

array of strings

If present, each string must describe a specific assumption not yet backed by evidence in [INCIDENT_CONTEXT].

PRACTICAL GUARDRAILS

Common Failure Modes

Chain-of-thought root cause analysis prompts fail in predictable ways. These cards cover the most common failure modes, why they happen, and how to guard against them before the prompt reaches production.

01

Logical Leap Without Evidence

What to watch: The model skips from symptom to root cause in a single step without establishing intermediate causal links. The output reads like a confident guess rather than a traceable chain. Guardrail: Require each causal link to cite specific evidence from logs, metrics, or system state. Add a validation step that flags any link without supporting evidence and demands a [MISSING_EVIDENCE] marker.

02

Unverified Assumption Cascade

What to watch: An early unverified assumption becomes the foundation for downstream reasoning, producing a coherent but entirely wrong analysis. Common with memory pressure, network partition, or config change hypotheses. Guardrail: Add an explicit [ASSUMPTION] tag requirement for any claim not directly supported by provided evidence. Include a post-chain validation pass that lists all assumptions and rates their verification status.

03

Premature Root Cause Closure

What to watch: The model latches onto the first plausible cause and stops exploring alternatives, producing a linear chain that ignores contributing factors or concurrent failures. Guardrail: Require at least two alternative causal branches before selecting a primary root cause. Add a [ALTERNATIVE_EXPLORED] checkpoint that forces the model to articulate why competing hypotheses were ruled out.

04

Temporal Ordering Confusion

What to watch: The model reverses cause and effect, placing a downstream symptom before its trigger in the causal chain. Common when timestamps are ambiguous or log ordering is unclear. Guardrail: Require explicit timestamps or sequence markers for each causal link. Add a temporal consistency check that verifies each step's timestamp precedes the next step's observed effect.

05

Missing Blast Radius Analysis

What to watch: The chain identifies a root cause but fails to explain why the impact was wider or narrower than expected. The analysis treats the symptom scope as self-evident rather than part of the investigation. Guardrail: Add a required [BLAST_RADIUS] section that maps the root cause to observed impact scope, explicitly noting any mismatches between expected and actual affected systems.

06

Over-Confident Remediation Prescription

What to watch: The model extends the causal chain into fix recommendations without validating whether the proposed remediation actually addresses the identified root cause or introduces new risks. Guardrail: Separate root cause identification from remediation suggestion into distinct sections. Require each remediation step to explicitly reference which causal link it addresses and include a rollback feasibility note.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of a Chain-of-Thought Root Cause Analysis output before shipping it to an incident channel or runbook. Each criterion targets a specific failure mode common in AI-generated incident analysis.

CriterionPass StandardFailure SignalTest Method

Causal Chain Continuity

Every step from [SYMPTOM] to [ROOT_CAUSE] is connected by a stated causal mechanism, not correlation or temporal coincidence.

Output contains phrases like 'and then', 'after that', or 'meanwhile' without explaining why one event caused the next.

Manual trace: draw a directed graph from symptom to root cause. Every edge must have an explicit 'because' statement in the output.

Evidence Grounding

Every causal claim cites a specific log line, metric, alert, or config artifact. No step relies on 'likely', 'probably', or domain intuition without evidence.

Output includes unsupported generalizations such as 'memory pressure is a common cause' without linking to an OOM kill log or metric spike.

Regex check for citation markers or log timestamps. Spot-check 3 random claims and verify the cited evidence exists in [EVIDENCE_LOG].

Assumption Flagging

Any inference not directly supported by evidence is explicitly labeled with [ASSUMPTION] and a confidence level.

The output presents a complete, confident narrative with no uncertainty markers, even where evidence is missing.

Scan for [ASSUMPTION] tokens. If the output contains zero assumptions in a complex incident, flag for review. Check that each assumption has a confidence tag.

Alternative Hypothesis Consideration

At least one plausible alternative root cause is stated and ruled out with evidence, not dismissed without reasoning.

The output presents a single linear story with no mention of other possibilities that were considered and rejected.

Count distinct hypothesis sections. Require at least one 'Alternative Considered' block with a reason for rejection tied to evidence.

Logical Leap Detection

No step in the chain jumps more than one inferential level. Each conclusion follows directly from the preceding evidence and causal mechanism.

A step asserts a root cause (e.g., 'database lock contention') from a symptom (e.g., 'high latency') without intermediate mechanism steps.

Parse the causal chain into discrete steps. Flag any step where the distance between premise and conclusion requires more than one unstated inference.

Timeline Consistency

All cited timestamps are monotonically increasing and consistent with the causal direction. Effects do not precede causes.

The output claims a cause at timestamp T+5 caused an effect at timestamp T, or timestamps are omitted entirely.

Extract all timestamps from the output. Sort and verify that each cause timestamp is less than or equal to its effect timestamp. Flag missing timestamps.

Actionability of Root Cause

The final [ROOT_CAUSE] is specific enough that an on-call engineer can act on it: a config change, a code fix, a capacity adjustment, or a rollback.

The root cause is a vague category like 'resource exhaustion' or 'network issue' without specifying which resource, which network path, or what changed.

Present the root cause statement to an engineer. Ask: 'Do you know what to fix?' If the answer requires further investigation, the output fails.

Remediation Alignment

Any suggested remediation directly addresses the identified root cause, not just the symptom. Includes rollback or validation steps.

The output suggests restarting a service or increasing a timeout without explaining how that prevents recurrence of the root cause.

Map each remediation step to a specific node in the causal chain. Flag any remediation that only touches the symptom node without addressing upstream causes.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and manual review. Start with a single incident and iterate on the reasoning chain before adding validation harnesses. Keep the output format flexible—Markdown is fine.

Watch for

  • Logical leaps where the model skips from symptom to assumed root cause without intermediate evidence
  • Missing evidence requirements at each causal link
  • Overly broad instructions that don't force step-by-step reasoning
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.