Error Recovery in Agent Chains
When step 3 of 5 fails, what happens?
The quick read · Pattern 05
The 60-second version
A failed step should leave the user with preserved work and a clear decision. Show where the chain stopped, what survived, and how each recovery option changes the remaining deliverable.
- Checkpoint completed steps and identify the failed input or dependency.
- Explain retry, guidance, alternative approach and partial-delivery options.
- Show downstream effects before continuing, then record the chosen recovery.
Watch for: Some dependencies must block the chain. Do not present skipping a safety check as an ordinary route to completion, or label partial work as a complete result.

The Problem
When an agent executes a five-step workflow and step 3 fails, the user faces a question that most agent systems refuse to answer: what just happened to my work? Traditional software errors are deterministic — the same input produces the same failure, and you can retry with confidence. Agent chain errors are different. The LLM may have consumed tokens, written partial files, called external APIs, or committed side-effects that can't be unwound. The partial result from steps 1 and 2 may be genuinely valuable — or it may be unusable without steps 3-5. The user needs to understand what broke, what was preserved, what's still achievable, and what their real options are. Most systems give them none of that.
I've built agent chains that coordinate nine specialist bots, and I've watched every failure mode in production. The lesson: error recovery isn't an edge case you handle in a catch block. It's a core interaction design problem that determines whether users trust the system enough to delegate multi-step work at all.
The Anti-Pattern
The Full Abort. A chain stops at the third step and throws away the results of the first two.
The Silent Skip. The chain skips a failed validation step and presents an apparently complete result.
The Blind Retry. Repeating the same action with the same inputs after a permanent failure adds delay without changing the outcome.
The Error Message From Hell. A raw traceback may help a developer. A reviewer needs to know which step failed, what was preserved, and what can happen next.
The common failure across all four: treating agent chain errors like traditional software errors — as binary (worked / didn't work) rather than as a spectrum of partial completion with user-meaningful decision points.
The Pattern
Core Principle: Checkpoint and Branch
Treat every step in an agent chain as a checkpoint — a preserved state that the user can return to, inspect, and branch from. This borrows from database transaction concepts (savepoints, not just commit/rollback) and version control (branches, not just undo). The mental model is: every completed step is saved work. A failure at step 3 doesn't erase steps 1 and 2 — it creates a decision point where the user chooses what happens next.
This is the Traceability pillar from accountability-lab.studio applied to error states: every step's outcome — success or failure — is a first-class record that can be inspected, contested, and acted upon.
State 1: Chain Execution with Live Checkpoints
As the agent executes a multi-step workflow, each completed step is visually marked as a checkpoint — a saved state the user can return to:
-
Quarterly report
- 1 · completed & saved
- Q3 revenue: 847 records
- 2 · completed & saved
- 12 region summaries
- 3 · running · 0:34 elapsed
- Generating narrative analysis
- 4 · waiting
- Format slide deck
- 5 · waiting
- Send to stakeholders
The "saved X ago" timestamps aren't decoration — they communicate that results are persisted, not just in volatile memory. The user's mental model shifts from "the agent is doing a thing" to "the agent is building up saved work, step by step." This is a fundamentally different relationship with failure.
State 2: Failure Detection — The Explain and Offer Moment
When a step fails, the interface transitions to the most critical screen in the entire pattern: the explain and offer interaction. This is where trust lives or dies. The failure surface must answer three questions in order:
- What happened — in human language, not error codes
- What's preserved — reassurance that prior work isn't lost
- What you can do — concrete options, not a dead end
-
Step 3 · failed
The narrative exceeded the context window while processing 847 records. No narrative was produced.
-
Preserved
- Revenue data
- 847 records saved
- Region summaries
- 12 tables saved
-
Choose a recovery
- Retry with smaller batches
- Process one region at a time
- Provide guidance
- Narrow the focus
- Skip narrative
- Deck will contain data without commentary
- Take existing outputs
- Download the region summaries
- Alternative approach
- Use a report template
- Abort
- Stop the chain and retain saved work
Critical design decisions in this screen:
- The explanation is causal, not technical. Not "context window exceeded" but "trying to process all 847 records at once." The user understands why in terms of the task, not in terms of the infrastructure.
- The "what's preserved" section exists. This is the single most important anxiety-reducer. Users who've been burned by the Full Abort pattern need explicit reassurance that their completed work is safe.
- Every option names its consequence. "Skip this step" doesn't just say "skip" — it says "Slide deck will have data only, no commentary." The user makes an informed choice. This is the Contestability pillar: the user can meaningfully evaluate and choose, not just accept or reject.
- "Retry" is not the default option. It's one of six. In traditional error UX, retry is always the primary action. In agent chains, retry is often the wrong action — the one that wastes the most time with the lowest probability of a different outcome. The options are ordered by likely usefulness, not by convention.
- Abort preserves data. Even the nuclear option doesn't destroy prior checkpoints. The user can abort and come back tomorrow with the saved data from steps 1 and 2.
State 3: Cascading Failure Analysis
When step 3 fails, steps 4 and 5 don't just "wait" — they may be invalidated. Step 4 ("format into slide deck") was designed to format the narrative from step 3. Without that narrative, step 4 produces a fundamentally different output. The system must reason about cascading dependencies and communicate them:
-
Step 4 · can proceed with changes
The deck will contain tables and charts, without narrative commentary.
-
Step 5 · review before sending
Stakeholders would receive a data-only deck. Add commentary or hold the send.
- Review adjusted plan
- Continue within authority
Some cascading failures are hard stops, not soft degrades:
-
Step 3 · tests failed
Release requirement not satisfied.
-
Step 4 · deployment blocked
Resolve the failure and rerun the required checks. An exceptional override, if permitted, follows a separate authorised process.
The key interaction: never silently degrade downstream steps. If the user chooses "Skip step 3," show them what steps 4 and 5 become without step 3's output before they proceed. This is informed consent for partial results, not silent corruption.
State 4: The Partial Result Handoff
When the user chooses "Take what we have" or the chain completes with skipped steps, present the partial result with full context — not as a failure, but as a clearly-scoped deliverable:
-
Partial result · 3 of 5 steps delivered
- revenue_data_q3.csv
- 847 records
- region_summaries.xlsx
- 12 sheets
- q3_report_partial.pptx
- 14 data-only slides; no narrative
- Not delivered
- Narrative analysis and stakeholder send
- Download partial outputs
- Resume workflow
- View decision log
"View decision log" links to a full audit trail of every step: what ran, what was returned, what failed, what the user decided, and when. This is the Traceability pillar applied directly — the same concept behind the Decision Record Explorer at accountability-lab.studio. The log isn't for compliance; it's for the user to understand and resume their own work.
State 5: Resume from Checkpoint
A saved checkpoint isn't useful unless the user can actually return to it. The resume interaction:
-
Quarterly report · paused 3 hours ago
Revenue data and 12 summaries were saved. Narrative generation failed.
- Before resuming
- Check source freshness and whether saved inputs remain valid
- Proposed retry
- Resume step 3 with one region per batch
- Review inputs
- Resume from step 3
The agent does three things: confirms the checkpoint data is still valid (it hasn't gone stale), explains what it would do differently this time (not a blind retry), and asks for permission. This is the entire Checkpoint and Branch pattern in action — the user picks up exactly where they left off, with their completed work intact and a modified plan for the failed step.
Annotated Wireframe Description
Error Recovery Decision Panel — Component Structure
| Component | Behaviour | Design Notes |
|---|---|---|
| Chain Progress Rail | Vertical step list, left side. Each step shows icon (✅ ❌ ⏳ ○), label, and metadata (record count, timestamp). | Always visible during execution. Completed steps are expandable to show outputs. Failed step is expanded by default. |
| Failure Explanation Card | Expanded inline below the failed step. Three sections: What happened / What's preserved / Your options. | White background with amber left border. "What happened" in 1-2 sentences, max 40 words. No error codes visible by default. |
| Preservation Checklist | Bulleted list inside the failure card. Each prior step's output with ✅ and one-line description. | Explicit reassurance. Must name what is preserved, not just "prior work saved." |
| Option Buttons | Stacked full-width buttons inside the failure card. Each has icon, label, and 1-line consequence description. | NOT radio buttons — each is a distinct action. Order by estimated usefulness, not alphabetically. Retry is never first unless context analysis suggests it will succeed. |
| Cascade Impact Panel | Appears below the failed step, above pending steps. Shows how each downstream step is affected. | Uses ⚠️ (degraded but possible) or 🚫 (blocked) per step. Each shows a one-line description of what changes. |
| Partial Result Summary | Full-width card at completion. Lists every step with status, links deliverable files. Includes "resume from checkpoint" prompt suggestion. | Appears only when workflow completes with skipped/failed steps. The resume prompt is pre-written — the user can copy-paste it. |
| Decision Log Link | Small text link below the partial result summary. Opens full audit trail. | Every decision the user made (retry, skip, abort) is logged with timestamp. Every step's input/output is recorded. |
| Technical Detail Drawer | Collapsed by default below the failure explanation. Expands to show raw error, request/response data, token counts. | For power users and debugging. Never shown by default. Labeled "Technical details" not "Error log." |
Design in practice
In a fictional five-step supplier report, steps one and two have saved outputs. The third step fails because its source is unavailable. Let the reviewer inspect what succeeded, retry just the affected step, or accept a clearly marked partial result.
Implementation Notes
Checkpoint Data Model
Every chain step must persist its output as a first-class object, not just pass it forward in memory:
ChainCheckpoint {
chain_id: string // Unique workflow execution ID
step_index: number // Position in the chain (1-indexed)
step_label: string // Human-readable step name
status: "completed" | "failed" | "skipped" | "pending"
started_at: timestamp
completed_at: timestamp | null
input_snapshot: object // What the step received
output_snapshot: object // What the step produced (null if failed)
error: { // Only if status == "failed"
technical: string // Raw error for logs
user_explanation: string // Human-language explanation
retryable: boolean // System's assessment of retry viability
retry_strategy: string // "same" | "modified" | "alternative"
suggested_actions: Action[]
}
downstream_impact: [{ // Cascade analysis
step_index: number
impact: "blocked" | "degraded" | "unaffected"
explanation: string
}]
artifacts: [{ // Files or data produced
name: string
type: string
path: string
size: number
}]
}
Retry Classification
Not all failures are created equal. The system must classify failures to suggest appropriate options:
| Failure Type | Retryable? | Strategy | Example |
|---|---|---|---|
| Rate limit / timeout | Yes, with backoff | Same inputs, delayed | API 429, network timeout |
| Context overflow | Yes, with modification | Chunk inputs, summarise first | Token limit exceeded on large input |
| Permission / auth | No (without user action) | User provides credentials | OAuth token expired, MFA required |
| Data not found | Depends | User provides alternative source | Referenced file deleted, API endpoint changed |
| Hallucination / bad output | Risky | Modified prompt, different model | Output failed validation, contradicted source data |
| Dependency failure | No | Fix upstream first | Step 3 needs step 2's output, which was corrupted |
Critical implementation rule: Never auto-retry hallucination or bad-output failures. Retrying with the same prompt may produce a different wrong answer that happens to pass validation — this is worse than the original failure because it's silently wrong. Surface these to the user every time.
Cascade Analysis Algorithm
When step N fails, iterate through steps N+1 to end:
- For each downstream step, check whether it directly consumes step N's output.
- If yes: mark as blocked (can't proceed at all) or degraded (can proceed but with reduced quality/scope). The distinction depends on whether step N's output is the primary input or an enrichment input.
- If no: mark as unaffected — it can proceed regardless.
- Propagate transitively: if step N+1 is blocked and step N+2 depends on N+1, then N+2 is also blocked.
Expose this as a downstream_impact array on the checkpoint so the UI can render cascade warnings without re-computing dependencies.
Event Interface
Emit structured events for every state change:
chain.step.completed { chain_id, step_index, artifacts }
chain.step.failed { chain_id, step_index, error, downstream_impact }
chain.user.decided { chain_id, step_index, action: "retry" | "skip" | "abort" | "manual_input" | "fork" }
chain.resumed { chain_id, from_step_index, modified_plan }
chain.completed { chain_id, steps_completed, steps_skipped, steps_failed }
The chain.user.decided event is the Traceability and Contestability backbone. Every user decision at a failure point is logged as a first-class event — what they chose, when, and (for "manual_input" or "fork") what they provided. This feeds into Anthony's Decision Record Explorer concept: weeks later, you can see exactly why a partial result was delivered, who decided to skip which step, and what they were shown at the time.
Edge Cases
- Stale checkpoints: If a user resumes a workflow hours or days later, the checkpoint data may be stale (source data changed, API tokens expired). The resume flow must validate checkpoint freshness before proceeding. Show: "Your revenue data was pulled 6 hours ago. Want to re-pull fresh data or continue with the cached version?"
- Side-effect steps: Some steps have external side-effects that can't be rolled back (email sent, API called, record created). Mark these as
side_effect: truein the chain definition. If a later step fails, the error surface must list which prior side-effects already fired and can't be undone: "Note: Step 2 already sent a calendar invite to 4 attendees. That invite is live regardless of what you decide here." - Concurrent chain branches: If the user forks to an alternative approach at step 3, the original steps 4-5 plan should be preserved as a named branch they can return to. Don't discard the original plan — the fork might not work either.
- Cost accumulation: For chains with monetary cost (API calls, token spend), show cumulative cost at each checkpoint: "Spent so far: $0.12 on GPT-4 tokens." This helps the user decide whether to retry (spending more) or take the partial result.
When to Use / When NOT to Use
Use This Pattern When:
| Scenario | Why |
|---|---|
| Multi-step agent workflows (3+ steps) | Single-step tasks don't need checkpoints — they either work or don't. The pattern adds value when there's meaningful intermediate state worth preserving. |
| Steps with side-effects (API calls, file writes, emails) | When you can't "undo" a step, the user must know what already happened before deciding what to do about a failure downstream. |
| Expensive workflows (time, tokens, API costs) | The cost of losing all progress and starting over is high enough to justify the checkpoint infrastructure. |
| Workflows where partial results have value | If steps 1-2 produce a usable intermediate deliverable (data export, draft, summary), the user should be able to take it and go. |
| Enterprise/professional contexts | Where accountability matters — the decision log isn't just nice-to-have, it's governance. Directly serves the Accountability Lab's four pillars. |
Do NOT Use When:
| Scenario | Why |
|---|---|
| Single-step tasks | A single LLM call that fails just needs a retry button and an explanation. Don't build a checkpoint rail for one step. |
| Fully idempotent chains | If every step can be safely re-run with no side-effects and low cost, a simple "retry from the beginning" is fine. Don't over-engineer. |
| Real-time / latency-critical interactions | The explain-and-offer interaction takes user time. If the workflow is sub-second (autocomplete, inline suggestions), fail silently and try again rather than interrupting the user's flow. |
| Internal agent chains invisible to the user | If the user asked for one thing and the agent internally decomposes it into sub-steps, the checkpoint rail is implementation detail. Surface it only if the user opted into transparency (see Pattern #1: Delegation Transparency). |
| Exploration / brainstorming tasks | If the user is iterating quickly and expects most attempts to be throwaway ("generate 5 versions of this headline"), heavy error recovery UX slows them down. A simple "that one didn't work, here are the others" is sufficient. |