Inferensys

Prompt

Error Propagation Rules Across Tool Steps Prompt

A practical prompt playbook for platform engineers defining failure semantics in tool chains. Produces rules for how errors at each step propagate to downstream steps, including error classification, retry eligibility, and partial result preservation.
Developer reviewing semantic search engine results on laptop, relevance scores visible, technical search demo.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Error Propagation Rules Across Tool Steps Prompt.

This prompt is for platform engineers and agent infrastructure developers who need to define explicit failure semantics for multi-step tool chains. The core job is to produce a machine-readable set of rules that govern how an error at any step in a sequence propagates to downstream steps, including classification of the error type, retry eligibility, partial result preservation, and abort conditions. You should use this prompt when you are building an agent harness that orchestrates multiple tool calls and you cannot afford silent error swallowing, cascading retries that mask root causes, or over-propagation that aborts an entire workflow when partial results are still valuable. The ideal user has a concrete tool chain topology in hand—a list of steps, their dependencies, and the expected output schema for each—and needs to encode failure-handling logic that the agent runtime can execute deterministically.

Do not use this prompt for single-step tool calls, simple try/catch wrappers, or workflows where the agent is expected to reason about errors in an ad-hoc way. This prompt is also inappropriate when the error taxonomy is undefined or when the team has not agreed on what constitutes a retryable versus terminal failure. If you are still designing the tool contracts themselves, start with the Tool Contract Definition and Schema Mapping playbook first. If you need to define the overall sequence plan, use the Tool Call Sequence Planning Prompt Template. This prompt assumes you already know the happy path and are now hardening it against the unhappy paths that will occur in production. It is a reliability engineering artifact, not a planning artifact.

Before using this prompt, gather your tool chain's dependency graph, the error codes or exception types each tool can produce, and your organization's policies on retry budgets, idempotency requirements, and human escalation thresholds. The output of this prompt should feed directly into your agent's execution loop as a structured ruleset that the orchestrator evaluates after each tool call. If your workflow involves financial transactions, healthcare data, or irreversible side effects, you must pair these propagation rules with human approval gates and audit logging—this prompt defines the automation logic, not the governance layer. After generating the rules, test them against a matrix of injected failures at each step to verify that error swallowing, over-propagation, and recovery path gaps are caught before deployment.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and the operational preconditions required before putting it into production.

01

Good Fit: Deterministic Tool Chains

Use when: You have a fixed sequence of internal APIs or deterministic functions where failure modes are known. Guardrail: Define error categories (retryable, fatal, partial) in the prompt's classification schema before execution.

02

Bad Fit: Unbounded Autonomy

Avoid when: The agent dynamically discovers tools or the full execution graph is unknown at compile time. Guardrail: Pair with a Tool Discovery prompt first to establish a static capability registry before applying propagation rules.

03

Required Input: Structured Error Taxonomy

Risk: Without a predefined error taxonomy, the model invents inconsistent failure categories. Guardrail: Provide a strict enum of error types (e.g., TIMEOUT, PERMISSION_DENIED, VALIDATION_ERROR) in the prompt's input schema.

04

Operational Risk: Silent Error Swallowing

What to watch: The model may classify fatal errors as retryable to avoid stopping, causing infinite loops. Guardrail: Implement a hardcoded circuit breaker in the harness that counts retries and overrides the model's classification after a threshold.

05

Operational Risk: Partial State Corruption

What to watch: Preserving partial results on failure can leave downstream systems in an inconsistent state. Guardrail: Require the prompt to output a 'rollback_needed' boolean and a list of compensating actions for any committed partial work.

06

Bad Fit: Non-Deterministic Generative Steps

Avoid when: The tool chain includes LLM calls or generative steps where 'correctness' is subjective. Guardrail: Insert a Human Approval Gate prompt between generative steps and side-effect-causing tools to validate semantic quality.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating structured error propagation rules across multi-step tool chains, ready to copy into your agent harness.

This prompt template produces a structured error propagation specification for a defined tool chain. It takes a sequence of tool steps, their expected outputs, and the failure modes you care about, then returns classification rules, retry eligibility, partial result preservation instructions, and recovery path definitions. Use it when you need explicit, machine-readable failure semantics before wiring an agent into production tool orchestration.

text
You are defining error propagation rules for a multi-step tool execution chain. Your output will be consumed by an agent execution engine that needs deterministic failure handling.

## TOOL CHAIN DEFINITION
[TOOL_CHAIN_STEPS]
<!-- Each step must include: step_id, tool_name, description, expected_output_schema, is_mutable (boolean), and dependencies (list of step_ids) -->

## ERROR CLASSIFICATION TAXONOMY
[ERROR_TAXONOMY]
<!-- Define the error categories you want the rules to use, e.g., TRANSIENT, PERMANENT_INPUT, PERMANENT_DEPENDENCY, TIMEOUT, PERMISSION, DATA_CORRUPTION, RATE_LIMITED -->

## CONSTRAINTS
[CONSTRAINTS]
<!-- e.g., max_total_retries, max_retries_per_step, required_human_approval_for_categories, idempotency_requirements, data_sensitivity_level -->

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "tool_chain_id": "string",
  "error_propagation_rules": [
    {
      "step_id": "string",
      "error_category": "string from taxonomy",
      "propagation_action": "BLOCK_CHAIN | CONTINUE_WITH_DEFAULT | CONTINUE_WITH_PARTIAL | RETRY | ESCALATE_HUMAN | CALL_FALLBACK",
      "retry_policy": {
        "max_retries": "integer",
        "backoff_strategy": "CONSTANT | LINEAR | EXPONENTIAL",
        "retryable_error_subtypes": ["string"]
      },
      "partial_result_preservation": {
        "preserve_fields": ["string"],
        "discard_fields": ["string"],
        "preservation_condition": "string describing when partial results are safe to keep"
      },
      "fallback_step_id": "string or null",
      "human_approval_required": "boolean",
      "downstream_impact": {
        "affected_steps": ["string"],
        "impact_description": "string explaining what downstream steps receive (error, default, partial, nothing)"
      },
      "recovery_path": "string describing how the chain can recover from this error, or 'NONE'"
    }
  ],
  "global_abort_conditions": [
    {
      "condition": "string describing when to abort the entire chain",
      "cleanup_actions": ["string"],
      "user_notification_template": "string"
    }
  ],
  "partial_success_policy": {
    "commit_partial_results": "boolean",
    "rollback_instructions": "string or null",
    "compensating_actions": [{"step_id": "string", "action": "string"}]
  }
}

## RULES
1. Every step in TOOL_CHAIN_STEPS must have at least one error_propagation_rule covering its most likely failure mode.
2. If a step has dependencies, include rules for PERMANENT_DEPENDENCY errors when an upstream step fails.
3. For mutable steps (is_mutable: true), partial_result_preservation must be conservative—prefer discard over preserve when data consistency is at risk.
4. RETRY actions require a retry_policy. BLOCK_CHAIN actions must specify downstream_impact.
5. ESCALATE_HUMAN actions require human_approval_required: true and a recovery_path that explains what the human must decide.
6. If CONSTRAINTS specify idempotency requirements, ensure retry policies do not violate them.
7. Do not invent error categories outside the provided ERROR_TAXONOMY.
8. If a recovery path is impossible, set recovery_path to "NONE" and ensure the downstream_impact explains the terminal state.

## EXAMPLE INPUT
TOOL_CHAIN_STEPS:
- step_id: "fetch_customer", tool_name: "get_customer", description: "Retrieve customer record by ID", expected_output_schema: {customer_id: string, name: string, tier: string}, is_mutable: false, dependencies: []
- step_id: "apply_discount", tool_name: "update_invoice", description: "Apply tier-based discount to invoice", expected_output_schema: {invoice_id: string, discount_applied: float, new_total: float}, is_mutable: true, dependencies: ["fetch_customer"]

ERROR_TAXONOMY: ["TRANSIENT", "PERMANENT_INPUT", "PERMANENT_DEPENDENCY", "TIMEOUT"]

CONSTRAINTS: max_retries_per_step=3, required_human_approval_for_categories=["PERMANENT_INPUT"]

## EXAMPLE OUTPUT
{
  "tool_chain_id": "discount_application",
  "error_propagation_rules": [
    {
      "step_id": "fetch_customer",
      "error_category": "TRANSIENT",
      "propagation_action": "RETRY",
      "retry_policy": {"max_retries": 3, "backoff_strategy": "EXPONENTIAL", "retryable_error_subtypes": ["NETWORK_ERROR", "TIMEOUT"]},
      "partial_result_preservation": {"preserve_fields": [], "discard_fields": [], "preservation_condition": "N/A"},
      "fallback_step_id": null,
      "human_approval_required": false,
      "downstream_impact": {"affected_steps": ["apply_discount"], "impact_description": "Downstream step blocked until retry succeeds or exhausts"},
      "recovery_path": "Retry with exponential backoff; if exhausted, escalate as PERMANENT_DEPENDENCY"
    },
    {
      "step_id": "fetch_customer",
      "error_category": "PERMANENT_INPUT",
      "propagation_action": "ESCALATE_HUMAN",
      "retry_policy": null,
      "partial_result_preservation": {"preserve_fields": [], "discard_fields": [], "preservation_condition": "N/A"},
      "fallback_step_id": null,
      "human_approval_required": true,
      "downstream_impact": {"affected_steps": ["apply_discount"], "impact_description": "Chain blocked; human must provide valid customer ID or abort"},
      "recovery_path": "Human provides corrected customer ID; chain restarts from fetch_customer"
    },
    {
      "step_id": "apply_discount",
      "error_category": "PERMANENT_DEPENDENCY",
      "propagation_action": "BLOCK_CHAIN",
      "retry_policy": null,
      "partial_result_preservation": {"preserve_fields": [], "discard_fields": [], "preservation_condition": "N/A"},
      "fallback_step_id": null,
      "human_approval_required": false,
      "downstream_impact": {"affected_steps": [], "impact_description": "No further steps; chain terminates with error"},
      "recovery_path": "NONE"
    }
  ],
  "global_abort_conditions": [
    {"condition": "Any step exhausts retries without fallback", "cleanup_actions": ["log_failure", "notify_on_call"], "user_notification_template": "Tool chain {tool_chain_id} failed at step {step_id} with error {error_category}. Manual intervention required."}
  ],
  "partial_success_policy": {
    "commit_partial_results": false,
    "rollback_instructions": "Discard all state; no partial commits for mutable discount operations",
    "compensating_actions": []
  }
}

## YOUR TASK
Using the TOOL_CHAIN_STEPS, ERROR_TAXONOMY, and CONSTRAINTS provided above, generate the complete error propagation specification following the OUTPUT SCHEMA and RULES exactly.

Adaptation notes: Replace [TOOL_CHAIN_STEPS] with your actual step definitions—each step needs a unique ID, the tool name, its output schema, whether it mutates state, and its upstream dependencies. Replace [ERROR_TAXONOMY] with the error categories your platform can detect and handle programmatically. Replace [CONSTRAINTS] with your operational bounds: retry limits, approval requirements, idempotency guarantees, and data sensitivity levels. The example input and output are included in the prompt to ground the model in your expected shape—keep them or replace them with your own canonical examples. For high-risk chains where incorrect propagation rules could cause data corruption or financial impact, always route the generated specification through human review before loading it into your agent execution engine.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Error Propagation Rules prompt. Each placeholder must be populated before the prompt is assembled. Validate types and completeness at runtime to prevent silent propagation failures.

PlaceholderPurposeExampleValidation Notes

[TOOL_CHAIN_DEFINITION]

Ordered list of tool steps with identifiers, descriptions, and expected output schemas

step_1: get_customer(id) -> {customer_record}, step_2: check_eligibility(customer_record) -> {eligibility_result}

Parse as ordered array of step objects. Each step must have id, description, and output_schema fields. Reject if steps array is empty or contains duplicate ids.

[ERROR_CLASSIFICATION_TAXONOMY]

Taxonomy of error types the system can encounter, with severity levels and default propagation behaviors

TRANSIENT: retryable, timeout; PERMANENT: non-retryable, invalid_input; DEGRADED: partial_result, stale_data

Parse as map of error_type to {severity, retryable, default_propagation}. At minimum TRANSIENT and PERMANENT must be defined. Reject if taxonomy is empty.

[STEP_FAILURE_MODES]

Per-step mapping of known failure modes to error classifications from the taxonomy

step_2: {timeout: TRANSIENT, invalid_customer_id: PERMANENT, upstream_unavailable: TRANSIENT}

Parse as map of step_id to array of {failure_mode, error_type}. Each error_type must exist in [ERROR_CLASSIFICATION_TAXONOMY]. Warn if a step has zero defined failure modes.

[DOWNSTREAM_DEPENDENCY_MAP]

Explicit mapping of which downstream steps depend on which upstream outputs

step_3: requires [step_1.customer_id, step_2.eligibility_score]; step_4: requires [step_3.approval_token]

Parse as map of step_id to array of dependency paths in format step_id.field_name. Reject if a dependency references a non-existent step or field. Check for circular dependencies.

[RETRY_POLICY]

Global and per-step retry configuration including max attempts, backoff strategy, and retryable error filter

global: {max_retries: 3, backoff: exponential, retryable: [TRANSIENT]}; step_2: {max_retries: 5}

Parse as object with global and optional per-step overrides. global.max_retries must be positive integer. Per-step overrides must reference valid step_ids. Reject if retryable filter references undefined error types.

[PARTIAL_RESULT_PRESERVATION_RULES]

Rules for which intermediate results to preserve when a downstream step fails, and how to surface them

preserve: [step_1.customer_record, step_2.eligibility_result]; surface_as: partial_output; discard_on: PERMANENT

Parse as object with preserve (array of step_id.field_name), surface_as (string), and discard_on (array of error_types). Reject if preserve references non-existent fields. discard_on error types must exist in taxonomy.

[ABORT_AND_ESCALATION_CONDITIONS]

Conditions under which the entire chain must abort immediately, with escalation target and user message template

abort_on: [PERMANENT at step_1, PERMANENT at step_2]; escalate_to: on_call_engineer; message_template: 'Chain aborted at {step_id}: {error_summary}'

Parse as object with abort_on (array of {error_type, step_id}), escalate_to (string), and message_template (string with valid {step_id} and {error_summary} tokens). Reject if abort_on references undefined steps or error types.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the error propagation rules prompt into a production tool orchestration layer with validation, retries, and audit logging.

The error propagation rules prompt is designed to sit between your tool orchestration engine and the agent's execution loop. It should be invoked before any multi-step tool sequence begins, producing a static or semi-static rule set that the orchestrator enforces at runtime. The prompt takes a list of tool definitions, their dependency graph, and your organization's reliability requirements, then outputs structured propagation rules—error classifications, retry eligibility, partial result preservation policies, and abort conditions. This rule set becomes the contract that your orchestrator reads on every tool failure, eliminating the ambiguity that causes agents to silently swallow errors or cascade failures across unrelated steps.

Wiring the prompt into your application requires three integration points. First, a pre-execution hook calls the prompt with the planned tool sequence and receives the rule set as structured JSON. Store this rule set alongside the execution plan in your state store. Second, a runtime error handler intercepts every tool call failure and consults the rule set to decide: classify the error (transient, permanent, data-corruption, auth, timeout), determine retry eligibility with backoff parameters, identify which downstream steps must be skipped or can proceed with degraded inputs, and preserve any partial results that the rules mark as salvageable. Third, a post-execution audit logger records every error event, the rule that fired, the decision made, and the resulting state change. This audit trail is essential for debugging silent failures and proving governance to reviewers. For high-risk domains, insert a human approval gate when the rules trigger an abort condition or when error classification confidence falls below your threshold—the prompt's [RISK_LEVEL] parameter should map to your approval policy.

Validation and testing must happen at two levels. At the rule-generation level, validate the prompt's output against a schema that enforces: every tool step has an error classification mapping, retry policies include max attempts and backoff strategy, abort conditions reference specific error types and severity thresholds, and partial result preservation rules specify which output fields survive which failure modes. Run regression tests with known tool failure scenarios—a timeout on step 2, an auth failure on step 4, a malformed output on step 1—and verify the generated rules produce the expected propagation behavior. At the runtime level, instrument your orchestrator to detect rule violations: errors that propagate when rules said to abort, retries that exceed max attempts, partial results that were preserved when rules said to discard. These violations are your leading indicators that the prompt's output has drifted or that new failure modes have emerged that the rules don't cover. Model choice matters: use a model with strong structured output capabilities and low refusal rates on technical specification tasks. GPT-4o and Claude 3.5 Sonnet perform well here; avoid smaller models that conflate error types or produce incomplete rule coverage. Cache the rule set aggressively—error propagation rules should only change when the tool sequence or reliability requirements change, not on every execution.

What to avoid: Do not treat the prompt's output as advisory. If your orchestrator can override the rules at runtime, you've reintroduced the ambiguity this prompt exists to eliminate. Do not skip the audit logging—without it, you'll never know whether errors were handled correctly or silently swallowed. Do not use this prompt for sequences with fewer than three tool calls; the overhead isn't justified for simple chains. And do not assume the rules are complete on first generation. Run the eval harness described in the topic's evaluation section against your actual tool failure history, and iterate on the prompt's [CONSTRAINTS] and [TOOLS] descriptions until the rules cover your real failure distribution. The next step after implementing this harness is to wire the generated rules into your observability stack so that every error propagation decision appears in your traces alongside the tool call spans.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the error propagation configuration object produced by this prompt. Use this contract to validate the output before wiring it into agent orchestration logic.

Field or ElementType or FormatRequiredValidation Rule

error_classification_rules

Array of objects

Must contain at least one entry. Each entry must have non-empty 'error_pattern', 'category', and 'severity' fields. 'category' must be one of: RETRYABLE, FATAL, DEGRADABLE, TRANSIENT, PERMISSION, TIMEOUT, VALIDATION, UNKNOWN.

error_classification_rules[].error_pattern

String or regex-safe string

Must be non-empty. If regex, must compile without error in the target runtime. Test against known tool error messages to confirm match coverage.

error_classification_rules[].category

Enum string

Must be one of the allowed categories listed above. Reject unknown values. No default fallback allowed; UNKNOWN must be explicit.

error_classification_rules[].severity

Enum string

Must be one of: LOW, MEDIUM, HIGH, CRITICAL. Used to determine escalation and abort thresholds.

propagation_graph

Array of objects

Must contain one entry per tool step in the sequence. Each entry must reference a valid 'step_id' present in the input tool sequence definition.

propagation_graph[].step_id

String

Must match a step identifier from the input tool sequence. Non-matching IDs must be rejected. Case-sensitive match required.

propagation_graph[].on_error

Object

Must contain 'action' and 'fallback_step_id' fields. 'action' must be one of: ABORT_CHAIN, SKIP_STEP, RETRY_STEP, CALL_FALLBACK, CONTINUE_WITH_PARTIAL, ESCALATE_TO_HUMAN.

propagation_graph[].on_error.retry_policy

Object or null

Required when action is RETRY_STEP. Must contain 'max_retries' (integer >= 0), 'backoff_strategy' (CONSTANT, LINEAR, EXPONENTIAL), and 'retryable_categories' (array of category strings). Null allowed when action is not RETRY_STEP.

propagation_graph[].on_error.fallback_step_id

String or null

Required when action is CALL_FALLBACK. Must reference a valid step_id defined elsewhere in the sequence. Null allowed otherwise. Circular fallback references must be rejected.

propagation_graph[].partial_result_preservation

Boolean

If true, successful outputs from prior steps must be preserved and passed to the next active step or returned in the final partial result. If false, partial state is discarded on error.

global_abort_conditions

Array of objects

Must contain at least one entry. Each entry must have 'condition' (string describing the trigger) and 'cleanup_actions' (array of strings). Cleanup actions must reference valid tool calls or be empty.

global_abort_conditions[].severity_threshold

Enum string

Must be one of: LOW, MEDIUM, HIGH, CRITICAL. Chain aborts when any step error meets or exceeds this threshold. CRITICAL should always abort.

user_notification_template

String

Must be non-empty. Must contain at least one placeholder for error context, e.g., [ERROR_SUMMARY] or [FAILED_STEP]. Validate that all placeholders are resolvable from the propagation context at runtime.

recovery_path_coverage_check

Object

Must contain 'covered_categories' (array of category strings) and 'uncovered_categories' (array of category strings). The union must equal all categories present in error_classification_rules. Uncovered categories indicate a gap requiring human review before deployment.

PRACTICAL GUARDRAILS

Common Failure Modes

Error propagation rules fail silently when the model assumes downstream steps can handle upstream failures, swallows critical errors, or over-propagates non-fatal warnings. These cards cover the most common production failure patterns and how to prevent them.

01

Error Swallowing in Intermediate Steps

What to watch: The model receives a tool error but continues the chain as if the step succeeded, fabricating plausible output to feed downstream. This is the most common and dangerous failure mode in production tool chains. Guardrail: Require explicit error classification at each step boundary. Insert a validation gate that checks whether the previous step returned success: true before allowing data to flow to the next tool call. If the model cannot confirm success, it must halt and report the error rather than inventing results.

02

Over-Propagation of Non-Fatal Warnings

What to watch: A step returns a warning or partial result that is still usable, but the model treats it as a hard failure and aborts the entire chain. This causes unnecessary workflow termination and lost partial work. Guardrail: Define a three-tier severity model in the prompt: fatal (abort chain), degraded (continue with noted limitations), and info (log and proceed). Include explicit examples of each tier so the model calibrates its propagation decisions correctly.

03

Missing Recovery Paths for Retryable Errors

What to watch: The model encounters a transient error such as a timeout or rate limit but has no instructions for retry, so it either aborts prematurely or retries indefinitely without backoff. Guardrail: Embed retry eligibility rules directly in the error propagation prompt. Specify which error types are retryable, maximum retry counts, backoff strategy, and what to do when retries are exhausted. Include a circuit-breaker condition that escalates after repeated failures.

04

Partial Result Loss on Chain Abort

What to watch: A late-step failure causes the model to discard all earlier successful results, forcing the user or calling system to restart from nothing. This wastes compute and destroys useful intermediate state. Guardrail: Instruct the model to preserve and return all successful step outputs in a partial_results array when aborting. Include a completed_steps summary and a failure_point indicator so the caller can resume from the last successful checkpoint rather than restarting the entire chain.

05

Ambiguous Error Classification at Step Boundaries

What to watch: The model receives an unstructured error message from a tool and must guess whether it is retryable, fatal, or ignorable. Without classification rules, the model guesses wrong and either over-aborts or under-reacts. Guardrail: Require each tool to return a structured error object with a severity field and a retryable boolean. In the prompt, define a mapping from tool error codes to propagation actions. If the tool does not return structured errors, add a classification step before propagation logic executes.

06

Silent State Corruption Across Steps

What to watch: A step succeeds but returns subtly wrong or incomplete data that passes basic validation. Downstream steps operate on corrupted state and produce confident but incorrect final results. Guardrail: Add semantic assertions between steps that check not just schema validity but also reasonableness of values. For example, if a search step returns zero results for a common query, flag it before passing empty context to a synthesis step. Include confidence thresholds and cross-step consistency checks in the propagation rules.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test whether the generated error propagation rules are production-ready. Each criterion targets a specific failure mode observed in multi-step tool chains. Run these checks before deploying the prompt into an agent harness.

CriterionPass StandardFailure SignalTest Method

Error Classification Completeness

Every tool step has at least one classified error type (transient, permanent, data, timeout, auth) with a propagation decision

Missing error types for a step; generic 'on error' handler without classification

Schema check: parse output, confirm each [TOOL_STEP] has a non-empty error_classifications array

Retry Eligibility Rules

Transient errors have explicit max_retries and backoff_strategy; permanent errors have retry=false with justification

Transient errors missing retry limits; permanent errors marked retry=true; infinite retry loops possible

Unit test: inject timeout error, verify retry count <= [MAX_RETRIES]; inject auth error, verify retry=false

Partial Result Preservation

Output schema includes partial_results field; rules specify which fields survive which error types

Successful step outputs discarded when downstream step fails; no partial_results in output contract

Integration test: force step 3 failure, verify step 1-2 outputs present in final partial_results

Propagation Boundary Definition

Each error has explicit propagate_to_downstream boolean; false entries include alternative action (abort, skip, fallback)

Errors propagate to all downstream steps by default; no abort or skip paths defined

Trace analysis: inject error at step 2, confirm step 3 either receives skip signal or chain aborts per rules

Recovery Path Coverage

Every permanent error maps to at least one recovery action (fallback_tool, human_approval, abort_with_cleanup)

Permanent errors have no recovery path; agent hangs or produces null output silently

Decision table test: enumerate all permanent error types, verify each has non-null recovery_action

Error Swallowing Prevention

All error paths produce explicit user_visible_message or log_level=ERROR; no silent null returns

Tool failure returns empty object or null without logging; downstream steps proceed with missing data

Log inspection: force each error type, verify ERROR-level log entry and non-empty user_message in output

Over-Propagation Guard

Errors scoped to independent parallel branches do not abort sibling branches; dependency graph used for propagation scope

Single branch failure aborts all parallel work; propagation ignores dependency graph structure

Parallel execution test: fail branch A, verify branch B completes and outputs preserved

Compensation Completeness

For saga pattern: each tool step with side effects has a defined compensating action; compensation ordering is reverse execution

Missing compensating action for a step with write side effects; compensation order is forward or undefined

Rollback test: execute 3-step saga, force step 3 failure, verify steps 2 and 1 compensating actions execute in reverse order

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a hardcoded error taxonomy. Use a flat JSON output with error_classification, propagation_rule, and retry_eligibility fields. Skip partial-result preservation logic initially.

code
Classify this tool error and define propagation:
[ERROR_MESSAGE]
[TOOL_NAME]
[SEQUENCE_POSITION]

Return JSON:
{
  "error_class": "TRANSIENT | PERMANENT | DATA_CORRUPTION | TIMEOUT | PERMISSION",
  "propagate_to_downstream": true | false,
  "retry_eligible": true | false,
  "retry_strategy": "IMMEDIATE | BACKOFF | SWITCH_TOOL | NONE"
}

Watch for

  • Overly broad error classes that collapse distinct failure modes
  • Missing timeout classification causing retry storms
  • No distinction between partial and total failure
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.