Zenaique

Walk through the LangGraph supervisor pattern for multi-agent orchestration

Short answer·Hard·4.0 · 0·~3 min·Asked atAdaOpenAITata Digital
Attempt it

Describe the LangGraph supervisor pattern end to end: the graph topology, how routing decisions are made, how state flows between supervisor and workers, and why teams choose this pattern over AutoGen GroupChat or a CrewAI hierarchical crew.

Free · 2 AI evals / day
TL;DR

A supervisor LLM node routes to one of N worker nodes via a conditional edge based on its structured output; workers update shared state and return to the supervisor; the loop terminates when the supervisor outputs

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture a newsroom. The editor (supervisor) reads what is on the table and says 'researcher, dig into this' or 'writer, draft a paragraph' or 'critic, check the facts'. Each person does their bit, hands the work back to the editor, and the editor decides who is next. Eventually the editor says 'good, we publish'. The whole thing is happening on one shared whiteboard everyone can see, and somebody is taking photos of the whiteboard after each handoff so the work survives even if the building burns down. That photo log is the checkpointer.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

The supervisor pattern is LangGraph's canonical answer to multi-agent orchestration. It pins routing to a typed graph construct, separates the routing-decision LLM call from the worker LLM calls, and inherits LangGraph's surrounding machinery (checkpointer, reducers, human in the loop, time-travel) for free. The pattern has become the production default for agent systems that need to run unattended and survive process restarts.

This section walks the topology, the supervisor's structured-output discipline, the state and reducer story, the operational properties from the checkpointer, and the comparison with the obvious alternatives in the framework landscape.

Topology. A star, not a chain

Imagine a star graph. At the center sits the supervisor node. Around it sit N worker nodes. Researcher, writer, critic, executor, whatever the task demands. The edges are asymmetric: from the supervisor, a conditional edge dispatches to one worker per round; from each worker, an unconditional edge returns to the supervisor; a separate conditional case routes to END when the supervisor signals FINISH.

The entry point is the supervisor. The first round, the supervisor sees only the user's initial input in state and picks a starting worker. That worker runs, writes its output to state, returns to the supervisor. The supervisor now sees the original input plus the worker's output and picks the next worker (possibly the same one again, possibly a different one, possibly FINISH).

The topology matters because it is what makes the routing decision a separate, inspectable, replaceable concern. You can swap the supervisor's implementation (different LLM, different prompt, deterministic function) without touching the workers. You can add or remove workers without changing the supervisor's structure. Just update the routing schema. The shape of the graph is the shape of the system.

Supervisor. A router, not an agent
Workers and state. Reducers as the load-bearing detail
Persistence and operational properties
Comparison with AutoGen GroupChat and CrewAI Hierarchical
Production hygiene. Guardrails and instrumentation
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
python
from typing import Annotated, Literal
from typing_extensions import TypedDict
from langgraph.graph import StateGraph, END
from langgraph.graph.message import add_messages
from langgraph.checkpoint.postgres import PostgresSaver
from langchain_openai import ChatOpenAI
from pydantic import BaseModel

class State(TypedDict):
    messages: Annotated[list, add_messages]
    next: str

class Route(BaseModel):
    next: Literal['researcher', 'writer', 'critic', 'FINISH']

llm = ChatOpenAI(model='gpt-4o').with_structured_output(Route)

def supervisor(state: State) -> dict:
    decision = llm.invoke([
        {'role': 'system', 'content': 'Route to researcher, writer, critic, or FINISH.'},
        *state['messages'],
    ])
    return {'next': decision.next}

def researcher(state): ...   # returns {'messages': [AIMessage(...)]}
def writer(state): ...
def critic(state): ...

builder = StateGraph(State)
for name, fn in [('supervisor', supervisor), ('researcher', researcher), ('writer', writer), ('critic', critic)]:
    builder.add_node(name, fn)

builder.set_entry_point('supervisor')
for w in ['researcher', 'writer', 'critic']:
    builder.add_edge(w, 'supervisor')

builder.add_conditional_edges(
    'supervisor',
    lambda s: 'END' if s['next'] == 'FINISH' else s['next'],
    {'researcher': 'researcher', 'writer': 'writer', 'critic': 'critic', 'END': END},
)

with PostgresSaver.from_conn_string(DB_URL) as cp:
    graph = builder.compile(checkpointer=cp, interrupt_before=['supervisor'])

Real products, models, and research that use this idea.

  • LangChain's multi-agent supervisor tutorial uses researcher and chart-generator workers behind a supervisor LLM
  • Production teams deploying long-running research agents on Claude Opus 4.7 use supervisor patterns with Postgres checkpointers for crash recovery
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does the supervisor pattern handle parallel worker execution?
A

Out of the box the conditional edge picks one next worker. For parallelism, the supervisor can emit multiple routes and the graph fans out using Send directives; reducers on shared state must then be carefully chosen (add_messages is safe; non-deterministic last write wins is not). Parallel workers re-converge at the supervisor on completion.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Letting the supervisor return free-form text instead of a structured route. The conditional edge needs a typed signal, not a string parse.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Star-shaped topology with one supervisor and N workers

  • Supervisor as an LLM call producing a structured route signal

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Design a sensible migration…
Short answer·Hard