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

Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn

A coordinator asked to compare solar, wind and hydro power emits three Task calls in one response. parallel_plan.py reads all three, answers them in one user turn matched by id, and gets one comparison back. Then the two ways to get it wrong.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Read several Task tool_use blocks from one assistant response
  • Answer them all in one user turn, each tool_result matched by tool_use_id
  • Explain why Task must be in the coordinator's allowed tools
  • Decide when tasks are independent enough to send together and when one must wait

Before you start

  • Claude tool use: tool_use and tool_result
  • Coordinator and subagents: decompose, delegate, check coverage

You run a small research team, and the boss says: compare solar, wind and hydro power. Three topics, three helpers. You could send the first helper off, wait, send the second, wait, send the third, wait. Or you could send all three at once and wait once.

With subagents, the second way is one assistant response holding several Task calls. This article shows that message shape in code, the one rule that makes spawning possible at all, and when you must not go parallel.

Three searches, three round trips

The slow way looks like this. Turn 1: ask for solar, then wait for the answer. Turn 2: ask for wind, wait again. Turn 3: ask for hydro, wait one more time. Three turns, three round trips, and each search starts only after the last one has finished.

The three topics don't depend on each other, so they shouldn't wait in a queue. Think of a manager with three questions for the team. The slow manager sends email one and waits, then email two, then email three. The smart manager writes all three and sends them at the same time; the three replies come back together. One wait, three replies. Claude is the manager, and each subagent is a helper with one errand.

One assistant turn out, one user turn back

Three Task calls in one response 1 assistant turn tool_use Task, id _1 tool_use Task, id _2 tool_use Task, id _3 subagent: solar subagent: wind subagent: hydro 1 user turn tool_result for _1 tool_result for _2 tool_result for _3 same ids on the way back
Several tool_use blocks in one turn, and several tool_result blocks in one turn, matched by id.

Claude writes one assistant turn. Inside it are three tool_use blocks, each a Task call: solar, wind and hydro. Each Task call starts a subagent, and the three work on their own. When they finish, your code sends one user turn with three tool_result blocks, each carrying the tool_use_id of its call. If the general tool round trip is new to you, read Claude tool use: tool_use and tool_result first.

parallel_plan.py in 31 lines

The project uses the Anthropic SDK with a stand-in model on a mock transport (stand_in.py), so no API key is needed; with a real key in .env the same code calls Claude. The stand-in defines one tool named Task with description, prompt and subagent_type fields, and on the first call it answers with three Task blocks in one response.

from stand_in import make_client, TOOLS


def run_subagent(prompt):
    topic = prompt.split(":")[0]
    return f"test subagent reply: notes on {topic}"


ASK = "Compare solar, wind, hydro."
client = make_client()
messages = [{"role": "user", "content": ASK}]
response = client.messages.create(
    model="claude-sonnet-5-5", max_tokens=1024,
    tools=TOOLS, messages=messages)
calls = [b for b in response.content if b.type == "tool_use"]
print(f"1 response -> {len(calls)} Task calls")
results = []
for call in calls:
    print(f"  {call.id}  {call.input['description']}")
    out = run_subagent(call.input["prompt"])
    results.append({"type": "tool_result",
                    "tool_use_id": call.id, "content": out})
messages.append({"role": "assistant", "content": response.content})
messages.append({"role": "user", "content": results})
print(f"1 user turn -> {len(results)} tool_results")
for r in results:
    print(f"  {r['tool_use_id']}  {r['content']}")
final = client.messages.create(
    model="claude-sonnet-5-5", max_tokens=1024,
    tools=TOOLS, messages=messages)
print(final.content[0].text)
  • One create call. Claude may answer with many blocks in a single response.
  • calls collects every Task call from that one response.
  • One tool_result per call, with the same id as its tool_use.
  • Two appends. The assistant content goes back unchanged, then all the results go in one user turn, not three.

Note that run_subagent is a stub that returns a fixed line, and the loop calls it one after another. The file shows the message shape of parallel spawning. In the Agent SDK, the coordinator's Task calls start real subagents, and those run side by side.

Run it

1 response -> 3 Task calls
  toolu_test_1  Research solar power
  toolu_test_2  Research wind power
  toolu_test_3  Research hydro power
1 user turn -> 3 tool_results
  toolu_test_1  test subagent reply: notes on solar
  toolu_test_2  test subagent reply: notes on wind
  toolu_test_3  test subagent reply: notes on hydro
test model reply: 3 reports are back, here is the comparison.

One response, three Task calls, each with its own id. Below that, each result is matched to its call by the same id. The last line says test model reply because the stand-in is answering; it counted three results in the last message and wrote one comparison.

No Task in allowed tools, no subagents

In the Agent SDK there's one rule you must not forget. With allowed_tools=["Read", "Grep"] the coordinator cannot spawn a subagent. With allowed_tools=["Read", "Grep", "Task"] it can. Spawning is a tool call, so the tool must be allowed. The exam guide writes the option as allowedTools; in Python it's allowed_tools. And the exam guide calls the tool Task, while current docs call it Agent, so check the name for your SDK version. The research team coordinator shows the full options.

Parallel only when the work is independent

Ask one question first: does one task need the answer of another?

Independent goes together, dependent waits Independent: send together solar wind hydro none needs another 1 turn Dependent: one, then the other Task: find the supplier Task: read that supplier's prices 2 turns
Parallel is for work that doesn't depend on other work. If a task needs another task's result, it waits.

Solar, wind and hydro: none needs another, so they go in one turn. But find the supplier, then read that supplier's prices is different: the second task needs the first result, so it must wait. Two turns. Sending it early would only make the subagent guess which supplier.

Break it: two ways to get this wrong

Bug 1: one Task per turn. Turn one, turn two, turn three. The message list grows every turn, and each search waits for the one before it. You get the same answer, slower, with a bigger message list.

Bug 2: Task not in allowed tools. With allowed_tools=["Read", "Grep"] no Task call is ever made, and the coordinator does all the work alone. No subagents at all.

The fix for both: all independent Task calls in one response, and Task in allowed tools.

How this shows up in a question

A scenario says a coordinator must research several suppliers whose reports don't depend on each other, and asks which design finishes fastest. Watch for the words same response versus separate turns. Pick the design with all the Task calls together and Task allowed. A single subagent researching everything in order, or calls spread over turns, is slower; Task calls with Task missing from allowed tools never happen.

Common mistakes

  • Sending one tool_result per user message. All results for one assistant turn go back together in one user turn.
  • Losing the id. Every tool_result carries the tool_use_id of its call, or Claude can't tell which result answers which call.
  • Dropping the assistant turn. Append response.content unchanged before the results.
  • Parallelising dependent work. If the second task needs the first answer, it waits a turn.
  • Leaving Task out of allowed tools. The definitions exist, but nothing can spawn them.

Quick recap

PieceRule
Assistant turnAll independent Task calls in one response
User turnEvery tool_result in one message, matched by tool_use_id
Allowed toolsMust include Task (Agent in current docs)
Dependent tasksWait for the result, next turn

The project and its stand-in model are in the community, free to join.

Try it yourself

Add a fourth topic, for example "geothermal", to TOPICS in stand_in.py and run parallel_plan.py again. Predict the printout before you run it: how many Task calls in the one response, how many tool_result blocks in the one user turn, and what number the final line reports. Each subagent still needs its own complete brief; see passing context to subagents.

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 · 120 of 123

Previous
Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
Next post
Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts

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

  • Three searches, three round trips
  • One assistant turn out, one user turn back
  • parallel_plan.py in 31 lines
  • Run it
  • No Task in allowed tools, no subagents
  • Parallel only when the work is independent
  • Break it: two ways to get this wrong
  • How this shows up in a question
  • Common mistakes
  • Quick 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.