What are multi-agent systems?
You'll be able to explain how several AI agents split work, pass messages, and combine results, and when that design beats a single agent.
In plain English
A multi-agent system uses two or more AI agents that work on one goal. Each agent has its own role, instructions, and tools. They pass messages or results to each other until the task is done. Think of a small team. One agent plans the work, another writes code, and a third checks the output. Each one stays focused on its part.
Why it matters
A single agent with a long prompt and many tools can get confused. It mixes roles, loses track of context, and picks the wrong tool. Splitting the job into narrower agents often gives more reliable results. The cost is real, though. Each agent call uses tokens, adds latency, and can fail. Founders should treat a multi-agent design as an engineering choice that needs a reason, not a default.
How it works
Most multi-agent designs use one of a few shapes. In a pipeline, agent A finishes and hands its output to agent B, which hands to agent C. This is simple and easy to debug.
In an orchestrator pattern, one agent acts as a manager. It decides which specialist agent to call, sends each one a focused task, and collects the results. The specialists usually do not talk to each other directly.
In a peer or debate pattern, agents review each other's work. One drafts, another critiques, and the draft is revised. This can raise quality on tasks where a second look helps, such as code review or writing that must follow a rule.
Every agent in these designs still runs an agent loop of its own. The system adds coordination on top: who starts, what gets passed, and when the whole run stops. That coordination code is where most of the hard work lives.
A concrete example
A minimal orchestrator. A planner picks a specialist, the specialist runs, and the result goes back. The model calls are stubbed so the shape is clear.
def call_model(system, user):
# Replace with your provider's chat call.
raise NotImplementedError
SPECIALISTS = {
"research": "You find facts. Reply with short bullet points.",
"write": "You write clear prose from the notes you receive.",
}
def run(task, max_steps=5):
notes = ""
for _ in range(max_steps):
plan = call_model(
"Reply with one word: research, write, or done.",
f"Task: {task}\nNotes so far: {notes}"
).strip()
if plan == "done":
break
if plan not in SPECIALISTS:
break
result = call_model(SPECIALISTS[plan], f"Task: {task}\nNotes: {notes}")
notes += f"\n[{plan}] {result}"
return notesA short sketch to show the idea. Check the official docs of the tool you use.
What goes wrong
- Adding agents before proving one agent fails Start with one agent and a clear eval. Add a second agent only when you can show a specific failure it fixes.
- No stop condition Set a maximum number of steps and a budget for tokens and time. Agents that talk to each other can loop without end.
- Passing everything between agents Send each agent only the context it needs. Long shared histories raise cost and make agents drift from their roles.
- Unclear ownership of the final answer Name one agent or code path that produces the output the user sees. Otherwise conflicting results go out unchecked.
Going deeper
Learn how to write evals that score the whole system, not just one agent. Then study tool calling and structured output, since agents pass data to each other through them.
FAQ
Is a multi-agent system always better?
No. It adds cost, latency, and failure points. Use it when separate roles or separate tools clearly improve results on your evals.
Do the agents need different models?
Not necessarily. Different roles often work with the same model and different system prompts. A different model can help when one role needs a different strength, such as speed or cost.
How do agents share memory?
Usually through explicit messages or a shared store that your code controls. Agents do not share memory on their own.
How do I debug a multi-agent run?
Log every message, tool call, and handoff with a run ID. Replay the log to find which agent made the first bad decision.
Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.