Inferensys

Prompt

Error Propagation Analysis Prompt Template

A practical prompt playbook for resilience engineers designing agent error handling. Traces how a failure at each plan step cascades through downstream dependencies, identifies single points of failure, and recommends containment boundaries.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
PROMPT PLAYBOOK

When to Use This Prompt

Identify when to run a pre-execution error propagation analysis on an agent plan to prevent cascading failures before they happen.

This prompt is a pre-execution safety analysis tool for agent plans with multiple steps and explicit dependencies. Its job is to trace how a failure at any single step would propagate through the rest of the workflow, identifying single points of failure (SPOFs), cascading impact chains, and containment boundaries. You use it during the plan critique phase, after a structured plan with step IDs and dependency declarations exists but before the agent begins executing irreversible actions. The primary users are resilience engineers, SREs, and agent platform developers who need to design circuit breakers, place retry budgets, and decide where human approval gates belong.

The prompt assumes you already have a structured plan with explicit step IDs, dependency declarations, and a clear execution order. It is not a runtime error handler—it does not react to live failures. It is a static analysis that runs once before execution begins. The output is a propagation graph showing which steps are affected by each potential failure, ranked by blast radius. This lets you harden the most critical nodes first. For example, if a data-fetching step feeds five downstream analysis steps with no fallback, the prompt will flag it as a SPOF and recommend a cache, a default value, or a human-in-the-loop gate before those downstream steps run blind.

Do not use this prompt for simple linear workflows with no branching or for plans where every step is fully independent. If there are no dependencies to trace, the analysis produces noise rather than actionable findings. Also avoid using it on plans that are still being drafted—wait until the plan structure is stable and step IDs are finalized. For plans with high irreversibility (e.g., database mutations, external API writes, customer-facing actions), pair this prompt with the Side Effect Prediction and Review Prompt Template and the Human Approval Gate Placement Review Prompt Template before execution. If the propagation analysis reveals a SPOF with no feasible mitigation, escalate to a human reviewer rather than proceeding with a fragile plan.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Error Propagation Analysis prompt delivers value and where it introduces risk. Use this to decide whether to embed it in your agent planning pipeline.

01

Good Fit: Multi-Step Agent Workflows

Use when: your agent executes plans with 5+ sequential steps where a mid-plan failure would corrupt state or waste significant tokens. Guardrail: Run this analysis before execution begins to identify containment boundaries and single points of failure.

02

Good Fit: Mutable Production Resources

Use when: the agent mutates databases, cloud resources, or external services where partial failures leave unrecoverable side effects. Guardrail: Pair the propagation graph output with a rollback feasibility assessment before approving the plan.

03

Bad Fit: Stateless or Idempotent Workflows

Avoid when: every step is idempotent, stateless, or isolated with no downstream dependencies. The analysis adds latency without reducing risk. Guardrail: Skip this prompt and use a simpler pre-execution completeness check instead.

04

Bad Fit: Single-Step Tool Calls

Avoid when: the agent performs one tool call with no chained dependencies. Propagation analysis produces trivial output that wastes context window budget. Guardrail: Reserve this prompt for plans with explicit step-to-step data or state dependencies.

05

Required Input: Complete Plan with Dependencies

Risk: running propagation analysis on an underspecified plan produces false confidence. Guardrail: Require a fully decomposed plan with explicit inputs, outputs, and dependency edges before invoking this prompt. Reject plans with ambiguous step descriptions.

06

Operational Risk: Analysis Drift During Execution

Risk: the propagation graph becomes stale if the agent replans mid-execution. Guardrail: Re-run this analysis after any dynamic replanning event and compare against the original graph to detect new failure cascades introduced by the revision.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for tracing failure propagation across agent plan steps and identifying containment boundaries.

This prompt template is designed to be pasted directly into your planning module or agent orchestrator's pre-execution review stage. It instructs the model to analyze a complete execution plan and trace how a failure at any given step would cascade through downstream dependencies. The output is a propagation graph that identifies single points of failure (SPOFs), estimates blast radius, and recommends containment boundaries. Replace every square-bracket placeholder with your actual plan, tool manifest, domain constraints, and risk tolerance before use. The template assumes you already have a generated plan; it does not generate the plan itself.

text
You are a resilience engineer reviewing an agent execution plan before it runs. Your task is to perform an error propagation analysis.

INPUT PLAN:
[PLAN]

AVAILABLE TOOLS AND CAPABILITIES:
[TOOL_MANIFEST]

DOMAIN CONSTRAINTS:
[DOMAIN_CONSTRAINTS]

RISK TOLERANCE:
[RISK_LEVEL]

ANALYSIS INSTRUCTIONS:
1. For each step in the plan, identify what would happen if that step fails completely, produces incorrect output, or times out.
2. Trace the failure forward through all downstream steps that depend on the failed step's output. For each affected downstream step, describe the specific impact (blocked, corrupted input, incorrect decision, etc.).
3. Identify single points of failure: steps where failure would block all remaining progress with no alternative path.
4. For each failure propagation path, estimate the blast radius (number of steps affected, criticality of affected outcomes).
5. Recommend containment boundaries: specific points where the plan should insert validation checks, alternative paths, human approval gates, or safe stop conditions to limit propagation.

OUTPUT SCHEMA:
{
  "propagation_graph": [
    {
      "source_step_id": "string",
      "source_step_description": "string",
      "failure_mode": "complete_failure | incorrect_output | timeout | partial_output",
      "affected_steps": [
        {
          "target_step_id": "string",
          "target_step_description": "string",
          "impact_type": "blocked | corrupted_input | incorrect_decision | delayed | none",
          "impact_description": "string",
          "is_blocking": true | false
        }
      ],
      "blast_radius": {
        "steps_affected_count": number,
        "critical_outcomes_affected": ["string"],
        "recovery_possible": true | false
      }
    }
  ],
  "single_points_of_failure": [
    {
      "step_id": "string",
      "step_description": "string",
      "reason": "string",
      "all_downstream_blocked": true | false
    }
  ],
  "containment_recommendations": [
    {
      "insert_after_step_id": "string",
      "recommendation_type": "validation_check | alternative_path | human_approval_gate | safe_stop | retry_with_backoff",
      "description": "string",
      "mitigates_failure_modes": ["string"]
    }
  ],
  "summary": "string"
}

CONSTRAINTS:
- Do not invent failure modes that are impossible given the tool manifest.
- If a step has no downstream dependents, mark its blast radius as zero and note that it is safe to fail.
- For each containment recommendation, specify exactly where it should be inserted and what it protects against.
- If the plan already contains error handling, evaluate whether it is sufficient for the identified propagation paths.
- Flag any step where the tool manifest lacks a capability needed for recovery.

To adapt this template, replace [PLAN] with your structured plan output—ideally a JSON array of steps with IDs, descriptions, inputs, outputs, and dependencies. Replace [TOOL_MANIFEST] with the actual tool schemas available to your agent, including function signatures, permissions, and rate limits. Replace [DOMAIN_CONSTRAINTS] with any regulatory, latency, cost, or data-residency rules that constrain recovery options. Set [RISK_LEVEL] to 'low', 'medium', 'high', or 'critical' to calibrate the depth of analysis. After running the prompt, validate the output against your plan's actual dependency graph: a propagation path that references a non-existent dependency is a hallucination and should fail your eval. For high-risk domains, route the output to a human reviewer before accepting containment recommendations that modify execution flow.

IMPLEMENTATION TABLE

Prompt Variables

Every placeholder required by the Error Propagation Analysis prompt. Validate each before sending to prevent the model from hallucinating dependency chains or missing critical failure modes.

PlaceholderPurposeExampleValidation Notes

[PLAN_STEPS]

Ordered list of plan steps with IDs, descriptions, and declared outputs

Step-1: Query user database; Step-2: Filter by status; Step-3: Generate report

Must be a valid JSON array of objects with id, description, and output fields. Reject if fewer than 2 steps or if any step lacks an id.

[STEP_DEPENDENCIES]

Explicit dependency map showing which steps depend on which outputs

Step-3 depends on Step-2.output; Step-2 depends on Step-1.output

Must be a valid JSON object mapping step IDs to arrays of prerequisite step IDs. Validate that no step depends on itself and all referenced IDs exist in [PLAN_STEPS].

[TOOL_MANIFEST]

Available tools with their failure modes, retry behavior, and idempotency properties

db_query: can timeout, non-idempotent; file_write: can fail on permissions, idempotent with version check

Must include failure_modes array for each tool. Reject if any tool referenced in [PLAN_STEPS] is missing from manifest. Null allowed only if plan uses zero tools.

[CRITICALITY_THRESHOLD]

Minimum severity score for a propagation path to be included in output

0.7

Must be a float between 0.0 and 1.0. Default to 0.5 if not specified. Reject values outside range.

[MAX_PROPAGATION_DEPTH]

Maximum number of downstream steps to trace for a single failure

3

Must be a positive integer. Default to 5 if not specified. Reject values below 1 or above 20 to prevent runaway analysis.

[OUTPUT_FORMAT]

Desired structure for the propagation graph output

adjacency_list

Must be one of adjacency_list, propagation_tree, or impact_matrix. Reject unrecognized values. Validate that the chosen format can represent the dependency structure.

[EXTERNAL_DEPENDENCIES]

Services, APIs, or systems outside the plan that steps depend on

auth_service, payment_gateway, s3_bucket:reports

Must be a JSON array of strings. Each entry should be a named external system. Reject if any entry is empty string. Null allowed if plan has no external dependencies.

[CONTAINMENT_BOUNDARIES]

Predefined isolation points where failure propagation should stop

After Step-2: validation gate; Before Step-5: human approval required

Must be a JSON object mapping step IDs to containment descriptions. Validate that all boundary step IDs exist in [PLAN_STEPS]. Null allowed if no boundaries are predefined.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Error Propagation Analysis prompt into a pre-execution validation pipeline with API call structure, retry logic, and human review gates.

The Error Propagation Analysis prompt is designed to run as a pre-execution safety gate before an agent plan is committed to a runtime. It should be wired into the planning pipeline after plan generation but before any tool calls or state mutations occur. The prompt expects a structured plan (list of steps with dependencies) and a tool manifest as input, and it returns a propagation graph that identifies single points of failure, cascading failure chains, and recommended containment boundaries. Because this analysis directly informs whether a plan is safe to execute, the implementation harness must treat the output as a gating decision, not an advisory note.

API call structure: The prompt should be called synchronously within the plan validation stage. Use a structured output mode (e.g., JSON mode or function calling with a strict schema) to enforce the propagation graph format. The request payload must include [PLAN_STEPS] (array of step objects with id, description, depends_on, and tool fields) and [TOOL_MANIFEST] (array of available tools with name, capabilities, and failure_modes). Set temperature=0 to minimize variance in failure analysis. Retry logic: If the model returns a malformed graph or fails schema validation, retry once with the validation error appended to the prompt as a correction hint. If the second attempt also fails, escalate to a human reviewer rather than silently proceeding. Do not retry more than twice—propagation analysis failures often indicate an ambiguous plan that needs human clarification. Human review gates: Any step flagged as a single point of failure with severity: critical must trigger a human approval gate before execution. Similarly, if the propagation graph identifies a failure chain that would cascade to more than 50% of remaining steps, route the plan for manual review. Log the full propagation graph, the gating decision, and the reviewer's action for auditability.

Model choice: Use a model with strong reasoning capabilities (e.g., Claude 3.5 Sonnet, GPT-4o) for this analysis. Smaller or faster models often miss indirect dependency chains or underestimate cascading effects. Tool use: This prompt does not require tool calls during analysis—it operates on the plan and tool manifest provided in the prompt context. However, the output propagation graph should be consumable by downstream execution monitors that can halt the agent if a predicted failure materializes. Observability: Emit the propagation graph as a structured trace event with plan_id, analysis_timestamp, spof_count, and cascade_risk_score fields. This allows SRE teams to track whether predicted failures actually occurred and whether containment boundaries held. What to avoid: Do not run this analysis on every minor plan revision—cache results keyed by plan hash and tool manifest version. Do not treat the propagation graph as a static artifact; if the tool manifest changes or a step's dependencies are updated during replanning, re-run the analysis before resuming execution.

IMPLEMENTATION TABLE

Expected Output Contract

The exact JSON schema the model must return for the Error Propagation Analysis prompt. Each field is validated before the output is accepted by downstream tooling or human review.

Field or ElementType or FormatRequiredValidation Rule

propagation_graph

array of objects

Must be a non-empty array. Schema check: each element must have step_id, depends_on, failure_mode, and cascade_effect fields.

propagation_graph[].step_id

string

Must match a step identifier from the input plan. Regex: ^[a-zA-Z0-9_-]+$. No fabricated step IDs allowed.

propagation_graph[].depends_on

array of strings

Each string must reference a valid step_id from the input plan. Empty array allowed only for the first step. Circular dependency check: no cycles in the combined graph.

propagation_graph[].failure_mode

string

Must be one of the enumerated failure modes from the input [FAILURE_MODE_CATALOG] or a concrete, specific description. Generic values like 'error' or 'failure' are rejected.

propagation_graph[].cascade_effect

string

Must describe the downstream impact in terms of data corruption, state mutation, tool unavailability, or plan stall. Minimum length 20 characters. Null or empty string rejected.

propagation_graph[].severity

string

Must be one of: 'BLOCKER', 'CRITICAL', 'HIGH', 'MEDIUM', 'LOW'. Enum check enforced. No free-text severity allowed.

propagation_graph[].containment_boundary

string or null

If a containment strategy exists, describe the specific step or gate that limits propagation. If no containment exists, must be null. Empty string rejected; use null instead.

single_points_of_failure

array of strings

List of step_ids whose failure would block all remaining progress. Must be a subset of input plan step IDs. Empty array is valid if no SPOFs are identified.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when the Error Propagation Analysis prompt runs in production and how to guard against each failure.

01

False Negative: Missed Cascading Failure

Risk: The model fails to identify a critical downstream dependency, classifying a high-impact propagation path as safe. This often occurs when plan steps are described at different granularities or use inconsistent naming. Guardrail: Pre-process the plan to normalize step names and explicitly tag output artifacts. Add a second-pass verification prompt that asks: 'Which step, if it produced a corrupt output, would cause the most downstream damage?' and compare answers.

02

Hallucinated Dependencies

Risk: The model invents data flows or resource locks between steps that don't actually exist, causing engineers to waste time hardening non-existent failure paths. This is common when step descriptions are vague. Guardrail: Require the prompt to cite the specific output variable or state change that creates each dependency. Implement a validator that rejects propagation edges not grounded in an explicit input/output match from the source plan.

03

Single Point of Failure Blindness

Risk: The analysis treats all steps as equally critical, failing to highlight the single service, tool, or data source whose failure halts the entire workflow. This produces a flat risk profile instead of actionable priorities. Guardrail: Add a specific instruction to rank nodes by 'blast radius' and explicitly flag any node whose failure blocks >50% of remaining steps. Use a structured output field requiring a list of critical-path-only nodes.

04

Containment Boundary Over-Recommendation

Risk: The model suggests adding retries, circuit breakers, or fallbacks to every step, creating an unbuildable 'perfectly resilient' plan that ignores implementation cost and latency budgets. Guardrail: Include explicit constraints in the prompt: maximum number of recommended containment boundaries, latency budget per step, and a requirement to justify each recommendation with a cost/benefit ratio. Filter output to flag recommendations that exceed thresholds.

05

Stale Plan Drift

Risk: The propagation analysis is run once against a plan that later changes during execution, making the original failure map dangerously out of date. Engineers rely on a stale analysis and miss new vulnerabilities. Guardrail: Embed a plan version hash or timestamp in the prompt input and output. Build a pre-execution hook that compares the current plan hash to the analysis hash and blocks execution if they differ, forcing a re-analysis.

06

Output Format Instability

Risk: The propagation graph output varies in structure (e.g., different node naming, edge representation) across runs, breaking downstream visualization or automated alerting tools that expect a strict schema. Guardrail: Use a strict JSON schema for the output with required fields for nodes, edges, and severity. Implement a post-generation repair step that validates the schema and, on failure, retries with a simplified format instruction emphasizing array consistency.

IMPLEMENTATION TABLE

Evaluation Rubric

Pass/fail criteria and scoring dimensions for evaluating the Error Propagation Analysis output. Use this rubric to gate the prompt before deploying it into a production resilience workflow.

CriterionPass StandardFailure SignalTest Method

Step Coverage

Every step from the input [PLAN] appears in the propagation graph with a unique node ID

Missing steps or duplicate node IDs in the output graph

Parse output JSON, extract all node IDs, and assert set equality with input step IDs

Dependency Edge Accuracy

All edges in the propagation graph correspond to explicit dependencies declared in [PLAN] or inferred from shared resource access

Edges connect steps with no logical dependency, or required dependencies are missing

For each edge, verify the source step's output is consumed by the target step's input per the plan specification

Failure Mode Enumeration

Each step node includes at least one concrete failure mode with a specific trigger condition, not a generic label

Failure modes are vague (e.g., 'step fails') or missing for steps that have external dependencies

Sample 5 random steps and check that failure mode descriptions reference specific tool errors, timeout conditions, or data unavailability

Propagation Path Completeness

For each failure mode, the output traces the full downstream cascade to all affected leaf nodes

Propagation paths stop prematurely before reaching all steps that depend on the failed output

Inject a synthetic failure at a mid-graph node and verify the output cascade includes all transitive dependents

Single Point of Failure Identification

Output explicitly flags nodes whose failure blocks all remaining progress and provides a severity rating

SPOFs are not identified, or non-SPOF nodes are incorrectly flagged as blocking all progress

Remove the highest-degree node from the dependency graph; assert the output marks it as SPOF with rationale

Containment Boundary Recommendation

Each SPOF includes at least one actionable containment strategy (retry, circuit breaker, fallback, or human escalation)

Containment recommendations are missing, generic, or technically infeasible given the tool set in [TOOL_MANIFEST]

Check that each recommendation references a capability available in [TOOL_MANIFEST] or a valid escalation path

Output Schema Validity

Output strictly conforms to the [OUTPUT_SCHEMA] with all required fields present and correctly typed

Schema validation fails due to missing fields, type mismatches, or extra unsupported keys

Validate output against [OUTPUT_SCHEMA] using a JSON Schema validator; reject on any error

No Hallucinated Dependencies

All edges and failure cascades are grounded in the input plan; no fabricated tool interactions or data flows

Output describes dependencies on tools not in [TOOL_MANIFEST] or data flows not specified in [PLAN]

Extract all tool names from output edges and assert they are a subset of tools listed in [TOOL_MANIFEST]

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add a strict JSON output schema with fields for step_id, failure_mode, downstream_impacts[], propagation_path[], containment_boundary, and severity. Include a [TOOL_MANIFEST] placeholder so the model can reference actual tool capabilities when assessing recovery options. Add a retry wrapper that validates schema compliance and re-prompts on parse failure.

Watch for

  • Silent format drift when the model nests propagation paths inconsistently across steps.
  • The model may conflate independent parallel failures into a single cascading chain.
  • Missing containment recommendations for steps that have no viable fallback in the available tool set.
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.