Module 2 · Orchestration topologies

Supervisor and hierarchical orchestration

5 min read

The supervisor topology is the most common in production, and for good reasons: it is predictable, observable and easy to evolve. In this lesson we build Atlas's with LangGraph, then extend it to a hierarchical organization.

The principle

A central agent — the supervisor — receives the request, breaks it down, delegates each piece to a specialized agent and aggregates the results. Specialists don't talk to each other: all communication goes through the center.

                 supervisor
              ┌──────┼──────┐
              ▼      ▼      ▼
          agent A  agent B  agent C
              └──────┼──────┘
                     ▼
                 aggregation
StrengthsWeaknesses
Centralized control: one place decidesThe supervisor is a bottleneck
Easy to trace and debugIts decomposition mistakes spread everywhere
Simple, interchangeable specialistsCoordination cost (extra calls)
Termination guaranteed by constructionPoor fit for rich exchanges between specialists

LangGraph in three concepts

LangGraph models a system as a state graph:

  • State (State): a typed dictionary shared by all nodes.
  • Nodes: functions that read the state and return a partial update.
  • Edges: who runs after whom — fixed (add_edge), conditional (add_conditional_edges) or decided by the node itself (Command).

Here is Atlas's state:

class State(TypedDict, total=False):
    question: str
    plan: list[str]
    findings: Annotated[list[dict], operator.add]  # reducer: researchers append without overwriting
    draft: str
    review: dict | None
    revisions: int
    approved: bool

The key line is findings. By default, when a node returns {"draft": "…"}, the value replaces the old one. With Annotated[list[dict], operator.add], updates are concatenated: each researcher appends its result to the list. This is called a reducer; we'll come back to it in detail in lesson 2.3.

The Atlas graph

def dispatch(state: State) -> list[Send]:
    """Map: one research task per sub-question, run in parallel."""
    return [Send("researcher", {"subquestion": q}) for q in state["plan"]]


def build_graph(checkpointer=None):
    builder = StateGraph(State)
    builder.add_node("planner", planner)
    builder.add_node("researcher", researcher)
    builder.add_node("writer", writer)
    builder.add_node("critic", critic)          # routes itself via Command
    builder.add_node("human_review", human_review)

    builder.add_edge(START, "planner")
    builder.add_conditional_edges("planner", dispatch, ["researcher"])
    builder.add_edge("researcher", "writer")    # reduce: the writer waits for all researchers
    builder.add_edge("writer", "critic")

    return builder.compile(checkpointer=checkpointer or InMemorySaver())

The supervisor, split into roles

Where is the supervisor? It isn't a single node: its responsibility is split between the planner (decomposition), the dispatch function (delegation) and the writer (aggregation). This is a recommended practice: a "super-agent" that plans, delegates, aggregates and judges piles too many responsibilities into a single prompt.

Map-reduce with Send

dispatch returns a list of Send("researcher", payload). Each Send creates an independent run of the researcher node, with its own payload — and they all run in parallel within the same graph step. That's the map.

The researcher → writer edge performs the reduce: LangGraph waits for all parallel runs to finish before launching the writer, which finds every researcher's results in state["findings"], concatenated by the reducer.

Note that the researcher receives only its payload, not the global state:

class ResearchTask(TypedDict):
    subquestion: str


@guarded
def researcher(task: ResearchTask) -> dict:
    hits = knowledge.search(task["subquestion"], k=3)
    ...
    return {"findings": [finding.model_dump()]}

That's context isolation by construction: a researcher sees neither the global question nor its colleagues' work. It can neither be distracted by them nor contaminate them.

Toward a hierarchical organization

When the number of specialists exceeds what one supervisor can coordinate effectively (routing quality degrades as options multiply — measure it rather than trusting a universal threshold), you introduce team supervisors:

                    director
              ┌─────────┴─────────┐
       research supervisor     writing supervisor
         ┌────┼────┐              ┌────┴────┐
       web  docs  data          writer   reviewer

In LangGraph, each team is a compiled subgraph, used as a node of the parent graph:

research_team = build_research_graph()      # a compiled StateGraph
writing_team = build_writing_graph()

parent = StateGraph(ProjectState)
parent.add_node("research", research_team)  # a compiled graph is a node like any other
parent.add_node("writing", writing_team)
parent.add_edge(START, "research")
parent.add_edge("research", "writing")

Each subgraph is developed, tested and versioned independently. It's the same principle as software modularity: narrow interfaces (the shared state keys) between autonomous components.

Watch the shared keys: a subgraph used directly as a node communicates with the parent through the state keys they have in common. If the schemas differ a lot, wrap the subgraph in a function that translates the input and output state — an explicit boundary, and therefore testable.

When to choose a supervisor

  • Sub-tasks are identifiable in advance or by a planner.
  • You need traceability (regulated industries, audits).
  • Specialists don't need to talk to each other.
  • Termination must be guaranteed.

If, on the other hand, agents need to hand off to each other unpredictably as the conversation evolves, the network topology (next lesson) is more natural.

Key takeaways

  • The supervisor centralizes decomposition, delegation and aggregation; these roles benefit from being split across several simple nodes.
  • In LangGraph: a typed state, nodes returning partial updates, fixed, conditional or dynamic edges.
  • Send performs the parallel map; a reducer on the results key performs the reduce.
  • Beyond a few specialists, move to a hierarchy of subgraphs with narrow interfaces.

Hands-on

  1. Display the Atlas graph: print(build_graph().get_graph().draw_mermaid()) and paste the result into a Mermaid editor.
  2. Remove operator.add from the findings key and run the offline tests. Read the error you get: it's the subject of lesson 2.3.
  3. Turn the research phase into an independent subgraph used as a node of the main graph.

Resources