Inferensys

Prompt

API Error Rate Spike Investigation Prompt

A practical prompt playbook for using the API Error Rate Spike Investigation Prompt in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the specific incident conditions, required inputs, and operational boundaries where this prompt delivers reliable fault-domain isolation for API error rate spikes.

Use this prompt when you are an API platform engineer or on-call SRE responding to an active HTTP 5xx storm and you need to isolate the fault domain before taking remediation action. The prompt is designed for situations where error rates have crossed a defined threshold, multiple endpoints or services may be affected, and you have access to structured observability data—error code distributions, per-endpoint latency and error rate time series, recent deployment records, dependency health checks, and traffic shift metrics. The primary job-to-be-done is correlating error signals across these dimensions to produce a ranked list of probable fault domains (e.g., a specific service, database, upstream dependency, or deployment artifact) and a mitigation priority list, not a full root cause analysis or remediation runbook.

Do not use this prompt for isolated single-endpoint failures with an obvious stack trace, for client-side 4xx error investigations, or when you lack deployment and dependency data. The prompt assumes you can provide structured context: a time window, affected endpoints with error counts and codes, a deployment timeline, dependency health status, and traffic pattern summaries. If you only have raw logs or a single alert, use the Stack Trace Root Cause Analysis Prompt or Log Pattern Anomaly Detection Prompt first to assemble structured inputs. This prompt is also not a substitute for automated incident severity classification—pair it with the Incident Severity Classification Prompt if you need standardized severity assignment alongside fault-domain isolation.

The prompt produces a fault-domain isolation report with explicit evidence-to-hypothesis links, confidence indicators, and a mitigation priority list ordered by impact and reversibility. Before relying on the output, validate that the model has correctly correlated timing between deployments and error onset, has not conflated correlation with causation, and has grounded each hypothesis in specific observability signals you provided. For production incident response, always require human review of the fault-domain ranking before executing any mitigation action such as rollback, circuit breaker adjustment, or traffic shifting. Wire the output into your incident channel as a structured investigation artifact, not as an automated remediation trigger.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Use these cards to decide if the API Error Rate Spike Investigation Prompt is the right tool for your current incident.

01

Good Fit: Correlated Multi-Signal Incidents

Use when: you have a sudden spike in 5xx errors and need to correlate it with recent deploys, dependency health, and traffic shifts. The prompt excels at synthesizing multiple data sources into a single fault-domain hypothesis. Guardrail: Provide structured input for each signal (timestamps, service names, error codes) to avoid vague correlations.

02

Bad Fit: Single Stack Trace Debugging

Avoid when: you have a clear, reproducible exception with a full stack trace. This prompt is designed for systemic error rate patterns, not deep-dive code debugging. Guardrail: Route single-exception investigations to the Stack Trace Root Cause Analysis Prompt instead.

03

Required Inputs: Event Timeline and Topology

What to watch: the prompt cannot produce a useful fault-domain isolation report without a deployment timeline, service topology, and error breakdown by endpoint. Missing inputs lead to generic advice. Guardrail: Validate that you have deploy timestamps, dependency graphs, and per-endpoint error counts before invoking the prompt.

04

Operational Risk: Stale or Incomplete Data

What to watch: the prompt may confidently attribute the spike to a recent deploy when the real cause is an external dependency degradation that wasn't included in the input. Guardrail: Always cross-reference the prompt's top hypothesis against real-time dependency health dashboards before taking action.

05

Operational Risk: Correlation vs. Causation

What to watch: the prompt may over-index on temporal correlation (e.g., deploy happened 2 minutes before spike) and underweight silent failures or gradual degradation. Guardrail: Require the prompt to list alternative hypotheses with evidence for and against each, not just the top-ranked cause.

06

Escalation Trigger: Ambiguous Fault Domain

What to watch: when the prompt cannot isolate the fault to a single domain with high confidence, it may produce a vague report that feels actionable but lacks precision. Guardrail: Define a confidence threshold. If no hypothesis exceeds it, escalate to a human incident commander with the full evidence summary.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for investigating API error rate spikes, ready to be copied and adapted with your own monitoring data, repository context, and investigation constraints.

This template is designed to be wired into an automated investigation harness or used manually by an on-call engineer. It expects structured inputs from your observability stack, deployment history, and source code repository. The placeholders in square brackets must be replaced with real data before execution. Do not run this prompt with unresolved placeholders—the model will hallucinate or produce generic advice that wastes time during an incident.

text
You are an SRE investigator analyzing an API error rate spike.
Your goal is to produce a fault-domain isolation report and a mitigation priority list.

## INPUT DATA

### Error Telemetry
[ERROR_TELEMETRY_JSON]
<!-- Expected: JSON with fields: time_window_start, time_window_end, total_requests, error_count, error_rate, top_error_codes (with counts), top_failing_endpoints (with counts), latency_p99_by_endpoint, error_budget_remaining_pct -->

### Deployment History
[DEPLOYMENT_HISTORY_JSON]
<!-- Expected: JSON array of recent deployments with fields: deploy_id, service, version, deployed_at, rollback_status, diff_summary, changed_files -->

### Dependency Health
[DEPENDENCY_HEALTH_JSON]
<!-- Expected: JSON with fields: downstream_service_status, database_status, cache_status, queue_status, external_api_status, circuit_breaker_state -->

### Traffic Profile
[TRAFFIC_PROFILE_JSON]
<!-- Expected: JSON with fields: requests_per_second_over_time, top_callers, region_distribution, auth_success_rate, rate_limiter_activation_count -->

### Relevant Source Context
[SOURCE_CONTEXT]
<!-- Expected: Relevant code snippets from the repository for the top-failing endpoints, recent deployment diffs, and configuration files. Include file paths and line numbers. -->

## OUTPUT SCHEMA

Return a JSON object with this exact structure:
{
  "incident_summary": "string: one-sentence description of the spike",
  "fault_domain_isolation": {
    "primary_domain": "DEPLOYMENT | DEPENDENCY | TRAFFIC | CONFIGURATION | UNKNOWN",
    "confidence": "HIGH | MEDIUM | LOW",
    "evidence": ["string: specific evidence item with source reference"],
    "alternative_domains": ["string: other possible causes ranked by likelihood"]
  },
  "correlation_findings": [
    {
      "signal_a": "string: e.g., 'deployment v2.4.1 at 14:32'",
      "signal_b": "string: e.g., '5xx spike starting at 14:33 on /api/checkout'",
      "correlation_strength": "STRONG | MODERATE | WEAK",
      "causal_hypothesis": "string: brief explanation of possible causal link"
    }
  ],
  "mitigation_priority_list": [
    {
      "rank": 1,
      "action": "string: specific mitigation step",
      "expected_impact": "HIGH | MEDIUM | LOW",
      "risk": "string: what could go wrong",
      "rollback_plan": "string: how to undo this action",
      "evidence_basis": "string: which finding supports this action"
    }
  ],
  "unanswered_questions": ["string: what you still need to know to complete diagnosis"],
  "recommended_escalation": "NONE | ENGINEERING_LEAD | DEPENDENCY_TEAM | INFRASTRUCTURE | EXECUTIVE"
}

## CONSTRAINTS
- Ground every finding in the provided telemetry, deployment history, or source code. Do not speculate without citing evidence.
- If the data is insufficient to isolate a fault domain, set primary_domain to UNKNOWN and list what additional data is needed in unanswered_questions.
- Prioritize mitigation actions that are reversible. The top-ranked action should be the safest high-impact step.
- Do not recommend a full rollback unless deployment correlation is STRONG and the deployment touched the failing endpoints.
- If error budget remaining is below 10%, note this in the incident_summary and escalate urgency in mitigation_priority_list.
- If circuit breakers are open for any dependency, that dependency must appear in fault_domain_isolation.

## RISK LEVEL
[RISK_LEVEL]
<!-- Set to HIGH, MEDIUM, or LOW based on error budget burn rate and user impact. HIGH triggers mandatory human review of all findings before action. -->

To adapt this template for your environment, replace the telemetry placeholders with data from your actual observability tools (Datadog, Prometheus, Honeycomb, etc.). The [SOURCE_CONTEXT] placeholder should be populated by a retrieval step that pulls relevant files from your repository based on the top-failing endpoints and recent deployment diffs. If you are building an automated harness, pre-process the raw observability data into the expected JSON shapes before inserting them into the prompt. The [RISK_LEVEL] field should be computed from your SLO burn rate, not guessed—wire it to your error budget monitoring. After the model returns the JSON output, validate it against the schema before surfacing it to an on-call engineer. Any finding with confidence LOW or correlation_strength WEAK should be flagged for human review before action is taken.

IMPLEMENTATION TABLE

Prompt Variables

Inputs required for the API Error Rate Spike Investigation Prompt. Each variable must be populated from observability systems, deployment records, and dependency health checks before the prompt executes. Missing or stale data degrades fault-domain isolation accuracy.

PlaceholderPurposeExampleValidation Notes

[ERROR_WINDOW_START]

Start of the spike window in ISO 8601

2025-03-15T14:03:00Z

Must parse as valid datetime. Reject if older than 7 days or in the future.

[ERROR_WINDOW_END]

End of the spike window in ISO 8601

2025-03-15T14:11:00Z

Must be after [ERROR_WINDOW_START]. Window duration should be 5-30 minutes for spike analysis.

[ERROR_CODE_DISTRIBUTION]

JSON map of HTTP status codes to count

{"500": 1423, "502": 87, "503": 12}

Must be valid JSON. Keys must be 5xx codes. Total count must be > 0. Null allowed if no errors.

[ENDPOINT_ERROR_MAP]

JSON map of endpoint paths to error counts

{"/api/checkout": 891, "/api/auth": 412}

Must be valid JSON. Paths must start with /. Empty object allowed if errors are not endpoint-specific.

[RECENT_DEPLOYS]

Array of deployment events in the 2 hours before spike

[{"service":"payment-svc","version":"v2.4.1","deployed_at":"2025-03-15T13:58:00Z"}]

Must be valid JSON array. Each object requires service, version, and deployed_at fields. Empty array allowed.

[DEPENDENCY_HEALTH]

Health status of downstream dependencies during window

{"payment-gateway": "degraded", "inventory-db": "healthy", "auth-provider": "healthy"}

Must be valid JSON object. Values must be one of: healthy, degraded, down, unknown. Unknown allowed if telemetry is missing.

[TRAFFIC_SHIFT]

Percentage change in request volume vs same window 24h prior

+340%

Must be a string starting with + or - followed by a number and % sign. Null allowed if baseline data is unavailable.

[CONFIG_CHANGES]

Array of configuration changes in the 1 hour before spike

[{"key":"db.pool.max","old":"50","new":"200","changed_at":"2025-03-15T13:45:00Z"}]

Must be valid JSON array. Each object requires key, old, new, and changed_at fields. Empty array allowed.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the API Error Rate Spike Investigation Prompt into an incident response application or automated diagnostic workflow.

This prompt is designed to be the reasoning core of an automated incident response system, not a one-off chat interaction. The implementation harness must feed the model structured, time-bounded data from your observability stack and enforce a strict output contract that downstream tools can parse. The primary integration points are your metrics backend (for error rates, latency, and traffic data), your CI/CD pipeline (for recent deployment events), and your service dependency map. The harness should assemble these into the [CONTEXT] block before invoking the model, ensuring the prompt receives a complete, consistent snapshot of the incident window rather than relying on the model to fetch data itself.

The harness should enforce a two-phase execution pattern. In Phase 1, the model receives the full prompt and produces the fault-domain isolation report. A JSON schema validator must check the output for required fields (fault_domain_candidates, mitigation_priority, evidence_correlation) before the report is surfaced to an on-call engineer. If validation fails, the harness should retry once with the validation errors appended to the [CONSTRAINTS] block. In Phase 2, if the model identifies a specific deployment or configuration change as the primary suspect, the harness can optionally invoke a separate tool (such as a rollback dry-run or a diff generator) and feed the result back for a refined recommendation. Never allow autonomous rollback execution from this prompt's output alone; always require human approval for any infrastructure mutation.

For model selection, prefer a model with strong structured output capabilities and a context window large enough to hold at least 50 data points per endpoint plus deployment metadata. GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro are suitable defaults. Set temperature to 0 or a very low value (0.1) to maximize deterministic, repeatable analysis. Log every invocation—including the full prompt, raw response, validation result, and the on-call engineer's eventual action—to an audit table. This traceability is critical for postmortem reviews and for tuning the prompt's thresholds (e.g., what constitutes a 'spike' in your environment). The next step is to define your eval harness using historical incidents where the root cause is known, so you can measure whether the prompt's fault_domain_candidates ranking places the true cause in the top position.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the structured output of the API Error Rate Spike Investigation Prompt. Use this contract to parse, validate, and integrate the model's response into downstream incident management tooling.

Field or ElementType or FormatRequiredValidation Rule

fault_domain_isolation

object

Must contain at least one key-value pair mapping a fault domain name to a confidence score between 0.0 and 1.0. Sum of scores must not exceed 1.0.

fault_domain_isolation.[domain_name]

number

Must be a float between 0.0 and 1.0. Represents the likelihood that the domain is the primary fault contributor.

correlated_events

array of objects

Must be a non-empty array. Each object must have 'timestamp', 'source', and 'event' string fields. 'timestamp' must be ISO 8601.

mitigation_priority_list

array of objects

Must be a non-empty array. Each object must have 'action', 'rationale', and 'priority' fields. 'priority' must be one of 'P0', 'P1', 'P2', 'P3'.

recent_deploy_risk_assessment

object

Must contain 'deploy_id' (string), 'risk_score' (number 0.0-1.0), and 'evidence' (array of strings). 'evidence' must not be empty if risk_score > 0.5.

dependency_health_summary

object

Must map dependency names to objects with 'status' (enum: 'healthy', 'degraded', 'unhealthy') and 'latency_p95_ms' (number).

traffic_shift_analysis

object

Must contain 'baseline_rps' (number), 'current_rps' (number), and 'anomaly_detected' (boolean). If 'anomaly_detected' is true, 'deviation_percent' (number) is required.

investigation_summary

string

Must be a non-empty string between 50 and 500 characters. Must not contain markdown. Must explicitly state the most likely root cause hypothesis.

PRACTICAL GUARDRAILS

Common Failure Modes

When an API error rate spike investigation prompt fails in production, the failure is rarely a single bad output. It is usually a cascade of missing context, hallucinated correlations, and unverified assumptions. These cards cover the most common failure modes and the guardrails that prevent them.

01

Hallucinated Dependency Blame

What to watch: The model confidently blames a downstream dependency or recent deploy without evidence, fabricating a plausible but false causal chain. This happens when the prompt lacks explicit grounding requirements. Guardrail: Require every causal claim to cite a specific log line, metric timestamp, or deployment event. Add a validator that rejects outputs containing unsupported blame statements.

02

Missing Correlation Context

What to watch: The model identifies a spike in 5xx errors but fails to correlate it with the coincident latency degradation, connection pool exhaustion, or circuit breaker trip that reveals the true root cause. Guardrail: Include a required output section for cross-signal correlation. The prompt must instruct the model to compare error rate timing against latency, saturation, and dependency health metrics before concluding.

03

Stale or Incomplete Data Reasoning

What to watch: The model treats partial data as complete, missing that the investigation window excludes the actual start of the incident or that key service logs were not ingested. Guardrail: Add a data completeness check step. The prompt should ask the model to explicitly state the time range, data sources available, and any gaps before forming hypotheses. Flag outputs that do not acknowledge missing data.

04

Overconfident Single-Cause Attribution

What to watch: The model converges on the first plausible explanation and ignores competing hypotheses, producing a single root cause when the incident is actually a compound failure. Guardrail: Require the prompt to generate at least three ranked hypotheses with evidence for and against each. Include a differential diagnosis format that forces the model to explain why alternatives are less likely.

05

Ignoring Deployment Rollback Signals

What to watch: The model fails to check whether a recent deploy was rolled back, whether a feature flag was toggled, or whether a canary was aborted—missing the most actionable remediation signal. Guardrail: Add a mandatory deployment change correlation step. The prompt must cross-reference error timing against the deployment timeline, including rollbacks, config changes, and feature flag events.

06

Unverified Remediation Recommendations

What to watch: The model suggests mitigation steps like scaling up, rolling back, or blocking traffic without verifying that the proposed action matches the diagnosed fault domain. Guardrail: Require each remediation recommendation to include a verification check and rollback plan. The output schema should separate diagnosis confidence from action confidence, and flag actions that require human approval before execution.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of the API Error Rate Spike Investigation Prompt output before shipping it in a production harness. Each criterion targets a specific failure mode common to automated incident analysis.

CriterionPass StandardFailure SignalTest Method

Fault-Domain Isolation

Output correctly assigns the spike to a specific fault domain (e.g., dependency, deploy, config, traffic) with a primary and secondary hypothesis.

Output lists multiple unrelated causes without ranking or provides a generic 'check everything' response.

Parse the output for a primary_fault_domain field. Validate it is one of the allowed enum values. Check that the justification references specific evidence from the [ERROR_LOGS] or [DEPLOY_HISTORY] input.

Evidence Grounding

Every causal claim in the evidence_log is backed by a direct quote or timestamp from the provided [INPUT_CONTEXT].

The output contains hallucinated error codes, timestamps, or dependency names not present in the provided inputs.

Use an LLM-as-judge check: for each claim in evidence_log, verify the quoted string exists in the original [INPUT_CONTEXT]. Fail if any claim is ungrounded.

Correlation Accuracy

The timeline correctly orders events from [DEPLOY_HISTORY], [ERROR_LOGS], and [DEPENDENCY_STATUS] without reversing causality.

The output claims a deploy caused an error spike, but the deploy timestamp is after the spike began.

Parse the timeline array. Assert that for any pair of linked events, the cause.timestamp is less than or equal to the effect.timestamp. Flag violations.

Mitigation Priority

The mitigation_priority_list is ordered by impact (error rate reduction) and reversibility, with the safest option first.

The list suggests a full rollback as the last resort when a targeted feature flag disable would suffice, or vice-versa.

Check that the first item in the list has a reversibility score of 'high' and an estimated_impact of 'high'. Fail if a 'low' reversibility action is ranked first without a strong justification in the rationale field.

Output Schema Compliance

The output is valid JSON that strictly matches the [OUTPUT_SCHEMA], including all required fields and correct enum values.

The output is missing the fault_domain_isolation_report key, contains a malformed timeline object, or uses an undefined severity level.

Validate the raw output string against the [OUTPUT_SCHEMA] JSON Schema definition. Reject on any schema violation.

Abstention on Missing Data

The output sets confidence_score to 'low' and explicitly lists missing critical data in the investigation_gaps field when key inputs are absent.

The output assigns a 'high' confidence score to a root cause despite a missing [DEPLOY_HISTORY] input.

Run the prompt with a deliberately empty [DEPLOY_HISTORY] input. Assert that the confidence_score is 'low' and the investigation_gaps array is not empty.

Actionable Next Steps

The immediate_actions list contains specific, executable commands or API calls (e.g., 'kubectl rollout undo deployment/X') rather than vague advice.

The output suggests 'investigate the database' without specifying which metrics to check or which commands to run.

Check that at least two items in the immediate_actions array match a known command pattern (e.g., kubectl, git revert, curl -X POST) or reference a specific runbook ID.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single error spike event and minimal output schema. Focus on getting a useful fault-domain hypothesis quickly. Replace structured JSON output with a simple markdown report. Drop the mitigation priority ranking and just ask for the top three suspects.

code
Analyze this API error spike:
- Error codes: [ERROR_CODES]
- Endpoints affected: [ENDPOINTS]
- Time window: [START] to [END]
- Recent deploys: [DEPLOY_LIST]

Give me the three most likely root causes and why.

Watch for

  • Missing source grounding: the model may invent plausible-sounding causes without linking to actual deploy timestamps or dependency status
  • Overly broad instructions producing narrative instead of structured investigation steps
  • No validation of whether the error codes actually match the described symptoms
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.