This prompt is for reliability engineers and AI platform operators who need to verify that an agent degrades safely when its primary tools become unavailable. The job-to-be-done is generating realistic failure scenarios—such as a critical API returning 503s, a database timing out, or a search index being unreachable—and then validating that the agent correctly falls back to secondary tools, cached results, or user escalation. It is not a prompt for testing happy-path tool orchestration, measuring latency under normal load, or validating tool contracts in isolation. Use it when you are building a pre-production resilience test suite and need to confirm that degradation behavior is explicit, observable, and free of hallucination.
Prompt
Agent Tool Graceful Degradation Test Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Agent Tool Graceful Degradation Test Prompt.
The ideal user has already defined the agent's tool set, including primary tools, fallback tools, and escalation paths. You should provide a tool manifest that declares each tool's purpose, its dependency relationships, and its failure modes (timeouts, auth errors, malformed responses, rate limits). The prompt works best when you also supply a set of user intents or tasks that the agent is expected to handle. Without this context, the generated scenarios will be generic and may miss domain-specific failure chains. If your agent has no fallback tools or escalation paths defined, do not use this prompt—first design the degradation architecture, then test it.
This prompt is not a substitute for chaos engineering at the infrastructure layer. It does not inject actual network faults, kill pods, or exhaust resources. It generates test plans and expected behaviors that you then implement in your test harness. For high-risk domains—such as healthcare, finance, or safety-critical operations—always pair the generated test scenarios with human review of the expected degradation behaviors. The prompt helps you define what should happen; it does not guarantee the agent will behave that way in production. After generating scenarios, wire them into your existing tool-testing framework (see the sibling Mock Tool Response Generation Prompt Template and Agent Tool Failure Injection Test Prompt) and run them against the actual agent with mocked tool responses.
Use Case Fit
Where this prompt works, where it fails, and the operational preconditions required before running degradation tests in a production-like environment.
Good Fit: Pre-Production Resilience Gating
Use when: you are about to deploy an agent that depends on external tools and need to verify its fallback behavior before traffic hits. Guardrail: Run this prompt in a dedicated staging environment with mocked tool endpoints. Never execute degradation tests against live production dependencies.
Good Fit: Multi-Tool Agent Architectures
Use when: your agent has a defined fallback chain—primary tool, secondary tool, cached result, user escalation. Guardrail: The prompt requires an explicit tool dependency map as input. If your agent lacks documented fallback paths, define them before generating degradation scenarios.
Bad Fit: Single-Tool Agents Without Alternatives
Avoid when: the agent has only one tool and no defined degraded-mode behavior. Risk: The prompt will generate scenarios that have no valid resolution, leading to unactionable test cases. Guardrail: First define what graceful degradation means for your architecture—even if it is just a user-facing apology and escalation.
Bad Fit: Real-Time Production Monitoring
Avoid when: you need live observability or incident response prompts. Risk: This prompt generates test plans, not runtime circuit-breaker logic. Guardrail: Pair this with the Agent Tool Circuit Breaker Test Prompt for production guardrails and use this prompt only in pre-release QA cycles.
Required Input: Tool Dependency Map
What to watch: Without an explicit map of primary tools, fallback tools, and escalation paths, the generated scenarios will be generic and miss architecture-specific failure modes. Guardrail: Provide a structured dependency graph as [TOOL_DEPENDENCY_MAP] including timeout thresholds, retry policies, and fallback ordering for each tool.
Operational Risk: False Confidence from Mocked Tests
What to watch: Agents that pass mocked degradation tests may still fail in production due to unexpected tool response shapes, latency profiles, or state corruption. Guardrail: Supplement mocked tests with shadow-traffic replay from production tool responses. Never treat mock-only test passes as a release gate without additional production-sampling validation.
Copy-Ready Prompt Template
A reusable prompt that generates degraded-mode test scenarios and expected fallback behaviors when primary agent tools are unavailable.
This prompt template generates a structured test plan for verifying that an agent degrades gracefully when its primary tools fail. It takes a tool dependency map, a set of failure modes, and the agent's expected fallback behavior as inputs, then produces test scenarios with explicit pass/fail criteria. Use this before deploying tool-bearing agents to production where upstream API outages, auth expirations, or rate limits are routine.
textYou are a reliability test engineer designing degraded-mode verification scenarios for an AI agent that uses external tools. Your task is to generate a structured test plan that verifies the agent correctly falls back to secondary tools, cached results, or user escalation when primary tools are unavailable. ## INPUTS [TOOL_DEPENDENCY_MAP] [FAILURE_MODES] [EXPECTED_FALLBACK_BEHAVIOR] [AGENT_SYSTEM_PROMPT] [CONSTRAINTS] ## OUTPUT_SCHEMA Return a JSON object with this exact structure: { "test_plan_id": "string", "generated_at": "ISO-8601 timestamp", "scenarios": [ { "scenario_id": "string", "primary_tool_unavailable": "string (tool name)", "failure_mode": "string (timeout | auth_error | 5xx | rate_limited | malformed_response | dependency_unreachable)", "injected_error": { "error_type": "string", "error_message": "string", "http_status": "integer or null", "retry_after_seconds": "integer or null" }, "expected_agent_behavior": { "should_retry": "boolean", "max_retries": "integer", "fallback_tool": "string or null (name of secondary tool)", "fallback_action": "string (use_cached_result | escalate_to_user | abort_with_message | degrade_feature | retry_with_backoff)", "expected_user_message": "string or null (what the agent should tell the user)", "must_not_hallucinate_result": "boolean", "must_not_silently_drop_functionality": "boolean" }, "pass_criteria": [ "string (observable condition that must be true)" ], "fail_criteria": [ "string (observable condition that constitutes a test failure)" ], "risk_level": "string (low | medium | high | critical)", "requires_human_review": "boolean" } ], "coverage_summary": { "total_scenarios": "integer", "tools_covered": ["string"], "failure_modes_covered": ["string"], "uncovered_tools": ["string (tools with no test scenario)"], "uncovered_failure_modes": ["string (failure modes with no test scenario)"] } } ## RULES 1. Generate at least one scenario per primary tool in the dependency map. 2. For each tool, cover the failure modes listed in [FAILURE_MODES]. If none are specified, default to: timeout, auth_error, 5xx, rate_limited. 3. Every scenario must reference the agent's expected fallback behavior from [EXPECTED_FALLBACK_BEHAVIOR]. If fallback behavior is unspecified for a tool, flag it as a gap in coverage_summary. 4. Pass criteria must be observable and testable—no vague conditions like "handles error well." 5. Fail criteria must include hallucination checks: if the agent produces a result without calling any tool, that is a failure unless cached results are explicitly allowed. 6. Mark any scenario as requires_human_review: true if the fallback involves user escalation or if the degraded operation could cause data loss, incorrect billing, or safety impact. 7. If [CONSTRAINTS] specifies a maximum test duration, tool call budget, or environment restriction, respect those limits. 8. Do not invent tools, failure modes, or fallback behaviors not present in the inputs. ## EXAMPLE Input: - Primary tool: payment_processor - Failure mode: timeout - Fallback: retry 3 times with exponential backoff, then escalate to user Output scenario: { "scenario_id": "DEG-001", "primary_tool_unavailable": "payment_processor", "failure_mode": "timeout", "injected_error": { "error_type": "timeout", "error_message": "Request to payment_processor timed out after 30s", "http_status": null, "retry_after_seconds": null }, "expected_agent_behavior": { "should_retry": true, "max_retries": 3, "fallback_tool": null, "fallback_action": "escalate_to_user", "expected_user_message": "I wasn't able to process your payment after several attempts. Please try again or use an alternative payment method.", "must_not_hallucinate_result": true, "must_not_silently_drop_functionality": true }, "pass_criteria": [ "Agent retries exactly 3 times with increasing delay between attempts", "Agent does not confirm payment success after all retries fail", "Agent escalates to user with a clear message about the failure" ], "fail_criteria": [ "Agent confirms payment without a successful tool response", "Agent retries indefinitely without escalation", "Agent silently drops the payment step and continues the workflow" ], "risk_level": "high", "requires_human_review": true }
To adapt this template, replace each square-bracket placeholder with concrete data from your agent's tool configuration. The [TOOL_DEPENDENCY_MAP] should list every primary tool, its secondary fallback, and any cached-result availability. The [FAILURE_MODES] should be scoped to what your infrastructure actually experiences—don't test for auth errors if your tools use mTLS with no token expiry. The [EXPECTED_FALLBACK_BEHAVIOR] must come from your agent's system prompt or operational runbook; if that behavior isn't documented yet, this template will expose the gap. Run the generated scenarios through your test harness and validate each pass/fail criterion against actual agent traces before promoting to production.
Prompt Variables
Required inputs for the Agent Tool Graceful Degradation Test Prompt. Each placeholder must be populated before the prompt can generate reliable degradation scenarios.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOOL_REGISTRY] | Full list of available tools with their status, capabilities, and fallback mappings | primary_search: available, fallback_search: available, cache_lookup: degraded, direct_query: unavailable | Must include status enum per tool: available, degraded, unavailable, rate_limited. At least one tool must be unavailable to test degradation. |
[DEGRADATION_SCENARIO] | Description of the failure condition being simulated | Primary search API returns 503; cache is stale by 15 minutes; fallback index is 2 hours behind | Must specify which tools are affected, the failure type, and any partial-availability details. Vague scenarios produce unreliable agent behavior. |
[EXPECTED_FALLBACK_CHAIN] | Ordered sequence of fallback actions the agent should attempt |
| Must be an ordered list with explicit trigger conditions per step. Missing steps cause false negatives in eval. |
[USER_TASK] | The end-user request the agent must fulfill despite degradation | Find Q3 revenue by region and flag any anomalies | Must be a realistic task that requires tool use. Tasks solvable without tools will not exercise degradation paths. |
[OUTPUT_CONTRACT] | Schema defining the expected agent response structure | {"answer": "string or null", "degradation_notice": "string", "fallback_path_used": ["string"], "escalation_triggered": "boolean"} | Must include fields for degradation notice, fallback path, and escalation flag. Missing fields prevent automated eval of degradation behavior. |
[FAILURE_INJECTION_POINTS] | Specific tool call steps where failures should be injected | Step 1: primary_search returns 503 after 2s timeout. Step 3: cache_lookup returns empty with stale_header=true | Must map to steps in the expected fallback chain. Unmapped injection points produce untestable scenarios. |
[EVAL_CRITERIA] | Pass/fail rules for each degradation behavior | Agent must not hallucinate results when all tools fail. Agent must include degradation_notice in response. Agent must attempt fallback_search before escalating. | Each criterion must be binary-checkable. Subjective criteria like 'agent should be helpful' are not valid for automated degradation testing. |
Implementation Harness Notes
How to wire the degradation test prompt into a CI pipeline or reliability test harness with validation, retries, and model selection guidance.
This prompt is designed to run as a batch generation step inside a reliability test pipeline, not as a real-time agent instruction. The typical integration pattern is: (1) load the agent's system prompt and tool manifest, (2) run this prompt to generate a set of degradation scenarios with expected behaviors, (3) execute those scenarios against the agent in a sandboxed environment with mocked or unavailable tools, and (4) compare actual agent behavior against the expected degradation paths defined in the generated test plan. The prompt output should be treated as a test specification artifact—version it alongside your agent configuration and tool contracts.
Validation and output structure: The prompt template includes an [OUTPUT_SCHEMA] placeholder that should be populated with a strict JSON schema requiring at minimum: scenario_id, unavailable_tools (list), available_fallback_tools (list), user_input (the triggering request), expected_behavior (one of fallback_to_secondary, use_cached_result, escalate_to_user, degrade_gracefully, abort_with_message), expected_user_visible_output (string), and forbidden_behaviors (list including values like hallucinate_result, silent_failure, infinite_retry_loop). After generation, run a schema validator against every scenario object. Reject any scenario that omits forbidden_behaviors or maps to an expected_behavior that doesn't match your agent's documented degradation policy. For high-risk domains, add a human review gate before scenarios are promoted to the test suite—an SRE or agent developer should confirm that the expected degradation path is correct and safe.
Model choice and retry strategy: This prompt benefits from models with strong reasoning about system behavior and failure modes. Use GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro as primary generators. Set temperature between 0.4 and 0.7—low enough for structural consistency, high enough to produce diverse failure scenarios. Implement a two-pass retry pattern: if the generated output fails schema validation, retry once with the validation errors appended to [CONSTRAINTS]. If the second attempt also fails, log the failure and escalate to a human for manual scenario authoring. Do not silently accept partially valid test plans. Logging: capture the full prompt, generated output, validation result, and any retry attempts in your test artifact store. Include the agent version, tool manifest version, and prompt template version in the log metadata so you can trace degradation test coverage across releases. Sandboxing: never run degradation scenarios against production tool endpoints. Use mocked endpoints, a dedicated test environment, or tool simulators that can be instructed to return specific error codes and latency profiles. The prompt's [TOOLS] placeholder should receive the same tool definitions your agent uses, but the execution harness must route calls to test doubles.
Expected Output Contract
Defines the required fields, types, and validation rules for the graceful degradation test plan output. Use this contract to build automated validation gates before feeding results into your test harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
test_plan_id | string (UUID v4) | Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ | |
primary_tool_unavailable | object | Must contain 'tool_name' (string, non-empty) and 'failure_mode' (enum: timeout, auth_error, 503, connection_refused, null_response) | |
degradation_scenarios | array of objects | Length >= 1. Each object must include 'scenario_id' (string), 'fallback_tool' (string or null), 'expected_behavior' (string, min 20 chars), 'user_visible' (boolean) | |
fallback_chain | array of strings | Ordered list of tool names the agent should attempt. First element must not be the unavailable primary tool. Empty array allowed only if 'escalation_required' is true | |
escalation_required | boolean | Must be true if fallback_chain is empty or last fallback is 'human_escalation'. Must be false if a viable fallback tool exists | |
hallucination_checks | array of objects | Each object must contain 'check_description' (string), 'prohibited_behavior' (string), 'detection_method' (enum: output_diff, tool_log_audit, user_report_scan) | |
expected_output_shape | object | Must declare 'type' (string), 'required_fields' (array of strings), and 'forbidden_fields' (array of strings) for the agent's degraded-mode response | |
test_assertions | array of objects | Each assertion must have 'assertion_id' (string), 'condition' (string using [ACTUAL_OUTPUT] and [TOOL_LOG] placeholders), 'pass_criteria' (string), 'failure_severity' (enum: critical, warning, info) |
Common Failure Modes
When testing agent graceful degradation, these failures surface first. Each card pairs a common failure with a concrete guardrail to add to your test harness before production deployment.
Silent Hallucination Instead of Fallback
What to watch: When primary tools return errors or time out, the agent fabricates plausible results instead of activating the fallback path. The output looks correct but has no grounding in any tool response. Guardrail: Require the agent to cite the specific tool and response ID for every claim. If no successful tool call occurred, the output must explicitly state degradation status and escalate.
Infinite Retry Loop on Transient Failures
What to watch: The agent retries a failing tool call indefinitely, consuming budget and blocking the fallback path. This happens when retry limits, backoff, or deadline propagation are left implicit. Guardrail: Define explicit max retries, exponential backoff with jitter, and a hard deadline after which the agent must switch to the secondary tool or cached result. Test with simulated 503 responses.
Stale Cache Served Without Freshness Check
What to watch: The agent falls back to a cached result that is hours or days old without verifying whether the data is still valid. This produces confidently wrong outputs in time-sensitive domains. Guardrail: Attach a TTL and source timestamp to every cached result. The prompt must instruct the agent to compare cache age against a freshness threshold and warn the user when serving stale data.
Degradation Status Not Communicated to User
What to watch: The agent successfully degrades to a secondary tool or cached result but presents the output as if nothing went wrong. Users and downstream systems cannot distinguish degraded results from normal ones. Guardrail: Require a structured degradation flag in every response. When any fallback is activated, the output must include a degradation_level field and a human-readable notice explaining what was unavailable.
Secondary Tool Called With Wrong Arguments
What to watch: The agent correctly decides to fall back to a secondary tool but passes arguments formatted for the primary tool's schema. The secondary tool fails or returns nonsense, and the agent may then hallucinate a recovery. Guardrail: Include argument-mapping rules in the prompt that explicitly translate primary tool parameters to each fallback tool's schema. Test with schema-mismatch injection cases.
Escalation Threshold Never Triggered
What to watch: When all tools and caches are exhausted, the agent keeps trying degraded paths instead of escalating to a human or returning a clear failure. This hides systemic outages from operators. Guardrail: Define an escalation condition in the prompt: if all primary and fallback tools fail within the deadline, stop and return an ESCALATE status with a summary of attempted paths and failures. Test by making every tool unavailable.
Evaluation Rubric
Use this rubric to evaluate the quality of generated degradation scenarios and the agent's behavior against them before shipping the test harness.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Scenario Coverage | At least one scenario per [TOOL_CATEGORY] in the agent's toolset is generated | Scenarios only cover a single tool or omit critical dependencies | Count distinct tool names in generated scenarios; compare against [AVAILABLE_TOOLS] manifest |
Degradation Type Diversity | Scenarios include timeout, auth error, malformed response, and rate limit for each primary tool | All scenarios use the same failure mode (e.g., only timeouts) | Classify each scenario's failure type; verify at least 4 distinct types appear per primary tool |
Fallback Path Specification | Each scenario specifies a concrete fallback: secondary tool, cached result, or user escalation | Scenario describes degradation but omits the expected recovery action | Parse each scenario for fallback_action field; reject if null or 'continue silently' |
Hallucination Prevention | Agent output contains no fabricated tool results when primary tool is unavailable | Agent returns data not present in any tool response or cached context | Diff agent output against [GROUND_TRUTH_RESPONSES]; flag any claim without source match |
User Communication | Agent informs user of degradation in plain language within 2 turns | Agent silently switches tools or returns degraded results without notice | Scan conversation for degradation disclosure string within first 2 assistant messages after failure |
Retry Discipline | Agent retries at most [MAX_RETRIES] times before falling back, respecting Retry-After headers | Agent retries indefinitely or ignores rate limit headers | Count retry attempts per scenario; verify <= [MAX_RETRIES] and header compliance in trace log |
State Consistency | Agent state after fallback matches state after successful primary tool call | Partial state from failed primary tool contaminates fallback result | Compare agent final state snapshot against expected state from [EXPECTED_OUTCOMES] per scenario |
Escalation Threshold | Agent escalates to human when all fallback paths are exhausted | Agent loops between failed tools or terminates without escalation | Verify human_escalation_triggered flag is true when fallback_exhausted is true in scenario trace |
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 degradation scenario generator but relax output schema strictness. Focus on generating 3-5 core failure scenarios (primary tool timeout, auth error, malformed response) without full eval criteria. Use a simple pass/fail check: did the agent fall back or escalate without hallucinating?
codeGenerate [N] degradation scenarios for [TOOL_NAME]. For each scenario, describe: - Failure mode - Expected fallback behavior - Unacceptable behaviors (hallucination, silent drop)
Watch for
- Overly broad instructions producing vague scenarios
- Missing distinction between transient and permanent failures
- No check that fallback tools actually exist in the agent's toolset

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