Skip to main content
In this tutorial, you’ll build a multi-agent system where specialized agents collaborate to solve complex tasks that require different expertise.

What you’ll build

A multi-agent system with:
  • Multiple specialized agents with different skills
  • A supervisor agent that coordinates work
  • State sharing between agents
  • Handoffs between agents

Use cases

Multi-agent systems excel at:
  • Complex workflows requiring different expertise
  • Parallel task execution
  • Specialized domain knowledge
  • Scalable agent architectures

Prerequisites

Install required packages:
Set your API key:

Tutorial

1

Define the multi-agent state

Create state that tracks work across multiple agents.
2

Create specialized agent tools

Define tools for each specialized agent.
3

Create specialized agent nodes

Build individual agents with different capabilities.
4

Create supervisor agent

Build a supervisor that routes work to specialized agents.
5

Build the multi-agent graph

Assemble the complete multi-agent system.
6

Run the multi-agent system

Execute complex tasks with agent coordination.
7

Complete example

Here’s a simplified complete example:

Expected output

Key concepts

  • Specialized Agents: Each agent has specific tools and expertise
  • Supervisor Pattern: Central coordinator routes work
  • State Sharing: All agents access shared state
  • Task Results: Track outputs from each agent
  • Agent Handoffs: Smooth transitions between agents

Architecture patterns

Next steps

Simple Agent

Review the basics of single agents

ReAct Pattern

Add reasoning to individual agents
Multi-agent systems enable complex workflows by combining specialized agents. Start simple and add complexity as needed.