Build note · Agentic AI

Agent Orchestration: A Complete Guide

How to coordinate multiple AI agents: the routing, manager, handoff and orchestrator-worker patterns, how agents share state, and when one agent beats five.

Hamza MalikPublished 8 August 20268 min read
An orchestrator fanning work out to specialist agents and collecting their results back

In brief

Agent orchestration is the coordination of multiple agents, tools and workflows toward one goal. It decides who works, on what, when, and how the results come back together.

Article contents (23 sections)
  1. 1. What agent orchestration is
  2. 2. Why it becomes necessary
  3. 3. It does not always mean multiple agents
  4. 4. Code-based orchestration
  5. 5. LLM-based orchestration
  6. 6. Hybrid orchestration
  7. 7. Sequential orchestration
  8. 8. Parallel orchestration
  9. 9. The router pattern
  10. 10. The manager pattern
  11. 11. The handoff pattern
  12. 12. Hierarchical orchestration
  13. 13. Orchestrator and workers
  14. 14. A worked example
  15. 15. How agents talk to each other
  16. 16. Shared memory, and its limit
  17. 17. Isolation matters just as much
  18. 18. Specialisation, and model choice
  19. 19. More agents is not automatically better
  20. 20. Common failures
  21. 21. How this relates to harnesses and loops
  22. 22. When to reach for it
  23. 23. The short definition

1. What agent orchestration is

Agent orchestration is the coordination of multiple AI agents, tools, and workflows so they can work together toward a larger goal.

If a single agent is like one employee, orchestration is the system that determines:

  • Which agent should work
  • What task it receives
  • When it should run
  • Which other agents it can delegate to
  • How agents exchange information
  • How their results are combined
  • What happens when one agent fails
  • When the overall task is complete

OpenAI defines orchestration as the flow of agents in your app: which agents run, in what order, and how they decide what happens next. (OpenAI)

2. Why it becomes necessary

Imagine building a system that produces a detailed market research report. One general-purpose agent could try to do everything:

Research
→ Analyze data
→ Check sources
→ Write report
→ Review report

As the task grows, specialists start to make more sense:

Research Agent
Data Analysis Agent
Fact-Checking Agent
Writing Agent
Review Agent

Which creates a new problem. Who coordinates all of them?

That coordination layer is agent orchestration. A typical system looks like this:

                    User Request
                         ↓
                   Orchestrator
                  /      |      \
                 ↓       ↓       ↓
          Research    Data     Competitor
           Agent     Agent       Agent
                 \      |      /
                  \     |     /
                       ↓
                 Writing Agent
                       ↓
                  Review Agent
                       ↓
                   Final Output

The orchestrator does not necessarily do the specialist work itself. It manages who does what, and when.

3. It does not always mean multiple agents

This distinction matters. Orchestration can involve one agent and many tools, several agents and tools, or agents mixed with ordinary deterministic software.

User request
     ↓
Agent
     ↓
Web search
     ↓
Python analysis
     ↓
Database query
     ↓
Final answer

There is orchestration here because something decides the sequence of actions. The term simply becomes more important once multiple agents are involved.

4. Code-based orchestration

The application controls the workflow.

research = await research_agent.run(topic)

analysis = await analysis_agent.run(research)

article = await writer_agent.run(
    research=research,
    analysis=analysis,
)

review = await reviewer_agent.run(article)

The sequence is explicit:

Research
   ↓
Analysis
   ↓
Writing
   ↓
Review

This is deterministic orchestration. It is predictable, easy to debug and test, and easy to cost. The weakness is that it cannot adapt when the required steps are not knowable in advance.

5. LLM-based orchestration

Instead of hardcoding the workflow, an agent decides which specialist should run.

User Goal
    ↓
Orchestrator Agent
    ↓
"What do I need?"
    ↓
Choose agents dynamically

For example:

User:
"Analyze whether electric aircraft could become commercially viable."

Orchestrator plans:

1. Aviation market research.
2. Battery technology research.
3. Regulatory research.
4. Financial analysis.

It then launches an agent per strand and combines the findings. OpenAI’s Agents SDK supports both approaches, letting an LLM plan and delegate dynamically or letting application code drive the flow, and the two can be mixed. (OpenAI)

6. Hybrid orchestration

Most serious systems end up combining the two.

                 Application Code
                       ↓
               Research Orchestrator
                /       |       \
               ↓        ↓        ↓
          Market     Technical   Legal
           Agent       Agent     Agent
                \       |       /
                 ↓      ↓      ↓
                  Aggregation
                       ↓
               Deterministic Checks
                       ↓
                  Writer Agent
                       ↓
                  Human Review

Some decisions belong to software, others to the model. That split is usually the better balance of flexibility, reliability, cost and safety.

7. Sequential orchestration

Agents work one after another, each receiving the last one’s result.

Researcher
   ↓
Writer
   ↓
Editor

Best for work where later stages depend heavily on earlier ones.

8. Parallel orchestration

Independent agents run at the same time.

              Orchestrator
             /     |      \
            ↓      ↓       ↓
        Agent A  Agent B  Agent C
             \     |      /
                  ↓
              Aggregator

For example:

Question:
"Compare AWS, Azure, and Google Cloud."

AWS Agent   ────────┐
Azure Agent ────────┼→ Comparison Agent
GCP Agent   ────────┘

Parallelism cuts latency when the subtasks genuinely do not depend on each other. Anthropic uses this in its multi-agent research system, where a lead agent spawns specialised subagents that explore different directions simultaneously. They report that adding parallelism, a lead agent spinning up 3 to 5 subagents at once and each subagent calling 3 or more tools at once, cut research time by up to 90% on complex queries, measured against their own earlier sequential-search agents. (Anthropic)

9. The router pattern

A router decides which specialist receives the request.

                 User
                   ↓
                 Router
             /      |       \
            ↓       ↓        ↓
        Billing   Tech     Sales
         Agent    Agent    Agent
"I was charged twice."   →  Billing Agent
"My API returns 500."    →  Technical Agent

This is the simplest useful form of multi-agent orchestration.

10. The manager pattern

A central agent stays responsible for the whole task. The specialists never speak to the user; they return information to the manager.

                 Manager Agent
                /      |      \
               ↓       ↓       ↓
            Agent A  Agent B  Agent C
                \      |      /
                     ↓
                 Manager
                     ↓
                Final answer

OpenAI’s Agents SDK calls this the manager pattern, or agents as tools: a central manager invokes specialised sub-agents as tools and retains control of the conversation, exposing each one through .as_tool(). (OpenAI)

Manager:
"I need revenue analysis."

        ↓ calls

Financial Agent

        ↓ returns

"Revenue increased 18%, primarily from enterprise."

        ↓

Manager folds the finding into the final response.

11. The handoff pattern

A handoff works differently. Rather than asking another agent for help, the current agent transfers control.

General Agent
      ↓
"This is a refund request."
      ↓
HANDOFF
      ↓
Refund Agent
      ↓
Continues the conversation with the user

OpenAI’s handoffs guide puts it this way: when a handoff occurs, it is as though the new agent takes over the conversation, and gets to see the entire previous conversation history. (OpenAI)

Manager pattern:  Manager → Specialist → Manager → User
Handoff pattern:  Router  → Specialist → User

12. Hierarchical orchestration

Large systems grow management levels.

                     Lead Agent
                    /          \
                   ↓            ↓
           Research Manager   Build Manager
             /      \          /       \
            ↓        ↓        ↓         ↓
        Web Agent  Data    Backend    Frontend
                  Agent     Agent      Agent

It starts to resemble an organisation. Higher-level agents handle objectives, decomposition and priorities. Lower-level agents execute.

13. Orchestrator and workers

Orchestrator
      ↓
Break task into subtasks
      ↓
Create workers
   /    |    \
  ↓     ↓     ↓
 W1     W2    W3
  \     |     /
      Results
        ↓
Orchestrator
        ↓
Synthesize

Unlike a fixed parallel pipeline, the orchestrator decides how many workers are needed. Anthropic uses this architecture for its Research system: a lead agent develops a strategy, creates specialised subagents, receives their findings, and decides whether more research is needed. (Anthropic)

14. A worked example

Suppose the question is: what technologies could replace lithium-ion batteries in grid-scale energy storage?

                       Research Orchestrator
                              ↓
        ┌─────────────────────┼─────────────────────┐
        ↓                     ↓                     ↓
  Sodium-ion Agent      Flow Battery Agent     Hydrogen Agent
        ↓                     ↓                     ↓
   Findings                Findings              Findings
        └─────────────────────┼─────────────────────┘
                              ↓
                       Comparison Agent
                              ↓
                       Citation Checker
                              ↓
                          Final Report

Partway through, the orchestrator might notice regulation was never covered and launch a policy agent. That is the real difference between an ordinary workflow and orchestration: the decomposition can change while the work is running.

15. How agents talk to each other

Agent communication is harder than it looks. One option is passing the whole conversation along, which gets expensive and noisy fast. Structured messages usually work better:

{
  "task": "Analyze sodium-ion battery economics",
  "findings": [
    "...",
    "..."
  ],
  "confidence": 0.84,
  "sources": ["source1", "source2"],
  "open_questions": [
    "Long-term cycle cost remains uncertain"
  ]
}

Structured output is easier to validate, store, debug, route and combine.

16. Shared memory, and its limit

Agents often need shared state. If a research agent discovers that Company X acquired Company Y, no other agent should have to rediscover it. A shared workspace might hold task state, findings, sources, decisions, artifacts, completed subtasks and open questions.

There is a trade-off. If every agent receives everything, context becomes enormous and expensive.

Shared memory is not the same as sharing everything

Good orchestration gives each agent only what its role requires.

17. Isolation matters just as much

Sometimes agents should not share context at all. Imagine three agents independently evaluating a business idea. If the second one sees the first one conclude “this will probably succeed”, it is no longer an independent opinion.

Agent A → independent analysis
Agent B → independent analysis
Agent C → independent analysis
             ↓
        Judge Agent
             ↓
      Compares all three

Separate context buys diversity of reasoning, which is the entire point of asking three times.

18. Specialisation, and model choice

The main reason to use multiple agents is specialisation. Instead of one enormous prompt claiming expertise in finance, law, code, security, writing, research and marketing, you build agents that each get narrow instructions, relevant context, relevant tools, appropriate permissions, and possibly a different model.

Simple classification  → small fast model
Complex reasoning      → strong reasoning model
Large research         → research agents
Code review            → coding model

Agent orchestration therefore becomes model orchestration too.

19. More agents is not automatically better

A common mistake:

1 agent good
10 agents better
100 agents amazing

That is false. Multi-agent systems bring real overhead: more tokens, higher cost, more latency, coordination problems, duplicated work, conflicting conclusions, and more places to fail.

Anthropic found multi-agent systems suited broad research tasks that parallelise well, and put a number on the cost: in their data, agents typically use about 4 times more tokens than chat interactions, and multi-agent systems about 15 times more than chats. Work with tightly coupled dependencies or heavy shared context is a poorer candidate. (Anthropic)

Use multiple agents when the decomposition earns its keep.

20. Common failures

Duplicate work. Three agents research the same competitors. Fix it with explicit task boundaries.

Missing work. Everything is researched except regulation. Fix it by having the orchestrator check coverage before synthesis.

Agent explosion. An agent creates five agents, each of which creates five more.

1 → 5 → 25 → 125

Fix it with a maximum subagent count, a maximum depth, a token budget and a runtime budget.

Conflicting outputs. Agent A says the market is $8B, Agent B says $14B. The orchestrator has to resolve that rather than picking one arbitrarily.

Context loss. Agent A finds something important and Agent B never sees it. Fix it with shared state, structured outputs and persistent artifacts.

Weak delegation. This is the one people underestimate.

Bad:
Research batteries.

Better:
Analyze sodium-ion batteries specifically for grid-scale storage.

Cover:
- current commercial deployments
- cost per kWh
- cycle life
- supply chain advantages
- major technical limitations

Return sources and unresolved uncertainties.

Anthropic found that vague delegation produced overlapping research and gaps in coverage, which makes delegation quality a real part of orchestrator design. (Anthropic)

21. How this relates to harnesses and loops

These three ideas stack.

Harness engineering builds the environment around one agent: tools, context, memory, sandbox, permissions, guardrails.

Agent orchestration coordinates several agents and workflows.

Loop engineering decides how the system repeatedly progresses toward a goal: assign, execute, evaluate, feed back, then retry, continue or stop.

They coexist:

                    LOOP
                     ↓
               ORCHESTRATOR
              /      |      \
             ↓       ↓       ↓
        Harness A Harness B Harness C
             ↓       ↓       ↓
          Agent A  Agent B  Agent C

Harness engineering makes individual agents dependable. Orchestration makes several of them cooperate. Loop engineering makes the whole system keep moving toward a verified goal.

22. When to reach for it

Orchestration makes sense when a task divides into meaningful subtasks, benefits from specialists, contains independent work that can run in parallel, needs different tools or permissions, exceeds one agent’s practical context, benefits from independent review, or has to route across domains.

Good candidates: deep research, customer-support platforms, complex software projects, security investigations, financial analysis, enterprise workflow automation, large document analysis.

For simple work, this:

Question → Agent → Answer

usually beats this:

Router → Planner → Researcher → Critic → Judge → Writer

Complexity should be earned.

23. The short definition

Agent orchestration is the engineering discipline of coordinating agents, tools, models, state and workflows so specialised AI components can complete a larger task together.

It answers four questions:

WHO should work?
ON WHAT should they work?
WHEN should they work?
HOW should their results come together?

Once those questions start to matter, you are no longer building an agent. You are designing a system made of agents.

Hamza Malik

I am building TryDeputize while studying practical AI systems, and these notes are where I turn what I learn into clear, usable explanations.

More build notes