This prompt is for platform reliability engineers and SREs who need to safely test if a downstream tool or service dependency has recovered after repeated failures. It is designed to be used by an agent or automated workflow when a circuit breaker transitions from OPEN to HALF-OPEN state. The prompt instructs the model to act as a recovery testing planner, producing a structured, safe, and representative probe plan. It forces explicit reasoning about probe safety (read-only vs. mutating), request selection, success criteria, and automatic rollback conditions. Use this when you need a programmatically consumable probe plan that can be reviewed by a human or executed by a controlled test harness.
Prompt
Circuit Breaker Half-Open Probing Prompt

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and clear boundaries for the Circuit Breaker Half-Open Probing Prompt.
The ideal user is an SRE or platform engineer embedding AI-assisted decision-making into an operational toolchain. The required context includes the circuit breaker's configuration (failure threshold, timeout window, half-open max requests), the recent failure history that caused the circuit to open, the tool's API specification, and the current state of any fallback mechanisms. The prompt does not make the routing decision itself; it produces a plan that your application code must execute. This separation is critical—the model proposes a recovery test strategy, but your harness enforces safety constraints, executes probes, and evaluates results against the defined success criteria.
Do not use this prompt for real-time request routing decisions or for generating the circuit breaker logic itself. It is not a replacement for deterministic circuit breaker libraries like resilience4j, Polly, or Istio circuit breaking. It is also unsuitable when you lack a clear API contract for the downstream tool, when probe safety cannot be guaranteed by the execution harness, or when the half-open state must be resolved in sub-second latency. The prompt's value is in producing a reasoned, auditable probe plan for complex recovery scenarios where simple health checks are insufficient. After using this prompt, always route the output through a human review step if the probes involve mutating operations, and ensure your execution harness strictly enforces the probe limit and automatic rollback conditions defined in the plan.
Use Case Fit
Where this prompt works, where it fails, and the operational prerequisites for safe half-open probing.
Good Fit: Controlled Recovery Testing
Use when: you have a circuit breaker in half-open state and need to generate a safe, measurable probe plan before allowing full traffic. Guardrail: the prompt requires explicit success criteria and rollback thresholds, preventing premature transition to closed state.
Bad Fit: Real-Time Traffic Decisions
Avoid when: the system needs sub-millisecond probe decisions on live traffic. This prompt is for generating a probe plan, not for inline request routing. Guardrail: use the output to configure your circuit breaker logic; do not call this prompt on the hot path.
Required Inputs: State and History
Risk: generating a probe plan without failure history or current circuit state produces unsafe recommendations. Guardrail: the prompt requires [FAILURE_COUNT], [LAST_FAILURE_TIMESTAMP], [ERROR_SIGNATURES], and [CURRENT_STATE] as mandatory inputs before producing a plan.
Operational Risk: Unrepresentative Probes
Risk: a probe that succeeds on trivial requests but fails on real workloads creates a false sense of safety. Guardrail: the prompt includes instructions to select probes that match production request profiles and to flag when probe diversity is insufficient.
Operational Risk: Premature State Transition
Risk: transitioning to closed state after a single successful probe without verifying sustained health. Guardrail: the prompt output includes a minimum probe count, observation window, and explicit conditions that must be met before state transition is recommended.
Integration Point: Circuit Breaker Harness
Use when: wiring this prompt into an existing circuit breaker library or sidecar. Guardrail: the prompt output schema is designed to be parsed by automation; human approval is required before executing probes that affect production traffic.
Copy-Ready Prompt Template
A reusable system prompt for generating a controlled probe plan when a circuit breaker enters the half-open state.
This prompt template instructs an agent to act as a reliability controller for a tool dependency that has just transitioned from an open to a half-open circuit breaker state. The agent's job is not to blindly resume traffic but to design a safe, measurable probing strategy. The prompt forces the agent to select a representative sample of requests, define explicit success criteria, and pre-commit to rollback actions if the probe fails. Use this template as the system prompt for an agent that has access to a tool execution harness and a circuit breaker state store.
textYou are a circuit breaker recovery controller for an AI agent platform. Your task is to generate a controlled probe plan for a tool that has just entered the half-open state. ## INPUTS - Tool Name: [TOOL_NAME] - Failure History (last [TIMEFRAME]): [FAILURE_SUMMARY] - Circuit Breaker Configuration: failure_threshold=[FAILURE_THRESHOLD], success_threshold=[SUCCESS_THRESHOLD], timeout_ms=[TIMEOUT_MS] - Pending Request Queue (sample): [PENDING_REQUESTS_SAMPLE] - Tool Dependency Graph: [DEPENDENCY_GRAPH] ## CONSTRAINTS - Do not propose probing with all pending requests. Select a maximum of [MAX_PROBE_COUNT] probe requests. - Probe requests must be representative of distinct call patterns, not just the simplest ones. - If the tool is idempotent, prefer read-only or safe-write probes. If non-idempotent, flag the risk explicitly. - The probe plan must include a rollback or abort condition for each probe request. - Do not propose a probe if the failure history indicates a systemic outage that a half-open test cannot validate (e.g., a known dead backend). In that case, recommend remaining open. ## OUTPUT SCHEMA Return a JSON object with the following structure: { "probe_plan": { "recommendation": "PROCEED_WITH_PROBES" | "REMAIN_OPEN" | "ESCALATE_TO_MANUAL", "rationale": "string", "selected_probes": [ { "request_id": "string", "request_summary": "string", "call_pattern_category": "string", "is_idempotent": true | false, "risk_flag": "NONE" | "NON_IDEMPOTENT" | "HIGH_COST" | "DATA_MUTATION", "success_criteria": { "max_latency_ms": number, "expected_response_schema": "string", "required_fields": ["string"] }, "rollback_or_abort_action": "string" } ], "global_abort_conditions": ["string"], "probe_timeout_ms": number } } ## INSTRUCTIONS 1. Analyze the failure history to determine if the failure pattern is transient (timeout, rate limit) or systemic (connection refused, invalid config). 2. If systemic, recommend REMAIN_OPEN or ESCALATE_TO_MANUAL and do not select probes. 3. If transient, select up to [MAX_PROBE_COUNT] probe requests from the pending queue that represent different call patterns. 4. For each probe, define concrete, measurable success criteria. Do not use vague terms like "works normally." 5. Define global abort conditions that, if triggered, should immediately transition the circuit breaker back to open. 6. Set a probe timeout that is shorter than the standard request timeout to prevent the half-open state from blocking the queue.
Adaptation guidance: Replace the square-bracket placeholders with values from your circuit breaker configuration store and request queue. The [DEPENDENCY_GRAPH] placeholder should be populated with a structured representation of which tools depend on the failing tool, so the agent can assess blast radius. If your agent does not have access to a live request queue, replace [PENDING_REQUESTS_SAMPLE] with a static set of representative request types. For high-risk production systems, add a [HUMAN_APPROVAL_REQUIRED] boolean flag that routes the probe plan to a review queue before execution.
Prompt Variables
Required inputs for the Circuit Breaker Half-Open Probing Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check the input before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOOL_NAME] | Identifies the specific tool or endpoint under circuit breaker evaluation | payment-gateway-api | Must match a registered tool name in the agent's tool registry. Validate with exact string match against active tool catalog. |
[CIRCUIT_STATE_HISTORY] | Recent failure counts, last failure timestamps, and state transition log for the circuit breaker | {"failure_count": 5, "last_failure_time": "2025-01-15T14:22:00Z", "previous_state": "open", "time_in_current_state_seconds": 30} | Must contain failure_count (integer >= 0), last_failure_time (ISO 8601), and previous_state (open|closed|half-open). Parse as JSON and validate schema before use. |
[PROBE_CANDIDATES] | List of candidate requests available for probing the half-open circuit, with request payloads and expected success signatures | [{"request_id": "req-001", "payload": {"amount": 100}, "expected_success": "status 200 with transaction_id present"}] | Must be a non-empty array. Each candidate requires request_id (string), payload (valid JSON), and expected_success (string describing success criteria). Validate array length > 0. |
[TOOL_SLA_THRESHOLDS] | Acceptable latency and error rate thresholds for the tool under normal operation | {"p95_latency_ms": 500, "max_error_rate": 0.01, "timeout_ms": 2000} | Must include p95_latency_ms (integer > 0), max_error_rate (float 0-1), and timeout_ms (integer > 0). Validate numeric ranges and required keys. |
[DEPENDENCY_GRAPH] | Upstream and downstream tool dependencies that could be affected by probe failure or circuit re-opening | {"upstream": ["auth-service"], "downstream": ["order-fulfillment", "notification-service"]} | Must be a JSON object with upstream and downstream arrays. Arrays can be empty but must be present. Validate key existence. |
[PROBE_BUDGET] | Maximum number of probe requests allowed before the half-open evaluation must conclude | 3 | Must be an integer between 1 and 10. Validate range. Higher values increase risk of cascading failures during probing. |
[ROLLBACK_CONDITIONS] | Pre-defined conditions that trigger immediate circuit re-opening and probe cancellation | ["any probe returns 5xx", "p95 latency exceeds 2x SLA threshold", "downstream dependency reports degradation"] | Must be a non-empty array of strings. Each condition must be specific and testable. Validate array length > 0 and no empty strings. |
[SUCCESS_CRITERIA] | Minimum number or percentage of successful probes required to transition the circuit to closed state | {"min_successful_probes": 2, "min_success_rate": 0.66} | Must include min_successful_probes (integer >= 1) and min_success_rate (float 0-1). Validate that min_successful_probes does not exceed [PROBE_BUDGET]. |
Implementation Harness Notes
How to wire the half-open probing prompt into a production circuit breaker controller.
This prompt is not a standalone chatbot interaction. It is a decision component inside a circuit breaker controller that manages tool call resilience. The controller maintains state (open, closed, half-open) and invokes this prompt only when transitioning into or operating within the half-open state. The prompt's job is to produce a structured probe plan—selecting which requests to allow through, defining success criteria, and specifying rollback conditions—that the controller then executes against the live tool dependency.
Wire the prompt into a state machine with explicit guardrails. Before calling the prompt, assemble the [TOOL_HEALTH_METRICS] payload from your observability stack: failure counts by error type over the last window, latency percentiles (p50, p95, p99), the current circuit state, the duration spent in the open state, and the configured probe limit. The controller should enforce a maximum probe count regardless of what the prompt suggests—this is a safety bound, not a suggestion. After receiving the probe plan, validate each proposed probe request against a safelist of read-only or idempotent operations. Reject any probe that would trigger a write, a charge, or a state mutation. Log the full prompt input, output, and validation result as a structured audit event before executing a single probe.
Implement a tight retry-and-escalation loop around probe execution. For each probe the plan authorizes, execute it with a short timeout (shorter than your standard tool timeout) and capture the result. Feed the aggregated probe outcomes back into the circuit breaker state machine: if the success rate meets the threshold defined in the prompt's output, transition to closed; if any probe fails, immediately transition back to open and increment the failure count. Do not give the prompt authority to override the circuit state directly—the controller owns state transitions. The prompt advises; the controller decides. If the prompt output fails schema validation or proposes unsafe probes, abort the half-open attempt, log the failure, and remain open. Escalate to on-call if three consecutive half-open attempts fail before a single probe succeeds.
Model choice matters here. Use a model with strong instruction-following and structured output support (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature to 0 or near-zero—this is a deterministic decision point, not a creative task. Enable structured output mode with a strict JSON schema matching the expected probe plan format. If your model provider doesn't support structured output natively, implement a post-generation validation step that parses the response, validates against the schema, and retries once on failure with the validation error included in the retry prompt. After two consecutive parse failures, abort and log the raw response for debugging.
Observability is non-negotiable. Every invocation of this prompt must emit: a trace span with the prompt input, output, and latency; a metric increment for the circuit state transition attempt; and a structured log line containing the probe plan, execution results, and final state decision. These artifacts are your primary debugging surface when a circuit breaker misbehaves in production. Without them, you cannot distinguish between a prompt that gave bad advice and a controller that executed probes incorrectly. Wire these logs into your existing incident response dashboards so on-call engineers can see circuit breaker decisions alongside tool health metrics during an outage.
Expected Output Contract
Validation rules for the JSON output produced by the Circuit Breaker Half-Open Probing Prompt. Use this contract to parse and validate the model response before executing the probe plan.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
probe_plan_id | string (uuid) | Must match UUID v4 regex pattern; reject on mismatch | |
circuit_breaker_name | string | Must be non-empty and match a registered circuit breaker identifier in the system | |
half_open_transition_time | string (ISO 8601) | Must parse as valid UTC timestamp; must be within the last 5 minutes or reject as stale state | |
probe_requests | array of objects | Array must contain 1-5 probe request objects; reject if empty or exceeds max probe count | |
probe_requests[].request_id | string | Must be unique within the probe_requests array; duplicate IDs trigger rejection | |
probe_requests[].endpoint | string (URL path) | Must be a relative path starting with /; must match a known endpoint in the tool registry | |
probe_requests[].method | string (enum) | Must be one of: GET, POST; reject other HTTP methods as unsafe for probing | |
probe_requests[].payload | object or null | If method is POST, must be a valid JSON object matching the endpoint's input schema; if GET, must be null | |
probe_requests[].timeout_ms | integer | Must be between 100 and 5000; reject values outside this range as unsafe or impractical | |
probe_requests[].expected_status_range | string | Must match pattern ^[1-5][0-9]{2}(-[1-5][0-9]{2})?$; reject malformed status ranges | |
probe_requests[].representativeness_rationale | string | Must be 20-200 characters; reject empty or overly verbose rationales that cannot be reviewed | |
success_criteria | object | Must contain exactly three fields: success_rate_threshold, max_latency_p95_ms, required_successful_probes | |
success_criteria.success_rate_threshold | float | Must be between 0.0 and 1.0; reject values below 0.5 as unsafe for half-open transition | |
success_criteria.max_latency_p95_ms | integer | Must be positive and not exceed 10000; reject zero or negative values | |
success_criteria.required_successful_probes | integer | Must be between 1 and the count of probe_requests; reject if greater than available probes | |
rollback_conditions | object | Must contain at least one of: failure_threshold, latency_violation, error_type_blacklist; reject empty rollback conditions | |
rollback_conditions.failure_threshold | integer | If present, must be between 1 and the count of probe_requests; reject zero | |
rollback_conditions.latency_violation | boolean | If present, must be true or false; reject non-boolean values | |
rollback_conditions.error_type_blacklist | array of strings | If present, must contain at least one error type string matching known error categories in the system | |
probe_execution_order | string (enum) | Must be one of: sequential, parallel; reject other values as unsupported execution strategies | |
cooldown_period_seconds | integer | Must be between 30 and 3600; reject values outside this range as unsafe for production probing | |
generated_at | string (ISO 8601) | Must parse as valid UTC timestamp; must not be in the future; reject future timestamps |
Common Failure Modes
Half-open probing is a delicate recovery state. These are the most common ways probe plans fail in production and how to prevent them before an agent executes the first test call.
Unrepresentative Probe Selection
What to watch: The probe request is too trivial (a health check ping) and succeeds while real traffic would still fail the degraded backend. The circuit breaker closes prematurely, and production errors resume. Guardrail: Require the prompt to select a probe that exercises the same code path, database query, or resource allocation as recent failures. Validate probe representativeness against the last N error signatures before execution.
Probe Success Threshold Too Lenient
What to watch: A single successful probe closes the circuit, but the downstream dependency is still unstable. The next burst of real traffic trips the breaker again, causing a flapping state. Guardrail: Define a minimum consecutive success count and a time window in the prompt's output schema. The circuit should only transition to closed after sustained probe success, not a single lucky response.
Probe Causes Side Effects in Production
What to watch: The selected probe is not read-only. It creates a resource, sends a notification, or mutates state in a system that is supposed to be in recovery. This corrupts data or triggers false alerts. Guardrail: Add an explicit constraint in the prompt requiring all probes to be idempotent and read-only unless a controlled write test is explicitly authorized. Validate the probe's HTTP method or tool action type before dispatch.
Rollback Conditions Are Vague or Missing
What to watch: The prompt produces a probe plan with success criteria but no clear rollback trigger. When probes fail, the agent hesitates or retries the probe indefinitely instead of immediately reverting to open state. Guardrail: The output schema must include explicit rollback conditions: error types that trigger immediate re-open, a maximum probe attempt count, and a cooldown multiplier to prevent rapid cycling.
Stale State Skews the Probe Decision
What to watch: The prompt uses failure counts or latency metrics from before a known deployment or incident resolution. The agent probes a recovered system but recommends staying open because it's reasoning from stale context. Guardrail: Require a freshness timestamp on all input metrics. The prompt should discard or heavily discount failure data older than the last known state change or deployment event.
Probe Volume Overwhelms the Recovering System
What to watch: The prompt generates an aggressive probe plan with high concurrency or short intervals. The recovering downstream system is pushed back into failure by the probe load itself. Guardrail: Include a maximum probe rate and concurrency limit in the prompt's constraints. The probe plan must specify a gradual ramp, not a burst, and should include a backpressure signal to abort if latency degrades during probing.
Evaluation Rubric
Use this rubric to test the quality and safety of the probe plan before deploying it in a production circuit breaker. Each criterion targets a specific failure mode that can cause a half-open probe to re-trip the circuit or miss a recovery signal.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Probe Safety | The selected probe request is read-only, idempotent, and has no irreversible side effects. | The probe plan includes a write, delete, or state-mutating operation. | Manual review of the probe request against the tool's API specification. Check for POST/PUT/DELETE methods or equivalent. |
Representativeness | The probe exercises the same code path and dependency that caused the original failure. | The probe hits a health-check endpoint or a trivial operation that bypasses the failing component. | Trace comparison: diff the probe's call graph against the call graph of the failed requests that opened the circuit. |
Success Criteria Clarity | Success is defined by a specific HTTP status code, response body field, and latency threshold. | Success is defined vaguely as 'tool responds' or 'no error'. | Schema check: the output must include explicit values for [EXPECTED_STATUS], [EXPECTED_BODY_FIELD], and [MAX_LATENCY_MS]. |
Failure Threshold | The plan specifies that a single probe failure immediately transitions the circuit back to Open. | The plan allows multiple probe retries or a percentage-based failure threshold in half-open state. | Parse the [ROLLBACK_CONDITION] field. It must equal 'single_failure' or an equivalent immediate-trip rule. |
Probe Volume Limit | The plan sends exactly one probe request per probing window. | The plan sends a batch of requests or allows unbounded probing. | Count the number of probe requests in the [PROBE_REQUEST_LIST]. It must equal 1. |
Timeout Configuration | The probe timeout is shorter than the circuit breaker's original timeout to enable fast failure detection. | The probe timeout is equal to or longer than the original timeout. | Compare the [PROBE_TIMEOUT_MS] value against the original tool call timeout. [PROBE_TIMEOUT_MS] must be strictly less. |
Rollback Communication | The plan includes a structured log or event payload to emit when the probe fails and the circuit re-opens. | The plan silently re-opens the circuit without an observable event. | Check for a non-null [ON_FAILURE_EVENT] field in the output that includes circuit_id, timestamp, and failure_reason. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a single tool dependency. Replace [TOOL_NAME] and [FAILURE_METRICS] with hardcoded values. Use a simple JSON output schema without strict enum validation. Run probes manually and review each plan before execution.
codeYou are a circuit breaker probe planner for [TOOL_NAME]. The circuit is half-open. Design 3 probe requests. Return JSON with "probes", "success_criteria", and "rollback_conditions".
Watch for
- Probes that don't exercise the actual failure path
- Success criteria that are too lenient (e.g., any 200 OK)
- Missing rollback conditions when probes fail

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us