AI agents › Agent basics
What is a multi-agent system? How AI agents split the work
A multi-agent system splits one job across several AI agents, each with its own context and tools. How it works, what it costs, and when one agent does better.
If you follow AI tools, you’ve probably noticed the word multi-agent showing up more often. Claude Code lets you define sub-agents of your own, and Anthropic describes Claude’s Research feature as several agents searching at the same time. Still, it may not be obvious what makes a system multi-agent, or why several agents should do better than one capable agent.
A multi-agent system is a setup in which several AI agents, each with its own role, context, and tools, work together on one job. In today’s LLM agents it usually means an orchestrator that splits up the work and sub-agents that each do their share in a context of their own and hand back only a summary. An agent here is an LLM that uses tools in a loop until a task is done, and its context is everything the model sees at once. Two posts from June 2025 probably have a lot to do with why you hear the term so often now. Anthropic reported that a team of agents beat a single agent by a wide margin, and in the same week Cognition, the company behind the coding agent Devin, published a post telling builders not to build multi-agent systems.
An old term in a new form
In AI research, multi-agent systems are older than language models. In a 2000 survey, Peter Stone and Manuela Veloso described them as a branch of distributed AI that deals with the behavior of several independent entities, or agents.
The new form runs on LLMs. In How we built our multi-agent research system, published June 13, 2025, Anthropic defines a multi-agent system as several LLMs autonomously using tools in a loop and working together. On Anthropic’s internal research eval, a system with Claude Opus 4 leading Claude Sonnet 4 subagents outperformed a single Claude Opus 4 agent by 90.2%. The reason the post gives is plain: splitting the work lets a system spend enough tokens on the problem, and on BrowseComp, a test for browsing agents, token usage by itself explained 80% of the variance in performance. That has a price, of course. Agents typically used about 4 times as many tokens as chat, and multi-agent systems about 15 times as many.
Handing three files to sub-agents
To see the shape for myself, I built a very small version in Claude Code. There, a sub-agent runs in its own context window with its own system prompt, tools, and permissions, and the main conversation hands it work through the Agent tool. My folder held three short notes about cafes, such as notes/moss.txt.
Moss & Mill, a small cafe above a bookshop.
Very quiet, with soft music and a no-phone-calls rule.
Only two power outlets, both by the door.
Open 8 am to 2 pm on weekdays.
The sub-agent is defined in agents.json. The key is its name, description says when to use it, and prompt sets its system prompt. tools and model limit it to Read and Haiku.
{
"summarizer": {
"description": "Reads one text file and returns a one-line summary of it.",
"prompt": "Read only the file you are given. Reply with one sentence of 20 words or fewer that summarizes it, and nothing else.",
"tools": ["Read"],
"model": "haiku"
}
}
Then I asked the main agent to give each file to the summarizer and decide from the summaries alone.
claude -p "Use the summarizer agent once for each of notes/harbor.txt, notes/moss.txt and notes/kiln.txt, all at the same time. Don't read the files yourself. From the three summaries alone, tell me which cafe suits a quiet afternoon of laptop work." \
--agents agents.json --tools "Agent,Read" --model haiku \
--output-format stream-json --verbose < /dev/null > run.jsonl
claude -p is a headless run that runs once and exits, and in this mode --agents can take a JSON file path. --tools limits the tools to Agent and Read, and --output-format stream-json --verbose writes every step as one JSON object per line. A sub-agent’s messages carry the ID of the Agent call that started it in parent_tool_use_id, so the script below can print who handed what to whom.
import json, sys
# Replay a stream-json log: who handed what to whom, and what came back.
subs = {}
for line in open(sys.argv[1]):
event = json.loads(line)
if event["type"] == "result":
print(f"cost: ${event['total_cost_usd']:.4f}")
if event["type"] not in ("assistant", "user"):
continue
who = subs.get(event["parent_tool_use_id"], "main")
for block in event["message"]["content"]:
if block["type"] == "tool_use" and block["name"] == "Agent":
subs[block["id"]] = f"sub{len(subs) + 1}"
print(f"main -> {subs[block['id']]} ({block['input']['subagent_type']}): {block['input']['description']}")
elif block["type"] == "tool_use":
print(f"{who} -> {block['name']}: {block['input']['file_path'].split('/')[-1]}")
elif block["type"] == "tool_result" and block["tool_use_id"] in subs:
report = block["content"][0]["text"].split("The report follows:")[-1].split("agentId:")[0]
print(f"main <- {subs[block['tool_use_id']]}: {report.strip()}")
elif block["type"] == "text" and who == "main" and event["type"] == "assistant":
print("answer:", block["text"].splitlines()[0])
Running python3 replay.py run.jsonl printed this.
main -> sub1 (summarizer): Summarize harbor.txt
main -> sub2 (summarizer): Summarize moss.txt
sub1 -> Read: harbor.txt
main -> sub3 (summarizer): Summarize kiln.txt
sub3 -> Read: kiln.txt
main <- sub1: Harbor Beans is a waterfront cafe with good wifi, plenty of outlets, and big windows, but it gets loud after noon.
sub2 -> Read: moss.txt
main <- sub3: Corner Kiln is a calm pottery studio and coffee spot with long tables, an outlet at every seat, and adequate wifi, so it suits laptop work.
main <- sub2: Moss & Mill is a quiet cafe above a bookshop with soft music and no phone calls, but only two outlets make it limited for laptops.
answer: **Corner Kiln** is the best pick for a quiet afternoon of laptop work.
cost: $0.0042
The three Agent calls left in one message and ran at the same time, and each sub-agent read only its own file. The main agent got three lines instead of the notes, and something fell out on the way. The summaries don’t mention that Moss & Mill closes at 2 pm, the fact that matters most for an afternoon. The task message the main agent wrote, kept in the log, asked the summarizer to focus on “the cafe’s atmosphere, noise level, seating, and whether it suits laptop work,” and said nothing about hours. So the answer was right, but Moss & Mill was ruled out only for its outlets. When I ran the same command again later, the hours did make it into that summary, so what falls out changes from run to run.
Next I added “including any opening hours” to the summarizer’s prompt and ran it again. This time the main agent’s task message listed nothing to focus on. The hours survived, but within the 20-word limit the words “calm in the afternoon” and “an outlet at every seat” fell out of Corner Kiln’s summary. The main agent then switched to Moss & Mill, as long as the afternoon ends by 2 pm. Either way, it could weigh only what the summaries carried.
Last, I gave a single agent the same question and only the Read tool. It read the files itself, picked Corner Kiln, and noted that Moss & Mill closes at 2 pm. It used 11,610 tokens, counting cached input, and $0.0012, so the first run’s 38,162 tokens and $0.0042 came to about three times as much. The first run also took 13 seconds instead of 4. These are single runs, so the numbers will move, but the direction matches what Anthropic reported.
Orchestrators, pipelines, and reviewers
My example used the most common structure, but there are others. Of the patterns Anthropic described in Building effective agents in December 2024, these three come closest to what people mean by multi-agent.
| Structure | How the work moves | Fits when |
|---|---|---|
| Orchestrator and workers | A central LLM splits the task, hands out the pieces, and combines the results | You can’t predict the subtasks in advance |
| Pipeline (prompt chaining) | Each step works on the output of the step before | The task splits cleanly into fixed steps |
| Reviewing each other (evaluator-optimizer) | One LLM writes, another evaluates and gives feedback, in a loop | There are clear criteria for a good result |
Real systems often mix them, and Research adds a pipeline step to its orchestrator-worker design, where a CitationAgent attaches citations.
How it differs from one agent, and where A2A fits
Compared with a single agent, the difference lies in context. A single agent keeps everything in one conversation and can draw on earlier decisions at any step, while a sub-agent starts fresh with only its task message. According to Claude Code’s docs, it doesn’t see the conversation history or the files the main agent has read. That’s why long search results stay out of the main context, and also why the sub-agent never learns what the task message leaves out.
Agents from different companies and frameworks need a shared protocol to work together. Google announced A2A (Agent2Agent) as such a protocol on April 9, 2025, and described it as a complement to MCP. MCP gives an agent tools and context, while A2A lets agents communicate with each other. On June 23, 2025, Google handed the specification and SDKs to the Linux Foundation, which launched the Agent2Agent project, and version 1.0.0 appeared in its GitHub releases on March 12, 2026.
Where multi-agent systems go wrong
The case against starts from the same weakness. In Don’t Build Multi-Agents, published June 12, 2025, Walden Yan of Cognition imagines splitting a Flappy Bird clone between two sub-agents, one for the background and one for the bird. One builds a background that looks like Super Mario Bros and the other a bird that’s nothing like Flappy Bird’s, and even with the original task shared, neither can see the other’s work, so the styles can clash. That’s why he asks builders to share context, meaning full agent traces and not just individual messages. He adds that actions carry implicit decisions, and conflicting decisions carry bad results, and suggests starting from a single-threaded agent.
Research has started to measure the same trouble. In Why Do Multi-Agent LLM Systems Fail?, first posted to arXiv in March 2025, Mert Cemri and colleagues at UC Berkeley report failure rates of 41% to 86.7% for 7 open-source multi-agent systems. They sort failures into 14 modes in three groups, namely system design, misalignment between agents, and verification of the result, and label 1,642 execution traces with them. The most common were repeating steps already done (15.7%), acting against one’s own reasoning (13.2%), and not noticing that the task was finished (12.4%).
Where it fits and where it doesn’t
Anthropic says multi-agent systems are strongest on breadth-first questions that follow several independent directions at once, and on valuable tasks with heavy parallelization or more information than one context window holds. On the other hand, work where every agent needs the same context, or where agents depend on each other a lot, isn’t a good fit yet, and most coding tasks have fewer truly parallel parts than research. Claude Code’s docs likewise suggest the main conversation when phases share a lot of context, and sub-agents for separate work that only needs to return a summary. So a broad survey across many sources suits splitting well, while an edit across tightly linked files is perhaps better left to one agent. My cafe example, to be honest, didn’t need splitting at all.
If you’re trying it for the first time
If you have Claude Code, I’d suggest writing three short notes, running the command above, and reading the replay. Then change one thing about what the summarizer must keep, run it again, and compare the answers. The sub-agent docs are a good next read. I ran this example on October 28, 2026, on macOS with Claude Code 2.1.304. --model haiku and the summarizer’s haiku both resolved to claude-haiku-5-5, and the replay script ran on Python 3.13.12.
AI tools helped with the research for this post.