Inferensys

Prompt

Circuit Breaker Open State Recovery Prompt

A practical prompt playbook for distributed systems engineers to generate safe, gradual recovery plans when a circuit breaker enters an open state. Includes a copy-ready template, variable definitions, output contract, and evaluation rubric.
AI evaluator reviewing output quality on laptop, comparison metrics visible, casual evaluation session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the precise operational context, user, and preconditions for using the Circuit Breaker Open State Recovery Prompt.

This prompt is for distributed systems engineers and SREs who need a structured, safe recovery plan after a circuit breaker trips. It is designed to be wired into an incident response harness or a reliability automation pipeline. The prompt consumes a trip event, downstream error metrics, and the current service configuration. It produces a step-by-step recovery plan that prioritizes preventing cascading failures and mandates a gradual traffic ramp-up.

Use this prompt when manual recovery runbooks are insufficient, when the system is complex enough that a misconfigured reset could cause a thundering herd or retry storm, or when you need an auditable, evidence-backed recovery recommendation before executing changes. The prompt is ideal for post-incident analysis where the system is stable but the path to safely closing the circuit is unclear. It is not a real-time actuation tool; it is a decision-support system for the recovery analysis phase.

Do not use this prompt for real-time circuit breaker actuation. It is for the recovery analysis phase after a trip has occurred and the system is stable. Avoid using it when the downstream service is still actively failing, when you lack error metrics or configuration data, or when an automated rollback is already in progress. In those cases, the prompt will produce a plan based on stale or incomplete information, which can lead to an unsafe recovery recommendation.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Circuit Breaker Open State Recovery Prompt works, where it fails, and the operational preconditions required before trusting its output.

01

Good Fit: Post-Trip Recovery Planning

Use when: a circuit breaker has tripped, downstream error rates are known, and the operator needs a safe step-by-step recovery plan. Guardrail: The prompt must receive the trip event payload, recent error metrics, and current breaker configuration to produce a plan that includes gradual ramp-up and rollback criteria.

02

Bad Fit: Real-Time Automated Execution

Avoid when: the output will be fed directly into an automated control loop that modifies breaker state without human review. Guardrail: Always require a human-in-the-loop approval step before applying any configuration change suggested by the model, especially in production traffic paths.

03

Required Input: Trip Context and Error Budget

What to watch: The model cannot reason about safe recovery without the trip reason, downstream service error rates, latency percentiles, and the current error budget remaining. Guardrail: Validate that all required input fields are present and non-null before invoking the prompt; abort and escalate if critical telemetry is missing.

04

Operational Risk: Cascading Failure Blindness

What to watch: The model may suggest re-enabling a breaker without considering upstream backpressure or dependent services that are still degraded. Guardrail: Include a dependency graph summary in the prompt context and instruct the model to check upstream health before recommending re-engagement.

05

Operational Risk: Overconfident Configuration Changes

What to watch: The model may produce specific timeout, threshold, or retry values that are not validated against the service's actual capacity. Guardrail: Post-process the output to flag any numeric configuration change; require the operator to confirm the value against runbook limits before applying.

06

Boundary: When to Escalate Instead

What to watch: Repeated trips, unknown failure signatures, or error rates exceeding defined critical thresholds indicate the model's recovery plan is insufficient. Guardrail: Define a hard escalation rule: if the breaker has tripped more than [N] times in [window] or the error rate exceeds [X%], skip the prompt and page the on-call engineer.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

Paste this prompt into your harness to generate a safe recovery plan when a circuit breaker trips in production.

This prompt template is designed for distributed systems engineers who need a structured, safe recovery plan when a circuit breaker enters an open state. It consumes a trip event, downstream error rates, service configuration, and deployment topology to produce a step-by-step recovery or configuration change recommendation. The prompt enforces a gradual ramp-up strategy, explicit rollback criteria, and a prohibition on immediate full-restoration to prevent cascading failures.

text
You are an SRE assistant specialized in distributed system resilience. Your task is to produce a safe recovery plan for a circuit breaker that has transitioned to an OPEN state.

## INPUT
- Trip Event Details: [TRIP_EVENT]
- Downstream Error Rates (last 5 minutes): [DOWNSTREAM_ERROR_RATES]
- Service Configuration (timeout, threshold, half-open max requests): [SERVICE_CONFIG]
- Deployment Topology (callers, callees, fallback paths): [TOPOLOGY]
- Recent Deployments or Config Changes: [RECENT_CHANGES]
- Current Circuit Breaker State: OPEN

## CONSTRAINTS
- Do NOT recommend immediate full restoration of traffic.
- Every recovery step must include a success criterion and a rollback trigger.
- The plan must start with a traffic ramp of no more than 10% of normal load.
- If downstream error rates exceed [ERROR_THRESHOLD]% during any ramp step, recommend immediate halt and escalation.
- If the root cause is unknown, recommend diagnostic steps before any traffic restoration.
- Prefer configuration changes over code deployments unless a bug is confirmed.

## OUTPUT_SCHEMA
Return a JSON object with the following structure:
{
  "diagnosis": {
    "likely_root_cause": "string",
    "confidence": "low|medium|high",
    "evidence": ["string"]
  },
  "recovery_plan": [
    {
      "step_number": integer,
      "action": "string",
      "traffic_percentage": integer or null,
      "success_criterion": "string",
      "rollback_trigger": "string",
      "expected_duration_seconds": integer
    }
  ],
  "escalation_criteria": ["string"],
  "recommended_configuration_changes": [
    {
      "parameter": "string",
      "current_value": "string",
      "proposed_value": "string",
      "rationale": "string"
    }
  ],
  "do_not_do": ["string"]
}

## RISK_LEVEL
[RISK_LEVEL]

If RISK_LEVEL is "high", add a human-approval gate before any automated action. If RISK_LEVEL is "critical", produce only a diagnostic summary and escalate immediately.

To adapt this template, replace each square-bracket placeholder with live data from your monitoring stack, deployment tracker, and incident context. The [TRIP_EVENT] should include the exact timestamp, the circuit name, and the failure count that triggered the open state. The [DOWNSTREAM_ERROR_RATES] must be a recent time-series snapshot—stale data leads to unsafe ramp decisions. The [ERROR_THRESHOLD] should be set conservatively; a common starting point is 5% for critical paths and 15% for non-critical ones. Before wiring this into an automated harness, test the prompt against at least three historical incidents where the correct recovery action is known, and confirm the model does not recommend a full traffic restore as step one.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate each before calling the model.

PlaceholderPurposeExampleValidation Notes

[CIRCUIT_BREAKER_TRIP_EVENT]

The raw event payload from the circuit breaker indicating the open state

{"circuit": "payment-service", "state": "open", "failure_rate": 0.85, "trip_time": "2025-01-15T10:23:00Z"}

Must be a valid JSON object. Check for required fields: circuit, state, failure_rate, trip_time. Reject if state is not 'open'.

[DOWNSTREAM_ERROR_RATES]

Error rate metrics for each downstream dependency in the last window

{"payment-service": 0.85, "inventory-service": 0.02, "auth-service": 0.01}

Must be a valid JSON object with numeric values between 0.0 and 1.0. Validate that the tripped circuit's error rate exceeds the configured threshold.

[SERVICE_CONFIGURATION]

Current circuit breaker configuration including thresholds and timeouts

{"failure_threshold": 0.50, "open_timeout_seconds": 60, "half_open_max_requests": 3, "ramp_up_steps": 5}

Must be a valid JSON object. Validate presence of failure_threshold, open_timeout_seconds, half_open_max_requests. Reject if ramp_up_steps is less than 1.

[RECENT_DEPLOYMENT_EVENTS]

Deployment or config change events in the window preceding the trip

["payment-service v2.3.1 deployed at 10:15", "connection pool reduced from 100 to 50 at 10:18"]

Array of strings or structured events. Null allowed if no recent changes. If present, each entry must have a timestamp for correlation with the trip event.

[HEALTH_CHECK_RESULTS]

Latest health check results for the tripped service and its dependencies

{"payment-service": {"status": "degraded", "latency_p99_ms": 5000}, "inventory-service": {"status": "healthy", "latency_p99_ms": 45}}

Must be a valid JSON object keyed by service name. Each entry must include status and latency_p99_ms. Reject if the tripped service shows 'healthy' without a latency spike.

[DEPENDENCY_GRAPH]

The service dependency graph showing call paths and criticality

{"payment-service": {"depends_on": ["inventory-service", "auth-service"], "criticality": "high"}}

Must be a valid JSON object. Validate that the tripped circuit exists as a key. Check for circular dependencies that could amplify cascading failures.

[PREVIOUS_RECOVERY_ATTEMPTS]

Log of prior recovery actions taken in this incident, if any

["attempt_1: manual close at 10:25, re-tripped at 10:26", "attempt_2: increased timeout to 120s at 10:28, still failing"]

Array of strings or structured attempt records. Null allowed if this is the first recovery attempt. If non-null, each entry must describe the action and outcome to prevent repeated failed strategies.

[RAMP_UP_CONSTRAINTS]

Operational constraints for gradual recovery, such as max traffic percentage per step

{"max_traffic_per_step_pct": 10, "step_duration_seconds": 30, "rollback_trigger_error_rate": 0.20}

Must be a valid JSON object. Validate that max_traffic_per_step_pct is between 1 and 100. Reject if step_duration_seconds is less than 10 to prevent unsafe rapid ramp-up.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Circuit Breaker Open State Recovery Prompt into an incident response or reliability automation workflow.

This prompt is designed to be called by an automation harness—not a human chat interface—when a circuit breaker transitions to the open state. The harness should trigger on a circuit breaker event from your observability stack (e.g., a webhook from Prometheus Alertmanager, a PagerDuty incident, or a custom operator watching circuit breaker metrics). The prompt receives structured context about the trip event, downstream error rates, and the current service configuration, then returns a recovery plan that the harness can either execute automatically (for low-risk changes like adjusting thresholds) or queue for human approval (for high-risk changes like modifying the circuit breaker's half-open max request count).

Wiring the prompt into your workflow: The harness should construct the prompt's [CIRCUIT_BREAKER_EVENT], [DOWNSTREAM_METRICS], and [SERVICE_CONFIG] inputs from your monitoring and configuration systems. After calling the model, validate the output against a strict schema: the recovery plan must include a ramp_up_strategy field with explicit step counts and cooldown durations, a configuration_changes array with old and new values, and a risk_assessment block. Reject any output that proposes removing the circuit breaker entirely or setting the failure threshold to an unreasonably high value. For high-risk environments, route the plan to a human reviewer via a Slack message or ticket before applying any configuration changes. Log every prompt invocation, the raw model output, the validation result, and the final action taken for post-incident review.

Retry and fallback logic: If the model returns an unparseable response or fails schema validation, retry once with a simplified prompt that includes the validation error message. If the second attempt also fails, escalate to the on-call engineer with the original circuit breaker event context and a note that automated recovery planning failed. Never retry more than twice for the same event—circuit breaker recovery is time-sensitive, and waiting too long defeats the purpose. For model selection, prefer a model with strong structured output capabilities and low latency (e.g., Claude 3.5 Sonnet or GPT-4o with JSON mode). Avoid using smaller, less reliable models for this workflow because an incorrect recovery plan can cause cascading failures.

Testing the harness before production: Build a test suite that replays historical circuit breaker trip events through the harness and checks that the generated recovery plans are safe and actionable. Include adversarial test cases: a trip event with 100% downstream error rates should produce a plan that keeps the circuit open and escalates for manual investigation, not a plan that attempts a gradual ramp-up. A trip event caused by a single slow request during a deployment should produce a plan that allows a quick half-open probe. Run these tests as part of your CI pipeline whenever the prompt template or validation logic changes. Monitor the harness in production by tracking the time from circuit breaker trip to recovery plan delivery, the human approval rate, and whether applied plans actually resolved the downstream errors without causing new trips.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the recovery plan produced by the Circuit Breaker Open State Recovery Prompt. Use this contract to parse, validate, and route the model response before applying any configuration changes.

Field or ElementType or FormatRequiredValidation Rule

recovery_decision

enum: proceed, hold, rollback

Must be exactly one of the three enum values. Any other value triggers a retry or human escalation.

trip_root_cause

string

Must be a non-empty summary grounded in the provided [TRIP_EVENT] and [DOWNSTREAM_ERROR_RATES]. Null or empty string fails validation.

gradual_ramp_strategy

object

Must contain initial_rate (integer 1-100), step_increment (integer 1-50), and step_interval_seconds (integer >= 30). Missing keys or out-of-range values fail.

configuration_changes

array of objects

If present, each object must have parameter (string), current_value (string), proposed_value (string), and justification (string). Empty array is allowed when no changes are needed.

cascading_failure_risk

enum: low, medium, high

Must be one of the three enum values. If high, the recovery_decision must be hold or rollback. Mismatch triggers a consistency check failure.

pre_conditions_checklist

array of strings

Must contain at least one item. Each item must be a verifiable condition (e.g., 'downstream service X error rate below 5%'). Empty array fails.

estimated_recovery_time_seconds

integer

If provided, must be a positive integer. Null is allowed when recovery time is indeterminate. Negative values fail.

human_approval_required

boolean

Must be true when cascading_failure_risk is high or recovery_decision is rollback. Schema check enforces this rule post-parse.

PRACTICAL GUARDRAILS

Common Failure Modes

Circuit breaker recovery prompts operate in high-stakes distributed systems where a wrong move can trigger cascading failures. These cards cover the most common failure modes and how to guard against them in production.

01

Immediate Full-Open Recovery

What to watch: The model proposes restoring all traffic at once after a trip event, ignoring the need for gradual ramp-up. This risks re-tripping the breaker immediately if the downstream service hasn't fully recovered. Guardrail: Add a hard constraint in the prompt requiring a staged recovery plan with explicit traffic percentages per step, and validate the output contains at least three ramp-up stages before accepting.

02

Ignoring Downstream Error Budget

What to watch: The recovery plan focuses only on the circuit breaker state without analyzing whether the downstream service's error budget is exhausted. Reopening into a still-failing dependency causes immediate re-trip. Guardrail: Require the prompt to ingest downstream error rate metrics as a required input, and add an eval check that the output references current error rates before recommending any traffic restoration.

03

Configuration Change Without Rollback

What to watch: The model proposes a timeout or threshold configuration change but omits a rollback condition. If the new config is too permissive, the system stays open to cascading failures with no automatic escape hatch. Guardrail: Add an output schema field for rollback_condition and validate that every configuration change includes a specific metric threshold that triggers reversion.

04

Missing Service Dependency Context

What to watch: The prompt receives only the tripped breaker's state without the dependency graph. The recovery plan may restore traffic to a service that depends on another still-failing component, creating a hidden failure chain. Guardrail: Include a required dependency_graph input in the prompt template, and add an eval that checks the output mentions upstream and downstream dependencies before authorizing traffic restoration.

05

Hallucinated Metric Thresholds

What to watch: The model invents plausible-sounding but nonexistent metric thresholds or SLO targets when the input doesn't provide them. This produces a recovery plan that looks reasonable but is untethered from actual service objectives. Guardrail: Constrain the prompt to only reference thresholds explicitly provided in the input context, and add a grounding check that flags any numeric threshold not present in the source data.

06

Retry Storm from Recovery Loop

What to watch: An automated harness retries the recovery prompt on failure without a retry budget, generating a storm of configuration changes that destabilize the system further. Each retry may propose a different plan, creating configuration churn. Guardrail: Implement a circuit breaker on the recovery prompt itself—limit to three attempts with exponential backoff, and escalate to a human on-call after the budget is exhausted.

IMPLEMENTATION TABLE

Evaluation Rubric

Run these checks against a golden dataset of 10-15 historical circuit breaker trip events to validate the recovery prompt before production deployment.

CriterionPass StandardFailure SignalTest Method

Cascading Failure Prevention

Recovery plan includes explicit checks that downstream services are healthy before allowing traffic to resume

Plan recommends immediate full traffic restoration without verifying downstream readiness

Golden dataset: inject scenarios where downstream error rates remain elevated; confirm plan blocks or delays recovery

Gradual Ramp-Up Strategy

Plan specifies incremental traffic increase with defined thresholds (e.g., 10%, 25%, 50%, 100%) and a back-off condition

Plan suggests binary open/close without intermediate states or omits rollback criteria

Parse output for ramp-up stages; verify each stage has a numeric percentage and a failure threshold that triggers regression

Root Cause Identification

Output names the specific error type or downstream service that triggered the trip, sourced from provided [ERROR_RATE_CONTEXT]

Output describes the trip generically without referencing provided error data or fabricates a cause not present in inputs

Cross-reference output claims against [ERROR_RATE_CONTEXT] fields; flag unsupported assertions

Configuration Change Safety

Any suggested change to [CIRCUIT_BREAKER_CONFIG] includes a justification tied to observed error patterns and a rollback instruction

Configuration change proposed without evidence from inputs or without a reversibility statement

Schema check: if config change block is present, require both evidence-reference field and rollback field populated

Half-Open State Validation

Plan correctly identifies whether the circuit breaker is in half-open state and adjusts recovery accordingly

Plan treats half-open state identically to fully open or fully closed state

Golden dataset: include half-open scenarios; verify output distinguishes state and modifies ramp-up or probe logic

Timeout and Retry Alignment

Recommended timeouts and retry budgets are consistent with [CIRCUIT_BREAKER_CONFIG] values or explicitly justified deviations

Plan recommends timeout values that conflict with existing config without explanation

Extract numeric timeout/retry values from output; compare to [CIRCUIT_BREAKER_CONFIG]; flag unexplained deltas

Human Approval Gate

Output flags the recovery plan for human review when [ERROR_RATE_CONTEXT] shows error rate above 50% or when multiple downstream services are affected

Plan proceeds with automated recovery without human-in-the-loop recommendation under high-severity conditions

Golden dataset: include high-severity trip events; verify output contains approval-required flag or escalation language

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call and no external validation. Focus on getting a readable recovery plan from the trip event and error rates. Replace [SERVICE_CONFIG] with a simple JSON blob containing circuit breaker thresholds, half-open limits, and downstream service names. Skip the gradual ramp-up schema enforcement and let the model produce a free-text plan.

Watch for

  • Plans that suggest immediate full traffic restoration instead of a ramp-up
  • Missing mention of the half-open state or request probing
  • Overly generic advice that ignores the specific [DOWNSTREAM_ERROR_RATES] provided
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.