Inferensys

Prompt

Tool Failure Root Cause Hypothesis Prompt

A practical prompt playbook for using the Tool Failure Root Cause Hypothesis Prompt in production incident response workflows.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Tool Failure Root Cause Hypothesis Prompt.

This prompt is for incident responders and platform reliability engineers who need to move from 'the tool is down' to a ranked, testable set of root cause hypotheses. It takes structured incident signals—error patterns, recent changes, dependency graphs, and environmental telemetry—and produces a differential diagnosis, not a single guess. The primary job-to-be-done is accelerating the investigation phase of a tool outage by forcing structured reasoning over multiple failure domains before the team commits to a single recovery path.

Use this prompt when you have at least three concrete signals: error codes with timestamps, a known dependency graph, a list of recent changes (deploys, config pushes, upstream provider updates), and environmental context like latency baselines or resource saturation metrics. The prompt works best when the incident is ambiguous—multiple components could be at fault, and the team needs to avoid anchoring on the first plausible cause. Do not use this prompt for simple, known failure modes with a documented runbook, or when the outage is already confirmed to be an external provider issue with no internal dependency angle. It is also inappropriate for real-time automated triage without human review; the output is a hypothesis list for an experienced responder to evaluate, not a decision to execute.

The prompt requires explicit constraints on hypothesis quality: each hypothesis must be falsifiable, include the evidence that supports it, identify confounding factors that could mislead the investigation, and suggest a specific diagnostic test. Without these constraints, the model will produce plausible-sounding but untestable narratives. Wire the output into your incident channel or runbook tool, but always require a human to mark hypotheses as 'testing,' 'confirmed,' or 'ruled out' before any remediation action. The next section provides the exact prompt template you can adapt and the harness you need to make it production-safe.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Tool Failure Root Cause Hypothesis Prompt delivers value and where it creates risk. Use this to decide if the prompt fits your incident response workflow.

01

Good Fit: Structured Incident Response

Use when: You have error logs, dependency graphs, recent change records, and environmental signals from a tool outage. The prompt excels at synthesizing multiple evidence streams into ranked, testable hypotheses. Guardrail: Provide all four input categories; missing evidence degrades hypothesis quality.

02

Bad Fit: Real-Time Auto-Remediation

Avoid when: You need sub-second automated decisions or direct circuit breaker triggers. This prompt is designed for human incident responders conducting analysis, not for inline agent decision loops. Guardrail: Use the sibling Circuit Breaker State Transition Prompt for automated gating; reserve this prompt for human-led diagnosis.

03

Required Inputs: Four Evidence Categories

What to watch: The prompt requires error patterns, dependency graphs, recent changes, and environmental signals. Missing any category forces the model to guess, producing untestable hypotheses. Guardrail: Validate input completeness before invocation; if a category is unavailable, explicitly mark it as [UNKNOWN] rather than omitting it.

04

Operational Risk: Confirmation Bias Amplification

What to watch: The model may overfit to the most salient error pattern and underweight contradictory signals, especially when recent changes align with a known failure mode. Guardrail: Require the prompt to produce at least one hypothesis that contradicts the leading candidate, and have a second responder review the ranking before action.

05

Operational Risk: Untestable Hypotheses

What to watch: The model may generate plausible-sounding root causes that cannot be verified with available telemetry, wasting incident time on dead-end investigations. Guardrail: Use the eval check for hypothesis testability; reject any hypothesis that lacks a concrete verification step tied to observable signals.

06

Operational Risk: Stale Dependency Graph

What to watch: If the dependency graph input is outdated, the model will reason about tool relationships that no longer exist, producing irrelevant or misleading hypotheses. Guardrail: Timestamp the dependency graph input and reject graphs older than your change window; pair with the Tool Dependency Health Graph Analysis Prompt for freshness validation.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for generating ranked root cause hypotheses from tool failure signals.

This prompt template is designed for incident responders and reliability engineers who need to move from observing tool failure symptoms to generating testable root cause hypotheses. It ingests structured error patterns, dependency graphs, recent change logs, and environmental signals, then produces a ranked list of hypotheses with supporting evidence, confounding factors, and explicit testability criteria. The template uses square-bracket placeholders so you can wire it directly into an incident response agent, a chatbot, or an internal diagnostics tool without rewriting the core reasoning structure.

text
You are an incident diagnostics assistant specializing in distributed systems and tool dependency failures. Your task is to analyze the provided failure signals and produce a ranked list of root cause hypotheses.

## INPUT

### Error Patterns
[ERROR_PATTERNS]

### Dependency Graph
[DEPENDENCY_GRAPH]

### Recent Changes
[RECENT_CHANGES]

### Environmental Signals
[ENVIRONMENTAL_SIGNALS]

### Incident Timeline (if available)
[TIMELINE]

## CONSTRAINTS
- Rank hypotheses from most likely to least likely.
- For each hypothesis, cite specific evidence from the input signals.
- Identify at least one confounding factor per hypothesis that could mislead diagnosis.
- Mark each hypothesis as testable or not testable with current observability.
- If insufficient data exists to form a hypothesis, state that explicitly rather than guessing.
- Do not fabricate metrics, logs, or events not present in the input.

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "incident_summary": "One-sentence summary of the observed failure.",
  "hypotheses": [
    {
      "rank": 1,
      "hypothesis": "Concise root cause hypothesis.",
      "supporting_evidence": ["Evidence point 1", "Evidence point 2"],
      "confounding_factors": ["Factor that could produce similar symptoms"],
      "testability": "testable | partially_testable | not_testable",
      "suggested_test": "If testable, describe a specific diagnostic action.",
      "confidence": "high | medium | low"
    }
  ],
  "data_gaps": ["What additional data would improve diagnosis."],
  "immediate_actions": ["Actions to take before full root cause confirmation."]
}

## RISK LEVEL
[RISK_LEVEL]

If RISK_LEVEL is high or critical, prefix your response with: "HUMAN REVIEW REQUIRED: This diagnosis involves high-severity systems. Escalate before acting on these hypotheses."

To adapt this template, replace each square-bracket placeholder with data from your observability stack. [ERROR_PATTERNS] should include structured error codes, status distributions, and message signatures, not raw log dumps. [DEPENDENCY_GRAPH] works best as a concise adjacency list or Mermaid diagram showing which tools call which. [RECENT_CHANGES] should be a timestamped list of deploys, config changes, and dependency updates. [ENVIRONMENTAL_SIGNALS] captures latency percentiles, resource saturation, and upstream provider status. The [RISK_LEVEL] field gates whether the model prepends a mandatory human-review warning. For production use, validate the output JSON against the schema before surfacing hypotheses to an incident commander. Run periodic eval checks with known failure scenarios to confirm the model correctly identifies confounding factors and does not over-index on the most recent change.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Tool Failure Root Cause Hypothesis Prompt. Each placeholder must be populated with structured data before the prompt is assembled. Validation notes describe how to verify the input is well-formed before it reaches the model.

PlaceholderPurposeExampleValidation Notes

[ERROR_PATTERNS]

Structured list of observed error signatures, status codes, exception messages, and partial stack traces from the affected tool calls

{"errors":[{"code":"ECONNREFUSED","count":47,"window_seconds":300,"first_seen":"2025-01-15T14:22:01Z"}]}

Must be valid JSON array with at least one error object. Each object requires code, count, and window_seconds fields. Null not allowed.

[DEPENDENCY_GRAPH]

Directed graph of tool dependencies including upstream services, databases, caches, and network paths relevant to the failing tool

{"nodes":["payment-api","auth-service","redis-cache"],"edges":[{"from":"payment-api","to":"auth-service","protocol":"gRPC"}]}

Must be valid JSON with nodes array and edges array. Each edge requires from and to fields. Empty graph allowed if dependencies are unknown but must be explicitly declared.

[RECENT_CHANGES]

Chronological list of deployments, config changes, feature flags, secret rotations, and infrastructure modifications within the relevant time window

{"changes":[{"timestamp":"2025-01-15T13:45:00Z","type":"deploy","service":"auth-service","version":"v2.4.1","description":"Rotated JWT signing keys"}]}

Must be valid JSON array. Each change requires timestamp, type, and service fields. Empty array allowed if no changes detected. Timestamps must be ISO 8601.

[ENVIRONMENTAL_SIGNALS]

Observable metrics from the runtime environment: latency percentiles, resource utilization, rate limit counters, and health check statuses

{"metrics":[{"name":"p99_latency_ms","value":4200,"baseline":180,"unit":"ms"},{"name":"cpu_throttle_pct","value":94,"threshold":80}]}

Must be valid JSON array with at least one metric object. Each metric requires name, value, and unit or threshold. Null not allowed when tool is actively failing.

[TOOL_CONTRACT]

Expected behavior specification for the failing tool including normal response shape, timeout thresholds, idempotency guarantees, and retry semantics

{"endpoint":"POST /v1/charge","timeout_ms":5000,"idempotent":true,"expected_status":[200,201],"retry_policy":"exponential_backoff_max_3"}

Must be valid JSON object. Requires endpoint, timeout_ms, and expected_status fields. Idempotent must be boolean. Retry policy must be one of enumerated values or null.

[INCIDENT_TIMELINE]

Ordered sequence of events from first symptom detection through current state, including automated responses and human interventions already attempted

{"events":[{"timestamp":"2025-01-15T14:20:00Z","type":"alert_triggered","source":"pagerduty","detail":"payment-api error rate > 5%"},{"timestamp":"2025-01-15T14:23:00Z","type":"action_taken","actor":"auto-scaler","detail":"Scaled payment-api from 4 to 8 replicas"}]}

Must be valid JSON array with at least one event. Each event requires timestamp, type, and detail. Timestamps must be monotonically increasing. Null not allowed.

[HYPOTHESIS_COUNT]

Number of ranked root cause hypotheses the prompt should produce, controlling output verbosity and analysis depth

5

Must be an integer between 1 and 10. Values outside this range should be clamped before prompt assembly. Default to 5 if not specified.

[CONFOUNDING_FACTORS]

Known environmental or systemic factors that could mislead root cause analysis, such as correlated failures, maintenance windows, or known monitoring gaps

{"factors":[{"description":"Scheduled backup runs 14:00-14:30 UTC daily","impact":"may_cause_false_latency_spike"},{"description":"Monitoring gap: no client-side error telemetry","impact":"underreporting_user_facing_errors"}]}

Must be valid JSON array. Each factor requires description and impact fields. Empty array allowed if no known confounders. Impact must be one of enumerated values or free-text with explicit caveat.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Tool Failure Root Cause Hypothesis Prompt into an incident response workflow.

This prompt is designed to be called during active incident response, not as a background analysis tool. It should be wired into your incident management platform (e.g., PagerDuty, FireHydrant, or a custom Slack bot) so that an on-call responder can invoke it with a single command, passing the current error signature, a recent dependency graph snapshot, and any known environmental changes. The prompt expects structured inputs and returns ranked hypotheses, which means your harness must assemble those inputs from your observability stack before calling the model. Do not ask the responder to manually copy-paste logs into a text box; that introduces transcription errors and delays when every minute counts.

The harness should follow a strict validate → invoke → parse → present → log loop. Before calling the model, validate that all required placeholders are populated: [ERROR_PATTERNS] must contain structured error data (status codes, error bodies, timestamps), [DEPENDENCY_GRAPH] must be a recent snapshot from your service topology (not a stale diagram), [RECENT_CHANGES] must be pulled from your deployment or config change feed, and [ENVIRONMENTAL_SIGNALS] must include metrics like latency percentiles, CPU saturation, and upstream dependency health. If any input is missing or stale, the harness should refuse to invoke and prompt the responder to refresh the data source. After invocation, parse the model's JSON output against a strict schema that requires each hypothesis to include a testability_score (0.0–1.0) and a confounding_factors array. Reject and retry any response that fails schema validation. Log every invocation—inputs, raw output, parsed hypotheses, and the responder's eventual chosen root cause—to build a training corpus for fine-tuning and to enable post-incident review of the model's diagnostic accuracy.

For model choice, prefer a model with strong reasoning benchmarks and structured output support (e.g., Claude 3.5 Sonnet or GPT-4o with response_format set to json_schema). Set temperature to 0.1–0.2 to reduce variance in hypothesis ranking. Implement a retry budget of 2 attempts for schema validation failures, then escalate to a human with the raw model output and a warning that automated parsing failed. Do not present unvalidated hypotheses directly to the responder; a hallucinated root cause can send your incident response down a costly wrong path. Wire the harness output into your incident channel as a threaded message with the top 3 hypotheses, their testability scores, and a one-click button to log which hypothesis was confirmed or rejected after investigation. This closed feedback loop is essential for evaluating the prompt's real-world accuracy and for detecting drift in your dependency graph or error taxonomy over time.

IMPLEMENTATION TABLE

Expected Output Contract

Schema for the structured JSON object the prompt must return. Validate each field before accepting the hypothesis list for downstream incident response or automated runbook execution.

Field or ElementType or FormatRequiredValidation Rule

hypotheses

Array of objects

Array length >= 1 and <= 5. Reject if empty or exceeds max.

hypotheses[].rank

Integer (1-5)

Must be unique, sequential, and start at 1. No gaps or duplicates.

hypotheses[].root_cause_statement

String (<= 280 chars)

Must contain a specific component name from [DEPENDENCY_GRAPH] and a failure mode. Reject vague statements like 'something broke'.

hypotheses[].evidence_summary

Array of strings (1-5 items)

Each string must reference a concrete signal from [ERROR_PATTERNS], [RECENT_CHANGES], or [ENVIRONMENTAL_SIGNALS]. Reject unsupported claims.

hypotheses[].confounding_factors

Array of strings

If present, each factor must describe a condition that could mimic or mask this root cause. Null allowed if no confounders identified.

hypotheses[].testability

String enum

Must be one of: 'immediately_testable', 'requires_log_access', 'requires_config_review', 'untestable_in_current_state'. Reject unknown values.

hypotheses[].recommended_test

String (<= 500 chars)

Must describe a specific, non-destructive diagnostic action. Reject tests that require production traffic disruption unless explicitly allowed by [CONSTRAINTS].

analysis_confidence

String enum

Must be one of: 'high', 'medium', 'low'. Reject if confidence is 'high' but fewer than 3 evidence items per hypothesis or if [ERROR_PATTERNS] is incomplete.

PRACTICAL GUARDRAILS

Common Failure Modes

When diagnosing tool failures, the prompt itself can become the bottleneck. These are the most common ways root cause hypothesis prompts break in production and how to prevent them.

01

Hallucinated Dependency Graphs

What to watch: The model invents tool dependencies, error propagation paths, or system relationships that don't exist in your actual infrastructure. This produces confident but fictional root cause hypotheses that waste incident time. Guardrail: Always pass a verified dependency graph as [DEPENDENCY_MAP] input. Add an explicit instruction: 'Only reference dependencies present in the provided graph. If a relationship is not in the graph, state that it is unknown.' Validate output dependencies against the input graph before accepting hypotheses.

02

Recency Bias Toward Recent Changes

What to watch: The model overweights recent deployments, config changes, or infrastructure updates as root causes, ignoring long-standing latent bugs, resource exhaustion, or external provider issues. This is especially dangerous when the real cause is a gradual degradation that crossed a threshold. Guardrail: Require the prompt to generate hypotheses across multiple time horizons. Add a [CHANGE_WINDOW] parameter and explicitly instruct: 'Consider causes unrelated to recent changes, including cumulative resource exhaustion, dependency drift, and external provider degradation.'

03

Untestable Hypotheses

What to watch: The model produces root cause hypotheses that sound plausible but cannot be tested or falsified with available data. Examples include 'intermittent network partition' without packet loss evidence or 'race condition' without concurrency traces. These hypotheses consume investigation time without producing actionable next steps. Guardrail: Add a required [TESTABILITY_CHECK] to the output schema. For each hypothesis, require a specific test, the evidence needed to confirm or refute it, and a flag if the test cannot be executed with current observability. Reject hypotheses that lack falsifiable conditions.

04

Confirmation Bias from Error Signatures

What to watch: The model latches onto the first recognizable error pattern (e.g., timeout, 503, connection refused) and generates hypotheses that confirm that pattern while ignoring contradictory signals. This is especially dangerous when multiple failures occur simultaneously or when the root cause produces misleading surface errors. Guardrail: Instruct the prompt to explicitly list contradictory evidence for each hypothesis. Add a [CONFOUNDING_FACTORS] section to the output that identifies signals inconsistent with the leading hypothesis. Use a structured output field: 'Evidence against this hypothesis.'

05

Missing Blast Radius Context

What to watch: The model generates hypotheses that explain the observed error but fail to account for the full scope of impact. A hypothesis that explains why one service is failing but doesn't explain why other dependent services are healthy is incomplete. Guardrail: Require the prompt to validate each hypothesis against the full blast radius. Add a [BLAST_RADIUS] input describing affected and unaffected services. Include an output field: 'Does this hypothesis explain why [UNAFFECTED_SERVICE] remains healthy?' If the answer is no, the hypothesis must be downgraded or qualified.

06

Overconfidence in Single Root Cause

What to watch: The model converges on a single root cause too early, ignoring the possibility of multiple simultaneous failures, cascading effects, or compound causes. Production incidents frequently involve multiple contributing factors that interact in unexpected ways. Guardrail: Require a minimum number of distinct hypotheses (at least 3) with explicit probability estimates that sum to less than 1.0, reserving probability mass for unknown causes. Add an instruction: 'Consider compound causes where two or more independent failures coincide. If no single hypothesis explains all symptoms, explicitly state that multiple causes may be active.'

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of root cause hypotheses before shipping the prompt into an incident response harness. Each criterion targets a specific failure mode in diagnostic reasoning.

CriterionPass StandardFailure SignalTest Method

Hypothesis Testability

Each hypothesis includes a specific, falsifiable condition that can be confirmed or ruled out by a concrete observation or log query.

Hypotheses are stated as vague categories (e.g., 'network issue') without a specific check (e.g., 'check TCP retransmit rate on host X').

Parse output for each hypothesis. Assert each contains a 'falsification_check' field with a non-empty, actionable query.

Evidence Grounding

Every hypothesis is explicitly linked to at least one specific error pattern, log line, metric anomaly, or change event from the provided [INCIDENT_EVIDENCE].

Hypotheses cite generic causes not present in the evidence, or rely on external knowledge without linking to provided [DEPENDENCY_GRAPH] or [RECENT_CHANGES].

For each hypothesis, extract cited evidence IDs. Assert all IDs exist in the input [INCIDENT_EVIDENCE] payload.

Confounding Factor Identification

Output lists at least one confounding factor that could mimic or mask the true root cause, with a brief explanation of how it complicates diagnosis.

Confounding factors section is empty, contains only trivial restatements of hypotheses, or fails to explain the diagnostic complication.

Check that 'confounding_factors' array is non-empty. For each factor, assert 'complication_explanation' field length > 50 characters.

Dependency Graph Coverage

Hypotheses cover failures across multiple layers (e.g., application, service, infrastructure, external dependency) when the [DEPENDENCY_GRAPH] shows multi-layer dependencies.

All hypotheses cluster at a single layer (e.g., only 'database' failures) when the dependency graph shows upstream and downstream dependencies also in the error path.

Extract the 'layer' tag from each hypothesis. Assert the set of layers in hypotheses intersects with at least 2 distinct layers from the [DEPENDENCY_GRAPH] if the graph contains multiple layers.

Ranking Rationale

The ranked list includes a clear, evidence-based rationale for the ordering, not just a numbered list.

Hypotheses are numbered but the rationale is missing, circular ('ranked by likelihood'), or identical across all entries.

Assert that 'ranking_rationale' field exists and is unique for each hypothesis. Check that rationale strings differ by at least 20% Levenshtein distance.

Temporal Plausibility

Hypotheses account for the timeline in [INCIDENT_EVIDENCE], ensuring cause precedes effect and aligns with [RECENT_CHANGES] timestamps.

A hypothesis proposes a cause from a change that occurred hours after the incident start time, or ignores the sequence of events entirely.

For each hypothesis referencing a change, extract the change timestamp from [RECENT_CHANGES]. Assert it is before the 'incident_start_time' in [INCIDENT_EVIDENCE].

Output Schema Compliance

Output is valid JSON matching the [OUTPUT_SCHEMA] exactly, with all required fields present and no extra top-level keys.

Output is missing required fields like 'hypotheses' or 'confounding_factors', contains markdown fences, or includes hallucinated fields.

Validate output against the provided [OUTPUT_SCHEMA] using a JSON schema validator. Assert strict mode passes with no additional properties allowed.

Abstention on Insufficient Data

When [INCIDENT_EVIDENCE] is sparse or contradictory, the output explicitly notes low confidence and recommends specific additional data to collect before concluding.

Output confidently asserts a single root cause despite thin evidence, or fails to flag uncertainty when fewer than 3 distinct error signals are present.

Count distinct error signals in [INCIDENT_EVIDENCE]. If count < 3, assert that 'confidence_level' is 'low' and 'recommended_data_gaps' array is non-empty.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt\nStart with the base prompt and a single error log. Remove structured output requirements initially—just ask for a ranked list of hypotheses with brief evidence. Use a lightweight model call without retries or circuit breaker integration.\n\n```markdown\nYou are an SRE investigating a tool failure.\n\nError observed: [ERROR_SIGNATURE]\nTool affected: [TOOL_NAME]\nRecent changes: [CHANGE_LOG]\n\nList 3-5 possible root causes ranked by likelihood.\nFor each, provide one sentence of supporting evidence.\n```\n\n### Watch for\n- Overconfident single-hypothesis responses when evidence is thin\n- Missing confounding factor analysis\n- No distinction between correlation and causation\n- Model inventing tool internals it cannot know

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.