The moment a task feels too large for a single agent, the instinct is to reach for a multi-agent system. Spin up a team. Divide the work. Let agents coordinate. It is a reasonable instinct, but it skips the question that actually matters: what kind of coordination does this task need?
The Claude Agent SDK gives you two fundamentally different coordination models - subagents and agent teams - and choosing the wrong one is one of the most common architecture mistakes we see in production agentic ai architecture. This article breaks down how each model works, when to reach for each one, and the orchestration patterns that connect them. At RoboticForce, we built Sugar, our open-source autonomous task queue for AI coding agents, on top of these exact patterns. The lessons here come from real implementation, not theory.
What Are Claude Subagents
A subagent in the Claude Agent SDK is an isolated agent invocation launched by a parent agent to handle a bounded piece of work. The parent defines the task, hands it off, and waits for a result. The subagent runs in its own context window with no shared memory and no awareness of sibling subagents. When it finishes, its result flows back to the parent. The subagent itself is then discarded.
The key property is context isolation. Each claude subagents instance starts fresh. It does not carry the accumulated conversation history, intermediate tool calls, or internal reasoning of the parent. This is not a limitation - it is the mechanism that makes subagents useful. When a task requires compressing a large body of information down to a focused output, isolation prevents the subagent from being confused by context it does not need. Subagents are not just a parallelism tool. They are a compression tool.
Consider a parent agent that needs to analyze twenty support tickets and produce a summary of recurring issues. The parent could process all twenty tickets in its own context window, but that context window fills up fast and the model's attention dilutes. The better design launches twenty subagents in parallel - each one receives a single ticket, extracts structured findings, and returns a compact result. The parent aggregates twenty clean outputs rather than reasoning across twenty raw inputs simultaneously.
What Are Agent Teams
Agent teams are a different coordination primitive. Rather than a fire-and-forget dispatch model, teams involve multiple agent instances that maintain state over time, share a common task list or message queue, and coordinate with each other - either peer-to-peer or through a team lead that manages assignments and aggregates progress.
In a multi agent systems team setup, agents have persistent identities within the workflow. A research agent and a writing agent in the same team can exchange intermediate drafts, flag blockers, and build on each other's work across multiple rounds of iteration. The team lead tracks which subtasks are done, which are blocked, and what the overall goal state looks like.
This makes agent teams the right choice when the work is inherently iterative, when intermediate outputs from one agent need to influence the inputs of another before either is finished, or when the task has too much internal dependency to decompose cleanly into independent parallel jobs.
Subagents vs Agent Teams at a Glance
Claude Subagents
- Isolated context window per invocation
- Fire-and-forget from the parent's perspective
- No awareness of sibling subagents
- Results flow back to parent on completion
- Instance is discarded after result is returned
- Optimal for parallel, independent tasks
- Compresses large inputs into focused outputs
- Lower coordination overhead
Agent Teams
- Persistent agent instances within a workflow
- Shared task list or message queue
- Peer-to-peer or team lead coordination
- Iterative handoffs between agents
- State maintained across multiple rounds
- Optimal for dependent, iterative tasks
- Handles internal task dependencies
- Higher coordination overhead
When to Use Each: A Practical Decision Framework
Before choosing a coordination model, ask two questions. First, can the work be fully specified before it starts? If a parent agent can define a complete, self-contained task description for a unit of work without needing to see intermediate outputs from other concurrent agents, that is a subagent candidate. Second, do intermediate results need to influence other work before completion? If yes, that dependency requires a team structure where agents can exchange state.
Subagents are the right choice when you need to process a batch of similar items in parallel - document classification, data extraction across many records, summarization of independent sources, or parallel web research across unrelated topics. In Sugar, we use subagent dispatch to run multiple code analysis tasks in parallel across a repository. Each subagent handles a single module with full isolation. The parent receives structured findings and synthesizes them without ever holding all the module analysis in one context window.
Agent teams are the right choice when the workflow has a review-revise loop, when a specialist agent's output changes what another agent needs to do, or when the task requires genuine back-and-forth negotiation between roles. A content pipeline where a research agent produces findings that a writing agent drafts, which then goes back to the research agent for fact-checking, is a team workflow - not a subagent workflow. The sequential dependency and iterative revision cycle require persistent state and coordination.
The Five Orchestration Patterns
Whether you are working with subagents, agent teams, or a combination of both, most multi agent architecture falls into one of five orchestration patterns. Understanding which pattern a workflow requires usually makes the subagent-vs-team decision obvious.
Prompt Chaining
Output of one agent becomes input to the next in a linear sequence. Each step is scoped and isolated. Simple, predictable, and easy to debug. Right for workflows where each stage transforms a well-defined artifact - draft, review, refine.
Routing
An intake agent classifies the input and dispatches it to a specialized agent for that category. The router does not handle the task - it routes it. Reduces the complexity of any single agent and keeps specialists focused on what they do well.
Parallelization
Independent subtasks run concurrently via subagents. The parent waits for all results and aggregates them. Best when the subtasks have no dependencies on each other and the bottleneck is throughput, not reasoning depth. Classic subagent territory.
Orchestrator-Worker
A planning agent breaks the goal into tasks, assigns each to a worker agent, monitors progress, and handles blockers. Workers report back but do not coordinate with each other directly. This is the most common pattern for complex agentic workflows with dynamic task lists.
Evaluator-Optimizer
A generator agent produces an output, an evaluator agent scores it against criteria, and the generator revises based on the evaluation. Loops until the evaluator passes the output or a maximum iteration count is hit. This requires an agent team structure with shared state between generator and evaluator.
Prompt chaining, routing, and parallelization are naturally suited to subagent dispatch. Orchestrator-worker and evaluator-optimizer require a team structure, because both involve agents that need to observe each other's state and respond dynamically.
Defining Subagents with the Claude Agent SDK
In the Claude Agent SDK, a subagent is defined by the task description you pass at invocation time. The parent constructs a complete, self-contained prompt that gives the subagent everything it needs. The subagent has no access to the parent's context - only what is in its own prompt and the tools it is given.
Here is a practical example of ai agent orchestration using the Claude Agent SDK. A parent agent launches parallel subagents to analyze individual files and then aggregates the results:
import anthropic
import asyncio
client = anthropic.Anthropic()
def run_analysis_subagent(file_path: str, content: str) -> dict:
"""
Each subagent receives only what it needs.
No shared state with parent or sibling subagents.
"""
response = client.messages.create(
model="claude-opus-4-5",
max_tokens=1024,
system=(
"You are a code analysis specialist. "
"Analyze the provided file and return structured findings only. "
"Do not request additional context."
),
messages=[
{
"role": "user",
"content": (
f"Analyze this file: {file_path}\n\n"
f"Return JSON with keys: complexity, issues, dependencies, summary.\n\n"
f"File content:\n{content}"
),
}
],
)
return {
"file": file_path,
"analysis": response.content[0].text,
}
def orchestrate_codebase_analysis(files: dict[str, str]) -> dict:
"""
Parent agent dispatches one subagent per file.
Each subagent is isolated - no shared context window.
Parent aggregates results after all subagents complete.
"""
# Dispatch subagents in parallel (use threads for sync SDK)
import concurrent.futures
results = {}
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
future_to_file = {
executor.submit(run_analysis_subagent, path, content): path
for path, content in files.items()
}
for future in concurrent.futures.as_completed(future_to_file):
result = future.result()
results[result["file"]] = result["analysis"]
# Parent synthesizes - never held all file content at once
synthesis_response = client.messages.create(
model="claude-opus-4-5",
max_tokens=2048,
messages=[
{
"role": "user",
"content": (
"Synthesize these per-file analyses into an overall codebase report. "
"Identify cross-cutting issues and priority refactoring opportunities.\n\n"
f"Analyses: {results}"
),
}
],
)
return {
"per_file": results,
"synthesis": synthesis_response.content[0].text,
}The parent never processes all files simultaneously. It constructs isolated subagent tasks, dispatches them in parallel, and reasons over the compressed results. This pattern scales to hundreds of files without the parent's context window becoming a bottleneck. In Sugar, this same structure drives how we parallelize static analysis tasks across a codebase before presenting a unified task plan to the orchestrating agent.
How Subagents Flow Through an Orchestration
When NOT to Use Multi-Agent Systems
Multi agent systems add coordination overhead. Every boundary between agents is a place where information can be lost, misinterpreted, or duplicated. Every dispatch is an additional model call. Before reaching for a multi-agent architecture, ask whether a single, well-designed agent loop with good tool use would handle the task adequately.
The answer is often yes. A single agent with five focused tools and a well-structured system prompt can handle most tasks that teams try to solve with three coordinating agents. The single-agent version is cheaper, easier to debug, and faster to iterate on. Start there. Add multi-agent coordination only when you can point to a specific measured bottleneck that requires it - context window overflow, task independence that enables genuine parallelism, or specialization requirements that cannot be satisfied in a single system prompt.
The same principle applies to claude code agents used for software development. A single Claude Code agent with read access to your codebase and the right tools will handle the vast majority of coding tasks. Reaching for a multi-agent architecture because a task feels complex usually produces complexity without proportional capability gain.
Common Failure Modes in Multi-Agent Architecture
The failure modes in production multi agent systems cluster around three root causes. Identifying them early prevents the most expensive debugging sessions.
Choosing the Right Architecture for Your Workflow
The right agentic ai architecture for your workflow is the simplest one that handles the task reliably. Most workflows that appear to need multi-agent coordination need it because of one specific bottleneck - context size, parallelism, or role specialization. Identify the actual constraint before designing the system around it.
If your constraint is context size or throughput, subagents with parallel dispatch are the answer. If your constraint is iterative refinement or inter-agent dependency, an agent team with a defined coordination protocol is the answer. If your constraint is neither of those, a single agent with better tools is probably the answer.
The multi agent architecture decision is not about task complexity - it is about coordination requirements. A complex task that can be fully decomposed into independent units before execution is still a subagent task. A simple task that requires two agents to converge on an answer requires a team structure regardless of how simple each individual step looks.
Building Multi-Agent Systems at RoboticForce
At RoboticForce, our team designs and builds production multi agent systems for clients across SaaS, financial services, and enterprise. Sugar, our open-source autonomous task queue, is built entirely on the orchestrator-worker pattern using the Claude Agent SDK - an orchestrating agent breaks incoming development tasks into units of work, dispatches them to worker agents with isolated contexts, and synthesizes results into a coherent output.
The pattern works because we spent significant time on the parts that matter most: precise task specification for each subagent, structured output validation at every boundary, and checkpointing that makes the system resumable from any failure point. The ai agent orchestration layer is not the interesting part. The work is in the task decomposition logic and the verification layer that keeps cascading errors from compounding downstream.
If your team is designing a multi-agent system and struggling with the architectural tradeoffs - which tasks belong to subagents versus a team, how to structure the coordination layer, how to keep token costs from compounding - that is exactly the kind of engagement we take on. The architecture decisions made in the first two weeks of a multi-agent project shape everything that follows. Getting them right before you build is considerably cheaper than redesigning after you have.