Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • Claude.ai Interface Tour: Every Control You Need on One Screen
  • The AI Fluency Model: Delegation, Description, Discernment and Diligence
  • Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
  • Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
  • What Claude Can Do: Extended Thinking, Web Search, Artifacts and File Analysis
  • Getting More From a Claude Chat: Steer the Conversation Instead of Starting Over
  • Claude Research Mode End to End: From One Prompt to a Cited Briefing
  • Claude's Capability Layer: When to Use Skills, Code Execution or Memory
  • Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
  • Adding and Using Skills in Claude: Let Claude Pick the Skill, Then Teach It Your Format
  • Claude Memory, Curation and Incognito: Keep What Helps, Remove What Has Gone Stale
  • Claude Styles, Preferences and Project Instructions: Three Dials, Three Scopes
  • Claude Projects: Knowledge, Instructions and a Real Workspace You Set Up Once
  • Keeping a Claude Project Current and Connected: Refresh, Prune and Grant the Least
  • Claude Scheduled Tasks: Let Claude Work on a Schedule and Email You the Result
  • Claude Code and Claude for Chrome: What They Are and Who They Are For
  • Anatomy of a Good Prompt: Role, Context, Task, Format and Examples
  • Shaping Claude's Output: Format, Tone and Length in a Few Words
  • Iterating and Refining a Prompt: Read, Diagnose, Adjust, Repeat
  • Five Prompting Patterns for Work: Summarise, Extract, Rewrite, Classify and Draft
  • Why Evaluating AI Output Matters Most: Trust, Then Verify
  • Spotting AI Hallucinations and Fabrications: Four Tells and Where Risk Spikes
  • Fact-Checking Claude's Answers: Four Techniques and a Line-by-Line Claim Log
  • Judging AI Output Quality: Four Questions That Score Any Answer
  • Adapting AI Output for Your Audience: One Answer, Three Readers
  • When a Human Must Review AI Output Before It Ships
  • A Personal Validation Checklist for AI Output: Six Lines, Any Draft
  • Fitting Claude Into Real Work: Where It Helps and Where It Never Should
  • Breaking Big Tasks Into Steps With Claude: Small Asks, Checked Hand-offs
  • Designing a Repeatable Claude Workflow: A Reusable Weekly Report Template
  • Measuring If Claude Is Actually Working: One Number, Before and After
  • Communicating AI Value and Limitations to Stakeholders: The Honest Pitch
  • Data Privacy With Claude: What Never Goes in a Prompt, and How to Redact a Document Before You Paste It
  • Responsible AI Use and Transparency: Helpful, Honest, Harmless, and One Honest Line
  • Troubleshooting a Weak Claude Answer: Name the Cause, Fix One Thing, Then Make It Cheaper
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • Claude Code's Built-in Tools: Read, Write, Edit, Bash, Grep and Glob, and When Each One Is the Right Pick
  • The CLAUDE.md Hierarchy: User, Project and Directory Files, How They Stack, and the Team Rule Stuck on One Laptop
  • Split a 600-Line CLAUDE.md: @import Lines, .claude/rules Files and Which One to Pick
  • Path-Specific Rules in Claude Code: paths Globs, When a Rule Loads and the Glob That Matches Nothing
  • Claude Code Slash Commands and Skills: Project vs User Scope, $ARGUMENTS, context: fork and allowed-tools
  • Iterative Refinement with Claude Code: Input/Output Examples, Tests First and the Interview Pattern
  • Claude Code Sessions: Resume by Name, Fork From a Baseline, or Start Fresh With a Summary Card
  • CI Reviews That Don't Repeat Themselves: Prior Findings, Existing Tests and Test Standards in CLAUDE.md
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  • Validation-Retry Loops for Claude Extraction: Send Back the Exact Errors, and Stop When a Retry Cannot Help
  • Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
  • When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
  • Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
  • Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking
  • Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them
  • Lab: An Extraction Pipeline With a Nullable Schema, Validation-Retry, a 100-Request Batch and Human Review
  • Lab: A Research Pipeline With Parallel Subagents, a Timeout That Keeps Its Partial Results, and a Report With Its Trail
  • Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
  • Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
  • Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
  • Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts
  • Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone
  • Scoped Tools per Agent and tool_choice: Three to Five Tools per Role, a Shared One, and auto, any or a Forced Tool
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found

A research system asks whether customers prefer chat or email support, and the email search times out on page 3. The subagent retries once, then sends the coordinator the failure type, four logged attempts and two kept results, and the final report marks email as THIN instead of going quiet.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Retry a transient failure inside the subagent before telling the coordinator
  • Return a failure report with failure_type, attempted, partial_results and alternatives
  • Tell an empty search (status ok, no matches) from a failed one (status partial, timeout)
  • Write coverage notes so the final report shows where each answer is thin

Before you start

  • How a coordinator hands work to subagents
  • Basic Python dicts and exceptions

A research system is answering one question: Do customers prefer chat or email support? A coordinator hands the searching to subagents. Sooner or later one search fails. Here, the email search comes back with two words: search unavailable.

What can the coordinator do with that? Not much. It doesn't know what failed, what was tried, or whether anything was found before the failure. This article builds a subagent that reports a failure properly, and a coordinator that turns the report into an honest final answer.

One search fails, two bad endings

The coordinator sends a search subagent to the email support data. The subagent searches, and the answer is a timeout. Now a badly built system has two choices, and both are wrong:

  • The whole run stops. The chat and phone searches already finished, and their results are thrown away.
  • The gap just vanishes. The final report never mentions email, and nobody can tell that half of the question was never answered.

Two field reporters

Picture two reporters phoning the editor from a match. Reporter A says: no story. Why? What happened? What do I tell the readers? The editor can only guess.

Reporter B says: the stadium is closed (the failure type). I tried the gate twice (what was tried). I got two interviews (the partial results). I can try the press office (an alternative). Now the editor can decide. A subagent's failure report should sound like reporter B.

What travels back to the coordinator

Three subagents, three kinds of report coordinator chat search status: ok 3 results email search page 3: timeout retry once, still fails phone search status: ok results: [] (no matches) status: partial failure_type: timeout attempted: 4 tries partial_results: 2 alternatives: survey
Only the email search failed, and its report says what failed, what was tried, what it has and where to look next.

Two anti-patterns

The silent empty. The email search times out, but the subagent returns an empty list as if it had succeeded. The coordinator reads that as "nobody wrote about email". The timeout is gone, and the gap is invisible.

Killing the run. One timeout and everything stops. Two finished searches are thrown away, and there's no report at all.

A generic status like "search unavailable" is no better than either. It says nothing about what failed, what was tried, or what was found. All three lose information the coordinator needs to recover.

subagent_report.py: retry once, then report

The project runs on stand-in data, so there's no model and no API key. The pages are a small dictionary, and fetch raises a TimeoutError for whichever page you tell it to fail.

"""A search subagent: retry once locally, then report what it knows.
Stand-in data, no key."""
PAGES = {"email_support": ["Email: fine for billing questions",
                           "Email: slow when the issue is urgent"],
         "chat_support": ["Chat: quick answers",
                          "Chat: easy to ask more",
                          "Chat: good for short fixes"],
         "phone_support": [],
         "survey_archive": ["Survey: email wins for detailed issues"]}


def fetch(source, page, fail=None):
    if fail == (source, page):
        raise TimeoutError(f"{source} page {page} timed out")
    return PAGES[source][page - 1:page]


def search(source, pages=1, fail=None, alternatives=()):
    found, attempted = [], []
    for page in range(1, pages + 1):
        for attempt in (1, 2):
            attempted.append(f"{source} page {page}, try {attempt}")
            try:
                found += fetch(source, page, fail)
                break
            except TimeoutError:
                if attempt == 2:
                    return {"status": "partial",
                            "failure_type": "timeout",
                            "attempted": attempted,
                            "partial_results": found,
                            "alternatives": list(alternatives)}
    return {"status": "ok", "source": source, "results": found}

Read search from the inside out:

  • Retry once, locally. A timeout may pass, so each page gets a second try right here, before anyone else hears about it. The subagent is closest to the problem, so it handles the transient case itself.
  • status partial and failure_type. If the second try also fails, the report says what kind of failure it was.
  • attempted. Every page and try is logged, so the coordinator knows what not to repeat.
  • partial_results. Whatever was found before the failure is kept, so nothing is thrown away.
  • alternatives. Another source to try. The coordinator passes in the survey archive.

A search that works and finds nothing takes the last line: status is "ok" and results is an empty list. That's a real answer, and it looks different from a failure on purpose.

The report keys here are the project's own convention, not part of any SDK. What matters is that the four pieces of information are there.

coordinator.py: one decision per report

"""The stand-in coordinator: reads each report, decides, annotates."""
from subagent_report import search


def decide(report):
    if report["status"] == "ok" and report["results"]:
        return "USE the results"
    if report["status"] == "ok":
        return "RECORD: searched, found nothing"
    if report["alternatives"]:
        return "KEEP partial, TRY " + report["alternatives"][0]
    return "KEEP partial, mark the gap"


reports = [search("chat_support", 3),
           search("email_support", 3, ("email_support", 3),
                  ["survey_archive"]),
           search("phone_support", 1)]
notes = []
for r in reports:
    print(decide(r))
    if r["status"] == "partial":
        kept = len(r["partial_results"])
        print("  failure:", r["failure_type"], "| tried",
              len(r["attempted"]), "| kept", kept)
        extra = search("survey_archive", 1)
        notes.append("email support: THIN, page 3 unavailable, "
                     f"survey archive added {len(extra['results'])}")
    elif r["results"]:
        notes.append("chat support: WELL SUPPORTED, all pages")
    else:
        notes.append("phone support: NO MATCHES, searched ok")
print("REPORT NOTES")
for n in notes:
    print(" -", n)

decide has four outcomes. Results: use them. Status ok but empty: record it, because it is a valid answer. Partial with an alternative: keep what was found and try the alternative. Partial with nothing else to try: keep it and mark the gap. In every branch the gap ends up in notes, so it reaches the final answer. In a real system a model makes these decisions; here simple rules stand in for it.

The run sets up the failure on purpose: the email search is told to time out on page 3, with the survey archive as its alternative.

Run it

Running python coordinator.py:

USE the results
KEEP partial, TRY survey_archive
  failure: timeout | tried 4 | kept 2
RECORD: searched, found nothing
REPORT NOTES
 - chat support: WELL SUPPORTED, all pages
 - email support: THIN, page 3 unavailable, survey archive added 1
 - phone support: NO MATCHES, searched ok
  • Chat came back complete, so the coordinator uses the results.
  • Email timed out. "tried 4" is page 1 try 1, page 2 try 1, then page 3 twice. "kept 2" is the two email pages it read before page 3. The coordinator keeps them and tries the survey archive, which adds one more result.
  • Phone searched fine and found nothing. That's recorded, not retried.
  • REPORT NOTES has one coverage line for each area.

Empty is not failed

Be careful with one case. An empty list can mean two opposite things.

An empty list can mean two opposite things searched fine, found nothing status: "ok" results: [] a valid answer: zero matches record it could not finish the search status: "partial" failure_type: "timeout" not an answer: the search stopped try an alternative or flag it
Same empty list on screen, opposite meanings. The status field tells the coordinator which one it got.

The phone search worked and there was nothing there. That is information: zero matches. The email search stopped before it could finish. That isn't an answer at all. If both come back as [], the coordinator has to guess, and it will usually guess "nothing there".

Coverage annotations in the final report

The last step is the final report. The coordinator writes the answer and marks how well each part is supported, straight from the notes above:

AreaWhat was found (stand-in data)Coverage
ChatQuick answers, easy to ask moreWELL SUPPORTED: every page was read
EmailFine for billing, slow when urgentTHIN: page 3 unavailable, survey archive added
PhoneNo matches foundNO MATCHES: searched fine, nothing there

Now a reader can see what to trust and exactly where the gap is. The email answer is still useful; it just says how thin it is.

Common mistakes

  • Returning [] on a timeout. The failure becomes a fake "no matches", and the gap disappears.
  • Raising all the way up. One timeout kills the run and throws away the searches that worked.
  • A bare "search unavailable". No type, no attempts, no partial results, no next step.
  • Sending every transient error up. A timeout that a second try would fix should be retried where it happened.
  • Retrying an empty result. Status ok with no matches is an answer. Record it and move on.
  • A final report with no coverage notes. The reader can't tell a well-supported answer from a thin one.

Recap

ReportMeaningCoordinator does
status ok, resultsSearch workedUse the results
status ok, []Searched, zero matchesRecord it, don't retry
status partial, alternativesFailed after a local retryKeep partial, try the alternative
status partial, no alternativesFailed, nowhere else to lookKeep partial, mark the gap

On the exam, when a subagent times out, pick the answer that retries locally and then sends the coordinator the failure type, the attempts, the partial results and the alternatives. Reject a bare "unavailable", an empty success and stopping the whole run.

Try it yourself

Call search("email_support", 3, ("email_support", 3)) with no alternatives and check that decide returns "KEEP partial, mark the gap". Then make page 1 fail instead of page 3 and see what partial_results holds and how many attempts are logged.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 113 of 123

Previous
When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
Next post
Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Related posts

The Claude Messages API: Your First Call, Field by Field

One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.

Claude Tool Use: How tool_use and tool_result Work in the Messages API

Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.

Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared

Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.

Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move

Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.

On this page

  • One search fails, two bad endings
  • Two field reporters
  • What travels back to the coordinator
  • Two anti-patterns
  • subagent_report.py: retry once, then report
  • coordinator.py: one decision per report
  • Run it
  • Empty is not failed
  • Coverage annotations in the final report
  • Common mistakes
  • Recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.