Beyond the Single Agent
A single AI agent is powerful but limited: context windows run out, specialised expertise is hard to pack into one system, and parallelism is impossible. Multi-agent systems (MAS) distribute work across a team of specialised agents that communicate, delegate, and check each other's work.
The pattern mirrors a company: a CEO agent delegates to a research agent, a coding agent, and a QA agent. Each does what it does best; together they accomplish what none could alone.
Architecture Patterns
Supervisor / Worker
One orchestrator agent decomposes the task and assigns subtasks to workers. Workers report back; the supervisor synthesises. This is the most common pattern and maps naturally to LangGraph's StateGraph.
Peer-to-Peer
Agents communicate directly with no central authority. Each agent can call any other. Good for loosely-coupled tasks but harder to debug.
Pipeline
Output of agent A becomes input to agent B. Sequential, predictable, easy to test — but not parallelisable.
Building with LangGraph
from langgraph.graph import StateGraph, END
from typing import TypedDict
class State(TypedDict):
task: str; research: str; code: str; review: str
graph = StateGraph(State)
graph.add_node("researcher", research_agent)
graph.add_node("coder", coding_agent)
graph.add_node("reviewer", review_agent)
graph.set_entry_point("researcher")
graph.add_edge("researcher", "coder")
graph.add_edge("coder", "reviewer")
graph.add_conditional_edges("reviewer", route_after_review)
app = graph.compile()
The secret to reliable multi-agent systems is narrow, well-defined interfaces. The less an agent needs to know about its neighbours, the more robust the overall system.
Communication Protocols
- Structured JSON messages — easy to parse and validate with Pydantic.
- Natural language handoffs — flexible but harder to validate automatically.
- Shared state object — LangGraph's approach: all agents read/write one typed state dict.