Multi-Agent

Build agent teams by composing graphs. Each agent is a graph. The orchestrator is a graph of agents.

The Pattern

# Each agent is its own graph
researcher = Graph([search, analyze, summarize], name="researcher")
writer = Graph([draft, refine, format], name="writer")
reviewer = Graph([check_facts, check_style, score], name="reviewer")

# Compose into a team
team = Graph([
    researcher.as_node(),
    writer.as_node(),
    reviewer.as_node(),
    review_gate,  # Decides if done or needs revision
])

Why Graphs as Agents?

Each agent encapsulates:

  • Internal workflow — The agent's reasoning process

  • Clear interface — Defined inputs and outputs

  • Testability — Test agents in isolation

  • Reusability — Same agent in different teams

Research Team Example

A team that researches a topic and produces a report:

Agent Handoff Pattern

Sequential agents where one's output becomes another's input:

Specialist Selection

Route to different specialists based on the task:

Parallel Agent Execution

Independent agents can run concurrently:

Testing Agents Independently

Each agent is testable in isolation:

What's Next?

Last updated