Inferensys

Prompt

Retry Budget Exhaustion Escalation Decision Prompt

A practical prompt playbook for using Retry Budget Exhaustion Escalation Decision 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 precise operational context for the Retry Budget Exhaustion Escalation Decision Prompt, clarifying its role as a deterministic gate for human-in-the-loop routing after automated recovery has failed.

This prompt is designed for a single, high-stakes job: making an auditable escalation decision when a retry budget is fully consumed. It is not a retry prompt itself, nor is it a general-purpose error handler. Its sole purpose is to fire as the terminal step in a retry harness when retry_count >= max_retries or when the error budget burn rate exceeds a defined SLO threshold. The ideal user is a reliability engineer or AI platform architect embedding this prompt into a production gateway that sits between automated retry loops and human incident response queues. The prompt ingests structured telemetry—including the original request intent, the full error chain, and the current retry budget state—and produces a deterministic routing decision, not a creative fix.

Use this prompt inside a controlled harness that has already exhausted all automated recovery strategies, such as exponential backoff with jitter, token refreshes, and model fallback routing. The harness must provide the prompt with a strict [INPUT] payload containing the retry count, the final error code, the error budget remaining, and the original user intent. The prompt's output is a structured [OUTPUT_SCHEMA] that includes a severity classification (e.g., SEV1, SEV2, SEV3), a human notification target (e.g., on-call-sre, triage-queue, no-action), and a concise incident summary. This prevents the two most common production failure modes: infinite retry loops that waste compute and silent failures where a permanently stuck request is never seen by a human.

Do not use this prompt for transient errors that are likely to succeed with a simple retry, such as a 429 rate limit or a brief 503 unavailability. Those failures should be handled by dedicated retry prompts within the budget. This prompt is the escalation gate, and invoking it prematurely creates alert fatigue and unnecessary human toil. Before wiring this into your application, ensure your harness has a clear, configurable max_retries parameter and a mechanism for tracking the error budget burn rate. The next step is to define the [OUTPUT_SCHEMA] and [CONSTRAINTS] in the prompt template so that the routing decision is machine-readable and can trigger the correct PagerDuty or ServiceNow workflow without manual parsing.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Retry Budget Exhaustion Escalation Decision Prompt works and where it introduces risk.

01

Good Fit: SLO-Aware Production Harnesses

Use when: you have defined SLOs, error budgets, and burn-rate alerts. The prompt can reason over concrete metrics to decide between a final retry and escalation. Guardrail: feed the prompt real-time error budget remaining and burn rate, not static thresholds.

02

Good Fit: Multi-Tenant Platform Control Planes

Use when: a shared service must isolate noisy-tenant retry storms. The prompt can weigh per-tenant budget exhaustion against global capacity. Guardrail: include tenant isolation rules and global circuit-breaker state in the prompt context.

03

Bad Fit: Latency-Sensitive Real-Time Paths

Avoid when: the decision itself adds unacceptable tail latency. An LLM call to decide escalation can violate the same SLO it is trying to protect. Guardrail: use a deterministic rules engine for sub-100ms decisions; reserve this prompt for async incident review or post-mortem analysis.

04

Bad Fit: Undefined Error Budgets

Avoid when: the team has not defined what 'exhausted' means. Without a numeric error budget or burn rate, the prompt hallucinates thresholds. Guardrail: reject the prompt input if error budget fields are null; return a configuration-required error instead of a guess.

05

Required Inputs

Must include: retry count, max retries configured, error budget remaining (percentage), current burn rate multiplier, SLO target, and affected service identifier. Guardrail: validate all numeric fields are present and within sane ranges before invoking the prompt.

06

Operational Risk: Infinite Loop Prevention

Risk: the prompt itself becomes part of a retry loop if escalation fails and the harness re-invokes it. Guardrail: enforce a hard circuit breaker outside the prompt—if the escalation decision has been requested more than twice for the same incident ID, bypass the prompt and page on-call directly.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for making an escalation decision when a retry budget is exhausted, designed to be wired into your production retry harness.

This prompt template is the core decision engine for your retry exhaustion handler. It is designed to be invoked by your application's retry harness only after all configured retries for a given operation have failed. The prompt ingests structured telemetry from your retry infrastructure—including error codes, retry counts, and SLO burn rates—and produces a structured escalation decision. Do not use this prompt for transient errors that are still within their retry budget; it is specifically for the terminal state where the system must decide to page a human, route to a dead letter queue, or trigger a last-resort fallback.

text
You are an SRE decision assistant. Your task is to analyze a retry budget exhaustion event and produce a structured escalation decision. You must not suggest further retries. Base your decision strictly on the provided telemetry.

[CONTEXT]
Operation ID: [OPERATION_ID]
Operation Description: [OPERATION_DESCRIPTION]
Error Budget Remaining: [ERROR_BUDGET_REMAINING]%
Current SLO Status: [SLO_STATUS]

[RETRY_TELEMETRY]
Total Retries Attempted: [TOTAL_RETRIES]
Retry Budget Limit: [RETRY_BUDGET_LIMIT]
Final Error Code: [FINAL_ERROR_CODE]
Final Error Message: [FINAL_ERROR_MESSAGE]
Retry Log Summary:
[RETRY_LOG_SUMMARY]

[CONSTRAINTS]
- Do not recommend any further automated retries.
- If the error is a client error (4xx except 429), the decision must be to route to a human for review.
- If the error budget remaining is below 5%, the incident severity must be classified as 'critical'.
- The fallback action must be a concrete, executable step, not a suggestion.

[OUTPUT_SCHEMA]
{
  "decision": "escalate_to_human" | "route_to_dlq" | "trigger_last_resort_fallback",
  "incident_severity": "critical" | "high" | "medium" | "low",
  "routing_target": "string (e.g., on-call pager duty schedule, dead letter queue ARN, fallback function URL)",
  "summary_for_operator": "A concise, one-paragraph summary of the failure, the retries attempted, and the reason for this escalation decision.",
  "fallback_action": "A specific, executable instruction for the system to perform if 'trigger_last_resort_fallback' is chosen, otherwise null."
}

To adapt this template, replace every square-bracket placeholder with live data from your retry infrastructure. The [RETRY_LOG_SUMMARY] should be a concise, structured log of each attempt, including timestamps, durations, and error codes. The [OUTPUT_SCHEMA] is a contract for your harness; parse the model's JSON response and use the decision field to control the next step in your workflow. For high-risk environments, always log the full prompt and completion for auditability, and consider a human-in-the-loop approval step before executing a trigger_last_resort_fallback action that could modify production state.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Populate these from your retry harness, observability stack, and service catalog before invoking the model.

PlaceholderPurposeExampleValidation Notes

[RETRY_COUNT]

Current number of attempts already made for this operation

3

Must be integer >= 0. If null, treat as 0. Check against [MAX_RETRIES].

[MAX_RETRIES]

Configured retry budget limit for this operation class

5

Must be integer > 0. Compare with [RETRY_COUNT] to detect budget exhaustion. Sourced from service config.

[ERROR_BUDGET_BURN_RATE]

Current rate of error budget consumption for the affected SLO

2.5x over 1h window

Must be numeric with time window. Values > 1.0 indicate accelerated budget depletion. Pull from observability stack.

[SLO_TARGET]

Service level objective threshold for the affected service

99.9% availability over 30d

Must be percentage with time window. Used to assess remaining budget headroom. Sourced from SLO dashboard.

[LAST_ERROR_MESSAGE]

Most recent error message or status code from the failed attempt

503 Service Unavailable

Must be non-empty string. Parse for error classification (4xx vs 5xx, timeout, connection reset). Used for root cause grouping.

[ERROR_CLASSIFICATION]

Categorized failure type from error taxonomy

INFRASTRUCTURE_UNAVAILABLE

Must match known enum: INFRASTRUCTURE_UNAVAILABLE, PERMISSION_DENIED, RESOURCE_EXHAUSTED, TIMEOUT, DATA_CORRUPTION, UNKNOWN. Used for escalation routing.

[INCIDENT_SEVERITY]

Current severity classification for the incident context

SEV2

Must match known enum: SEV1, SEV2, SEV3, SEV4, NONE. If null, default to SEV3. Drives notification urgency and on-call routing.

[ON_CALL_ROTATION]

Active on-call rotation identifier for escalation target

platform-sre-primary

Must be non-empty string matching service catalog rotation name. Used to route human notification. Validate rotation is active before invoking.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the escalation decision prompt into a production retry harness with validation, logging, and human-in-the-loop routing.

This prompt is designed to be called by a retry orchestration layer—not by an end user. The harness should invoke it only when a defined retry budget for a given operation has been exhausted. Before calling the prompt, the harness must assemble the required context: the operation ID, total retry count, error budget burn rate, current SLO status, and a summary of the errors encountered. This context is injected into the [RETRY_CONTEXT] placeholder. The prompt's output is a structured escalation decision, not a conversational reply, so the harness must parse the JSON output and act on the action field.

Implement a strict validation layer around the model's response. The output must conform to the defined [OUTPUT_SCHEMA], which includes an action enum of ESCALATE, DEFER, or DISCARD. If the model returns an invalid action or malformed JSON, the harness should log the raw output and default to a safe fallback—typically ESCALATE to a human on-call rotation. Never retry the escalation decision prompt itself without a dead-letter queue, as this can mask a systemic failure in the decision logic. Log the full prompt context, model response, and validation result as structured audit events for post-incident review.

For high-severity incidents, integrate the ESCALATE action directly with your incident management tool (e.g., PagerDuty, Opsgenie). The notification_routing field in the prompt's output should map to pre-configured service IDs or escalation policies in your harness. Avoid letting the model hallucinate email addresses or phone numbers; instead, have it reference logical routing keys that your application resolves. When the action is DEFER, the harness should schedule a re-evaluation after a cooldown period defined in the output's retry_after_seconds field, ensuring the system doesn't loop on a failing operation without a pause. For DISCARD, the harness must move the operation to a dead-letter queue with the full error context attached for later manual inspection.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the escalation decision output. Use this contract to build a parser that validates the model response before acting on it.

Field or ElementType or FormatRequiredValidation Rule

escalation_decision

enum: escalate | no_escalation

Must be exactly one of the allowed enum values. Reject any other string.

severity_classification

enum: SEV1 | SEV2 | SEV3 | SEV4

Must match a valid incident severity level. Reject if not in the defined set.

retry_budget_status

object

Must contain 'total_budget', 'consumed_count', and 'burn_rate_percentage' as numbers. Reject if any field is missing or non-numeric.

slo_impact_assessment

string

Must be a non-empty string with a maximum length of 500 characters. Reject if null, empty, or exceeds length limit.

recommended_action

string

Must be a non-empty string. If escalation_decision is 'escalate', must contain a valid routing target in square brackets, e.g., [on_call_lead].

human_notification_routing

array of strings

Must be a JSON array of strings. Each string must match a predefined routing label from the [ROUTING_TARGETS] list. Reject if array is empty when escalation_decision is 'escalate'.

infinite_loop_prevention_check

boolean

Must be a strict boolean (true or false). Reject if string 'true'/'false', 1/0, or null. If true, the harness must halt all retries.

reasoning_summary

string

Must be a non-empty string between 20 and 1000 characters. Reject if outside length bounds. This field is for audit logs and must be human-readable.

PRACTICAL GUARDRAILS

Common Failure Modes

When a retry budget exhaustion prompt fails, the cost is not just a bad response—it is an uncontrolled incident. These are the most common failure modes and how to prevent them before they reach production.

01

Infinite Retry Loop Despite Budget Exhaustion

What to watch: The model fails to recognize that the retry budget is exhausted and continues to suggest retries, or the harness ignores the escalation decision and loops anyway. This burns compute, delays incident response, and violates SLO error budgets. Guardrail: Implement a hard circuit breaker in the harness that counts actual retries independently of the model's output. If the model's decision does not match the counter, force escalation to the on-call rotation.

02

Incorrect Severity Classification Leading to Noisy Alerts

What to watch: The prompt classifies a transient, low-impact error as a critical incident, waking up an on-call engineer unnecessarily. Conversely, it may downplay a cascading failure as a minor glitch. Guardrail: Cross-reference the model's severity output against a static SLO burn-rate threshold. If the model's classification conflicts with the quantitative error budget burn, override the severity and log the discrepancy for prompt tuning.

03

Missing or Incorrect Notification Routing

What to watch: The escalation decision correctly identifies the need for human intervention but routes the notification to the wrong team, a silenced channel, or omits the routing key entirely. Guardrail: Validate the output against a known service-ownership catalog. If the notification_target does not match a valid entry in the service registry, fall back to a default incident commander channel and flag the routing gap.

04

Context Window Truncation of Error History

What to watch: When a long chain of retries with detailed error messages is passed to the prompt, it exceeds the context window. The model makes an escalation decision based on only the most recent failure, missing the pattern of degradation. Guardrail: Pre-process the retry log into a structured summary (error codes, timestamps, counts) before insertion. If the raw log exceeds a token budget, inject the summary and a warning that the full history was truncated.

05

Hallucinated SLO Impact and Error Budget Data

What to watch: The model fabricates a specific error budget remaining percentage or a false SLO violation status to justify its escalation decision, making the incident report unreliable. Guardrail: Provide the actual error budget burn rate and SLO status as non-negotiable facts in the prompt's [CONTEXT] block. Add a strict instruction to never invent metrics and to state 'data not provided' if the value is missing from the context.

06

Brittle Output Parsing on Decision Enum

What to watch: The prompt returns a verbose explanation that contains the word 'escalate' but the structured decision field is malformed, missing, or contains an unexpected value like 'maybe'. The harness fails to parse it and defaults to a dangerous state. Guardrail: Use a strict schema with a constrained enum (ESCALATE, RETRY, DEFER). Implement a post-processing validator that rejects any output not matching the enum and triggers a safe fallback to ESCALATE with a parsing-failure annotation.

IMPLEMENTATION TABLE

Evaluation Rubric

Run these test cases against the Retry Budget Exhaustion Escalation Decision Prompt with known inputs to validate output quality before shipping.

CriterionPass StandardFailure SignalTest Method

Retry Budget Exhaustion Detection

Output correctly identifies when [RETRY_COUNT] >= [MAX_RETRIES] and sets escalation_required to true

escalation_required is false when retry budget is exhausted, or true when budget remains

Unit test with boundary values: [RETRY_COUNT] = [MAX_RETRIES] - 1, [RETRY_COUNT] = [MAX_RETRIES], [RETRY_COUNT] = [MAX_RETRIES] + 1

Error Budget Burn Rate Classification

Output classifies burn_rate as 'normal', 'elevated', or 'critical' based on [ERROR_BUDGET_BURN_RATE] against [SLO_BURN_RATE_THRESHOLD]

burn_rate classification does not match threshold boundaries or uses undefined categories

Parameterized test with burn rates at 0.5x, 1.0x, 2.0x, and 10.0x of threshold

Incident Severity Assignment

Output assigns severity_level matching [SEVERITY_MATRIX] rules: critical when burn_rate is 'critical' AND [SLO_REMAINING_PCT] < 50%

severity_level is 'low' when burn rate is critical and SLO remaining is below threshold, or severity is 'critical' for normal burn rate

Matrix coverage test: all combinations of burn_rate classification and SLO remaining boundary values

Human Notification Routing

Output includes notification_target matching [ON_CALL_ROTATION] for severity 'critical', [TEAM_CHANNEL] for 'elevated', and null for 'normal'

notification_target is null for critical severity, or populated for normal severity

Decision table test: verify notification_target for each severity_level against expected routing rules

Infinite Loop Prevention Signal

Output includes stop_retry_reason with a non-empty explanation when escalation_required is true

stop_retry_reason is empty, null, or missing when escalation_required is true

Assertion test: parse output and verify stop_retry_reason length > 0 when escalation_required is true

SLO Impact Quantification

Output includes slo_impact_pct calculated as [ERROR_BUDGET_CONSUMED_PCT] and slo_remaining_pct as 100 - [ERROR_BUDGET_CONSUMED_PCT]

slo_impact_pct + slo_remaining_pct does not equal 100, or values are negative

Calculation verification: test with consumed percentages of 0, 25, 50, 75, 100 and validate arithmetic

Escalation Payload Completeness

Output contains all required fields: escalation_required, severity_level, burn_rate, slo_impact_pct, slo_remaining_pct, notification_target, stop_retry_reason, recommended_action

Any required field is missing, null when it should be populated, or has wrong type

Schema validation: parse JSON output and check field presence, types, and null constraints per output contract

Recommended Action Alignment

Output recommended_action is 'page_on_call' for critical, 'notify_team' for elevated, and 'continue_retry' for normal severity

recommended_action contradicts severity_level or suggests retry when escalation_required is true

Cross-field consistency check: verify recommended_action matches severity_level and escalation_required for all test cases

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add structured input fields for retry count, error budget burn rate, circuit-breaker state, and incident severity. Include a decision schema with required fields: action (retry|escalate|defer), severity (P1-P4), routing_target, and evidence_summary. Wire into your observability stack.

code
[RETRY_COUNT]: 7
[ERROR_BUDGET_BURN_RATE]: 12x
[SLO_WINDOW]: "30d"
[CIRCUIT_BREAKER_STATE]: "open"
[LAST_N_ERRORS]: ["503", "503", "429", "503", "timeout"]
[OUTPUT_SCHEMA]: { "action": "enum", "severity": "enum", "routing_target": "string", "evidence_summary": "string" }

Watch for

  • Silent format drift in the decision schema
  • Missing human review gate for P1 incidents
  • Retry budget exhaustion not triggering escalation
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.