Automation8 min read

Multi-Agent Systems for Complex Tasks: A Practical Guide

When several AI agents beat one, the main orchestration patterns (orchestrator-workers, handoffs, group chat, graphs), token costs and how to evaluate them.

By AI Agents DirectoryLast checked
A man and a woman working together at a desk in a modern office

A multi-agent system splits one job across several language-model agents, each running its own tool-using loop, with some way to pass work and results between them. It can make an agent noticeably better at broad, open-ended tasks, and it can also multiply your bill and your debugging time. This guide covers when the extra agents earn their keep, the coordination patterns the main frameworks document, how state moves between agents, the usual failure modes, and how to evaluate the result. Facts come from Anthropic, OpenAI, Microsoft, LangChain, CrewAI and the A2A project’s own docs.

If you need the single-agent basics first (the agent loop, and how agents differ from fixed workflows), start with how autonomous AI agents work. For a framework-by-framework comparison, see AI agent frameworks compared. This post assumes both.

When more agents help, and when they hurt

The best public account of a production system is Anthropic’s write-up of the multi-agent research system behind Claude’s Research feature. A lead agent plans, starts subagents that search in parallel, and merges what they bring back. Anthropic’s explanation for why it works is blunt: the setup mainly helps because it lets the system spend more tokens on a problem. Each subagent has a separate context window, so the system as a whole can read and reason over far more material than one context could hold.

The same post is just as clear about the costs:

  • Tokens. By Anthropic’s measurements, single agents consume roughly four times the tokens of a chat interaction and its multi-agent setup roughly fifteen times. The task needs to be worth that.
  • Tightly coupled work. Tasks where every agent needs the same context, or where agents depend heavily on each other, are a poor fit. Anthropic names most coding as an example: it has less truly parallel work than research, and agents are not yet good at delegating to each other in real time.
  • Good fits are high-value tasks that parallelise well, need more information than one context window holds, or involve many complex tools.

Anthropic’s earlier guide, Building effective agents, sets the baseline: find the simplest solution and add complexity only when it clearly improves results. For many applications a single well-prompted LLM call with retrieval is enough. LangChain’s multi-agent documentation makes the same point, saying one agent with the right tools and prompt can often match a multi-agent design. It lists three reasons teams actually reach for several agents: keeping each context window focused, letting separate teams own separate pieces, and running subtasks in parallel.

The main orchestration patterns

Different vendors use different names for overlapping ideas. This table maps them.

PatternHow control movesWhere it is documented
Orchestrator-workers / managerA central agent breaks the task down, calls workers, and writes the final answerAnthropic (orchestrator-workers), OpenAI Agents SDK (agents as tools), CrewAI (hierarchical process), Microsoft Agent Framework (Magentic), LangChain (subagents)
HandoffThe active agent transfers the conversation to a specialist, which then owns itOpenAI Agents SDK, Microsoft Agent Framework, LangChain
Sequential / chainAgents run in a fixed order, each using the previous outputCrewAI (sequential process), Microsoft Agent Framework, Anthropic (prompt chaining)
Concurrent / parallelSeveral agents run at once and their outputs are combinedMicrosoft Agent Framework, Anthropic (parallelization), OpenAI Agents SDK via asyncio.gather
RouterOne classification step sends the input to the right specialistAnthropic, LangChain
Group chatAgents work in one shared conversationMicrosoft Agent Framework
Graph / custom workflowYou define nodes and edges in code, mixing deterministic steps with agentsLangGraph, via LangChain’s custom workflow pattern

Orchestrator-workers. Anthropic describes this as a central model that decides the subtasks at run time, rather than following a fixed split, and then synthesises the workers’ output. That run-time decision is what separates it from plain parallelisation. CrewAI’s hierarchical process is the same idea: you supply a manager model (manager_llm) or a custom manager_agent, and the manager assigns tasks, reviews outputs and judges whether they are done. Microsoft’s Agent Framework orchestrations call their dynamic-manager version Magentic.

Handoffs. In the OpenAI Agents SDK, a handoff appears to the model as a tool, so a handoff to a “Refund agent” shows up as a tool called transfer_to_refund_agent. The orchestration guide frames the choice this way: if a specialist only needs to contribute a contained piece of work and should stay out of the user conversation, call it as a tool; if picking the specialist is itself part of the flow, hand off. The two can be combined.

Model-driven or code-driven. OpenAI’s guide also separates letting the LLM decide the next step from deciding it in your own code. Code-driven flows (structured-output classification, chaining, an evaluator loop, parallel runs) are more predictable in speed, cost and quality. Model-driven flows suit open-ended tasks.

A compact handoff example

This is the basic handoff from the OpenAI Agents SDK docs. A triage agent can pass the conversation to a billing or refund specialist:

from agents import Agent, handoff

billing_agent = Agent(name="Billing agent")
refund_agent = Agent(name="Refund agent")

triage_agent = Agent(name="Triage agent", handoffs=[billing_agent, handoff(refund_agent)])

Passing an Agent directly uses defaults; wrapping it in handoff() lets you set a callback that fires when the handoff happens, an input_type schema for small metadata such as a reason or priority, and an input_filter that controls what history the receiving agent sees. The docs also supply a recommended prompt prefix that explains handoffs to the model.

Communication and shared state

What each agent can see is the core design decision. LangChain calls it context engineering and treats it as the main factor in system quality.

  • Full history by default. In the OpenAI SDK, the receiving agent sees the whole earlier conversation unless you add an input filter. The docs warn that the nested-history option compresses the transcript but does not redact it, so tool arguments and outputs can still reach the next agent and its model provider. Filter explicitly if that matters.
  • Guardrails don’t follow the handoff. The SDK applies input guardrails only to the first agent and output guardrails only to the agent that writes the final answer. Checks you need along the way have to be tool guardrails.
  • Stateless versus stateful. LangChain’s docs note that subagents start fresh on every call, which isolates context but repeats work, while handoffs keep the active agent between turns and so save model calls on follow-ups. For a question spanning several domains, though, handoffs run one after another and cannot fan out in parallel.
  • Write results outside the conversation. Anthropic has subagents save larger outputs to external storage and pass a short reference back to the lead. That avoids losing detail as results get relayed from agent to agent, and avoids copying big outputs through every context.

Between separately built systems, the Agent2Agent (A2A) protocol is an open standard, now under the Linux Foundation, for agents to discover each other, delegate tasks and return results without exposing their internal memory or tools. Its documentation is explicit that A2A is not for an agent talking to its own subagents. Inside one application, use your framework’s own mechanisms. A2A complements MCP, which connects an agent to tools.

Failure modes to plan for

Anthropic’s post lists several problems from building and running its system:

  • Over-spawning and vague delegation. Early versions started dozens of subagents for simple questions, and short instructions led subagents to repeat each other’s searches. The fix was to give every subagent an objective, an output format, tool guidance and clear boundaries, and to put effort-scaling rules in the lead agent’s prompt.
  • Compounding errors. Agents keep state across long runs, so a small failure can push the whole run in a different direction. Restarting from scratch is costly, so Anthropic resumes from the point of failure and pairs the model’s own recovery with retries and checkpoints.
  • Hard-to-reproduce bugs. Runs are non-deterministic, and Anthropic says full production tracing was what made failures diagnosable.
  • Deploys mid-run. Long-running agents can be anywhere in their process when you ship new code. Anthropic uses rainbow deployments, keeping the old and new versions running while traffic moves across.
  • Synchronous bottlenecks. The lead agent waits for each batch of subagents, so one slow subagent stalls the rest. Going asynchronous adds parallelism but makes state and error handling harder.

Evaluating a multi-agent system

Because agents can reach a correct answer by different routes, Anthropic judges outcomes and the reasonableness of the process rather than checking a fixed sequence of steps. In practice:

  1. Start small. Anthropic began with about 20 queries drawn from real usage. Early changes tend to have large effects, so a small set is enough to see them.
  2. Use an LLM judge with a rubric. Its judge scored factual accuracy, citation accuracy, completeness, source quality and tool efficiency. One call returning scores and a pass/fail grade agreed with human judgement better than several separate judges.
  3. Keep humans testing. People found what automated evals missed. One example: early agents preferred SEO content farms over more authoritative sources.
  4. Judge end state for agents that change things. When agents modify data over many turns, check the final state, or a few checkpoints, rather than every intermediate step.

Microsoft’s orchestrations also support human approval steps: a tool can be marked as needing approval, which pauses the workflow until a person reviews it. That is worth having for any agent that takes real actions.

The practical order: get one agent working and measured, find where it runs out of context or time, and only then split the work. Pick the simplest pattern that fixes that specific limit, and keep tracing and evals in place from the first version.

#AI agents#Multi-agent systems#Agent orchestration#Agent frameworks#Evaluation
AI

Written by AI Agents Directory

Editorial team

Facts in this guide are checked against official documentation and repositories, which are linked in the article.