Inferensys

Prompt

Incident Trace Summarization Prompt for SRE Handoff

A practical prompt playbook for using Incident Trace Summarization Prompt for SRE Handoff in production AI workflows.
Engineer reviewing agent handoff workflow on laptop, task routing diagrams visible, technical office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Incident Trace Summarization prompt.

This prompt is designed for an on-call Site Reliability Engineer (SRE) or incident responder who is handing off an active investigation to the next shift. The primary job-to-be-done is to condense a messy, multi-trace incident investigation into a structured, concise handoff brief. The ideal user has already done the initial triage—they have a collection of relevant trace IDs, have formed a preliminary hypothesis, and need to transfer diagnostic signal without forcing the next responder to replay hours of raw trace analysis. The prompt requires a specific set of inputs: a list of trace IDs, the current working hypothesis, and any open questions. Without these, the output will be generic and unsafe for operational use.

Do not use this prompt for real-time alerting, as it is designed for asynchronous handoff, not automated incident detection. It is also inappropriate for postmortem authoring; a postmortem requires a broader business-impact and timeline analysis that this prompt explicitly scopes out. The prompt assumes the input traces are already correlated to the same incident. If you feed it traces from unrelated failures, it will hallucinate a false correlation. Always validate that the input trace set shares a common incident fingerprint—such as a matching deployment marker, time window, or error signature—before invoking this prompt. In high-severity incidents, the output should be treated as a draft that requires human review before being shared as the authoritative handoff document.

Before using this prompt, ensure you have gathered the required inputs: affected components, key trace IDs, your current hypothesis, and a list of open questions. The prompt is most effective when the incoming responder has enough context to continue the investigation without re-interviewing the outgoing shift. After generating the summary, validate that every claim in the 'Key Findings' section can be traced back to a specific trace ID in the input set. If the model introduces a component or failure mode not present in the provided traces, flag it for removal before handoff.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Incident Trace Summarization Prompt delivers reliable handoff value—and where it introduces operational risk.

01

Good Fit: Structured Shift Handoffs

Use when: an incident responder needs to condense 10–50 related traces into a single handoff brief for the next on-call shift. Guardrail: the prompt works best when traces are pre-filtered to a single incident window and contain consistent span attributes (trace ID, service name, error message).

02

Bad Fit: Real-Time Incident Command

Avoid when: the incident is still active and the responder needs live triage decisions. Guardrail: this prompt is designed for handoff synthesis, not real-time alert evaluation. Use the Multi-Trace Failure Pattern Detection Prompt for active incident correlation instead.

03

Required Inputs: Trace Batch and Incident Context

What to watch: the prompt produces vague or misleading summaries when traces are missing span-level detail, error codes, or timestamps. Guardrail: require a minimum input schema—trace IDs, service spans, error messages, and a one-line incident hypothesis—before invoking the prompt. Reject batches with fewer than 5 correlated traces.

04

Operational Risk: Hallucinated Root Cause

What to watch: the model may invent a root cause or overstate confidence when trace evidence is ambiguous. Guardrail: the output must label each finding with an evidence strength indicator (Confirmed, Likely, Possible) and cite specific trace IDs. Human review is required before the handoff brief is shared with the next shift.

05

Operational Risk: Stale Hypothesis Propagation

What to watch: if the input traces contain an incorrect initial hypothesis, the summary may reinforce it rather than surface open questions. Guardrail: the prompt must include a dedicated Open Questions section and flag any hypothesis that lacks trace-level corroboration. The handoff receiver should treat the summary as a starting point, not a conclusion.

06

Operational Risk: Sensitive Data in Trace Spans

What to watch: trace spans may contain PII, secrets, or customer data that should not appear in a handoff summary. Guardrail: run a redaction step on trace inputs before summarization, and add a prompt constraint that the output must not reproduce raw span payloads. Audit the summary for leaked fields before distribution.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for condensing incident-related traces into a structured SRE handoff summary.

This prompt template is designed to be the core of your incident handoff automation. It takes a batch of raw or pre-processed production traces and instructs the model to produce a concise, structured brief. The goal is to preserve diagnostic signal—affected components, key trace IDs, the current working hypothesis, and open questions—while stripping away the raw verbosity that slows down the next on-call engineer. Use this template as the foundation for a tool, a Slack command, or an automated runbook step.

text
You are an AI SRE assistant preparing a shift handoff for an active incident.

Your input is a set of production traces related to incident [INCIDENT_ID].

[TRACE_DATA]

Analyze the traces and produce a structured handoff summary. Follow these rules:
- Focus on patterns, not individual log lines.
- If a trace is incomplete or ambiguous, note it as an open question.
- Do not invent root causes not supported by the trace evidence.
- If the evidence is contradictory, state the contradiction explicitly.

[OUTPUT_SCHEMA]
Return a JSON object with the following fields:
- "incident_id": string
- "summary": string (a 2-3 sentence executive summary of the incident state)
- "affected_components": list of strings (services, models, tools, or infrastructure pieces showing errors)
- "key_trace_ids": list of strings (the 3-5 most representative trace IDs for this incident)
- "current_hypothesis": string (the leading theory for the root cause, with a confidence level: High/Medium/Low)
- "open_questions": list of strings (specific, actionable unknowns to investigate next)
- "recommended_next_checks": list of strings (concrete diagnostic steps for the next shift, e.g., 'Check auth service logs for 403 spikes')
- "evidence_summary": list of objects with "trace_id" and "finding" (a 1-sentence key finding from that trace)

[CONSTRAINTS]
- If the trace data is insufficient to form a hypothesis, set "current_hypothesis" to "Insufficient data" and confidence to "Low".
- Do not include raw stack traces in the summary.
- Limit "key_trace_ids" to a maximum of 5.

To adapt this template, replace the [TRACE_DATA] placeholder with your actual trace payload. This can be a pre-processed JSON array of spans and errors, or raw log lines if your context window allows. The [OUTPUT_SCHEMA] is the contract your downstream tooling should validate against. If you are wiring this into an automation, ensure the JSON output is parsed and checked for required fields before it is posted to an incident channel or ticket. For high-severity incidents, always flag the output for human review before the shift handoff is finalized.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Incident Trace Summarization Prompt. Each placeholder must be populated before the prompt is assembled. Missing or malformed variables will degrade the summary quality and may omit critical diagnostic signal.

PlaceholderPurposeExampleValidation Notes

[INCIDENT_ID]

Unique identifier for the incident being summarized. Used to anchor the handoff brief and link to external incident management tools.

INC-2025-07-14-0421

Must match the incident tracker ID format. Non-null. Reject if empty or 'unknown'.

[TRACE_LIST]

Ordered list of trace IDs and brief one-line descriptions selected for this incident. Provides the evidence base for the summary.

trace-9a2b1c: payment-timeout, trace-9a2b3d: auth-failure-loop

Must contain at least one trace ID. Each entry must include a trace ID and a short failure label. Reject if empty or only contains labels without IDs.

[AFFECTED_COMPONENTS]

List of services, endpoints, or system components implicated across the trace set. Drives the component-level summary.

payment-api, auth-gateway, vector-store-proxy

Comma-separated list. Null allowed if no components identified yet. If provided, each entry must match a known service catalog name or be flagged for review.

[CURRENT_HYPOTHESIS]

The working theory of root cause at the time of handoff. May be incomplete or uncertain. Preserves investigative state across shifts.

Suspect model endpoint timeout cascading from payment-api retry storm

String. Null allowed if no hypothesis formed. If provided, must be a declarative statement, not a question. Flag if exceeds 500 characters for manual truncation review.

[OPEN_QUESTIONS]

Unresolved diagnostic questions that the next shift must investigate. Prevents dropped investigative threads.

Why did auth-gateway return 200 but not propagate the token? Is vector-store-proxy latency correlated with the deploy at 03:00 UTC?

List of strings or newline-separated items. Null allowed if no open questions. Each question must be a complete interrogative sentence. Reject empty strings within the list.

[RECOMMENDED_CHECKS]

Specific next actions for the incoming responder. Prioritized list of trace queries, log searches, or metric dashboards to consult.

  1. Query traces for payment-api 5xx between 03:50-04:10 UTC. 2. Check auth-gateway deploy changelog for 03:00 UTC release.

Ordered list. Must contain at least one actionable check. Each check must include a concrete action verb and target. Reject vague entries like 'investigate more'.

[SEVERITY_LEVEL]

Current incident severity classification. Aligns the handoff with organizational incident response protocols.

SEV2

Must match an allowed severity enum: SEV1, SEV2, SEV3. Reject unknown values. Null not allowed; severity must be explicitly stated.

[HANDOFF_TIMESTAMP]

ISO-8601 timestamp of when the handoff summary was generated. Establishes the temporal boundary of the analysis.

2025-07-14T04:30:00Z

Must be valid ISO-8601 UTC. Reject if unparseable or in a non-UTC timezone. Null not allowed.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the incident trace summarization prompt into an SRE handoff workflow with validation, retries, and audit logging.

This prompt is designed to run as a batch summarization step during incident handoff, not as a real-time streaming call. The implementation harness should accept a structured payload containing the incident ID, a list of trace objects (each with trace ID, spans, error messages, and timestamps), the current hypothesis, and any open questions. The harness calls the LLM once per handoff batch, validates the output against the expected schema, and writes the result to the handoff channel (e.g., Slack, PagerDuty, incident management platform). Because this is an SRE workflow, the harness must never silently drop a failed summary—if validation fails after retries, the system should post a degraded handoff note with raw trace IDs and a human_review_required flag.

Model choice and tool use: Use a model with strong structured-output support (GPT-4o with response_format, Claude 3.5 Sonnet with tool-use mode, or equivalent). Set temperature to 0 or near-zero to maximize consistency across handoff shifts. The prompt does not require external tools or retrieval—all trace data must be provided inline in the [TRACE_BATCH] placeholder. If the trace batch exceeds the model's context window, the harness should pre-filter traces by severity, recency, or anomaly score before calling the prompt. A common pattern is to sort traces by error_budget_impact descending and take the top N that fit within a safe token budget (e.g., 80% of the model's context limit).

Validation and retry logic: After the model returns, validate the output against a strict schema: affected_components must be a non-empty array of strings, key_trace_ids must be a non-empty array of valid trace ID strings, current_hypothesis must be a non-empty string, open_questions must be an array (can be empty), and recommended_next_checks must be a non-empty array of strings. If validation fails, retry once with the validation errors appended to the prompt as [PREVIOUS_ERRORS]. If the second attempt also fails, log the raw response, emit a handoff_summary_failed metric, and fall back to a template-based summary that includes the raw trace IDs and a note that automated summarization was unavailable. Never retry more than twice—SRE handoffs are time-sensitive, and a partial summary with trace IDs is better than a delayed handoff.

Logging and audit trail: Every summarization call should log the incident ID, the number of traces provided, the model used, the token counts (input and output), the validation result, and the final summary text. Store these logs in the same observability platform that holds the raw traces (e.g., Datadog, Grafana, Honeycomb) so that incident reviewers can trace a handoff summary back to its source data. If the summary is used in a postmortem document, include a reference to the log entry so that the evidence chain is auditable. For regulated environments, consider adding a human approval step before the summary is posted to the handoff channel—the harness can route the validated output to an on-call reviewer with a 5-minute timeout before auto-posting.

What to avoid: Do not call this prompt on every individual trace—it is designed for batch summarization of an incident's trace set. Do not use it for real-time alerting; latency-tolerant models and validation steps make it unsuitable for sub-second response requirements. Do not include raw PII or secrets in the trace data passed to the model; redact sensitive fields in the harness before assembly. Finally, do not treat the summary as the sole source of truth for the incident—always preserve links to the raw traces so the next shift can drill into details the summary may have compressed or omitted.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the structured handoff summary. Use this contract to parse, validate, and store the model's output before delivering it to the next shift.

Field or ElementType or FormatRequiredValidation Rule

incident_id

string

Must match the provided [INCIDENT_ID] exactly. Reject on mismatch.

handoff_timestamp

ISO-8601 string

Must parse as a valid UTC datetime. Reject if unparseable or in the future.

affected_components

string[]

Array must contain at least one entry. Each entry must be a non-empty string matching a known service name from [SERVICE_CATALOG] if provided.

key_trace_ids

string[]

Array must contain at least one entry. Each ID must exist in the provided [TRACE_LIST]. Reject if any ID is absent from the input set.

current_hypothesis

string

Must be a non-empty string between 20 and 500 characters. Reject if empty or exceeds length limit.

hypothesis_confidence

string

Must be exactly one of: 'high', 'medium', 'low', 'unconfirmed'. Reject on any other value.

open_questions

string[]

Array must contain at least one entry. Each entry must be a non-empty string ending with a question mark. Reject if any entry lacks a terminal '?'.

recommended_next_checks

string[]

Array must contain at least one entry. Each entry must be a non-empty string. Reject if empty or contains only whitespace.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when summarizing incident traces for SRE handoff and how to guard against it.

01

Loss of Critical Diagnostic Signal

What to watch: The summarization drops a rare error code, a specific timing anomaly, or an unusual tool-call argument that is the actual root cause. The summary reads well but omits the one signal the next shift needs. Guardrail: Require the prompt to explicitly preserve all unique error codes, statuses, and outlier spans. Add a post-generation diff check that flags any trace attribute present in the input but absent from the summary.

02

False Correlation of Unrelated Traces

What to watch: The model observes multiple traces with similar symptoms (e.g., timeouts) and confidently asserts a shared root cause when the traces are from unrelated services or time windows. Guardrail: Instruct the prompt to group traces by explicit identifiers (service, host, trace ID prefix) before hypothesizing correlation. Add a validation step that requires distinct evidence from each trace before linking them.

03

Temporal Ordering Confusion

What to watch: The model misorders events, placing a symptom before its cause or reversing the propagation path. This misleads the next shift into investigating the wrong starting point. Guardrail: Require the prompt to output an explicit timestamp-ordered event sequence with trace-span evidence for each step. Validate that timestamps are monotonically increasing in the output.

04

Over-Confident Root-Cause Assertion

What to watch: The summary states a definitive root cause when the evidence is only correlative. The next shift stops investigating prematurely. Guardrail: Force the prompt to separate 'Confirmed Findings' from 'Hypotheses Requiring Validation.' Require confidence qualifiers and explicit evidence gaps. Add a human-review flag when the model cannot cite a specific span for its conclusion.

05

Trace ID and Evidence Drift

What to watch: The model hallucinates or transposes trace IDs, span IDs, or error counts, making the summary ungrounded and useless for follow-up queries. Guardrail: Constrain the output schema to require exact trace ID references. Implement a post-generation validator that checks every referenced ID against the input trace set and rejects summaries with unmatched identifiers.

06

Context Window Truncation of Key Spans

What to watch: When summarizing many long traces, the input exceeds the context window. The model summarizes from truncated data, missing the critical late-stage spans where failures manifest. Guardrail: Pre-process traces to extract only diagnostic-relevant spans (errors, high-latency steps, tool-call failures) before summarization. Add a pre-flight token count check and split across multiple summarization passes if needed.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the incident trace summarization prompt before deploying it into an SRE handoff workflow. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Affected Component Coverage

All components mentioned in input traces appear in the summary; no phantom components added.

Missing a component that had errors in the traces, or listing a component with zero trace evidence.

Diff extracted component list against a manual audit of input trace spans for 10 incident sets.

Trace ID Accuracy

Every trace ID in the summary matches an input trace ID exactly; no fabricated or truncated IDs.

Trace ID not found in input, or ID truncated in a way that breaks lookup in observability tool.

Regex match summary trace IDs against input trace ID set; verify lookup validity in target system.

Hypothesis Grounding

Each stated hypothesis cites at least one specific trace ID or span as supporting evidence.

Hypothesis stated without any trace reference, or reference points to an unrelated span.

LLM-as-judge check: for each hypothesis sentence, verify presence of a trace ID or span citation from input.

Open Question Completeness

All open questions from input traces that remain unresolved are carried forward; no invented questions.

Unresolved diagnostic flag from a trace omitted, or a question added that has no basis in input data.

Compare open questions list against unresolved error spans and explicit 'unknown' markers in input traces.

Recommended Next Checks Actionability

Every recommended check specifies a concrete observability query, log filter, or command an on-call engineer can run.

Recommendation is vague (e.g., 'investigate latency') without a specific query, filter, or target component.

Manual review: each recommendation must contain a query-like string, a component target, or a specific log path.

Output Schema Compliance

Output matches the defined [OUTPUT_SCHEMA] exactly: all required fields present, no extra top-level keys.

Missing required field, extra field, or field type mismatch (e.g., string where array expected).

Validate output against JSON Schema for [OUTPUT_SCHEMA] using a schema validator; reject on any violation.

Brevity Constraint Adherence

Summary fits within [MAX_OUTPUT_TOKENS] and contains no raw trace dumps or full log lines.

Output truncated mid-sentence, or includes raw span JSON, full stack traces, or verbose log excerpts.

Token count check; keyword scan for JSON brackets, stack trace patterns, or log timestamps in output.

Handoff Readiness

A new on-call engineer can read the summary and understand the incident state within 90 seconds without reading raw traces.

Summary requires reading raw traces to understand which components are affected or what the current hypothesis is.

Timed comprehension test with 3 on-call engineers unfamiliar with the incident; measure time-to-understand and accuracy.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet) and manual trace input. Paste raw trace excerpts into [TRACE_DATA] and accept the structured handoff summary as output. Skip strict schema validation during early testing.

Watch for

  • The model may invent trace IDs or failure hypotheses not present in the input
  • Output format drift when trace data is sparse or noisy
  • Overly confident language on ambiguous root causes
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.