LLM Lab

Supervisor & subagents

One agent plans and delegates; specialised agents do the work and report back. This keeps control in one place.

Where this sits in a LangGraph application
State→Nodes→Edges & routing→Parallel (Send)→Checkpoints & interrupts→Several agents

Subagents as tools

In the subagents pattern (often called a supervisor), a main agent decides what to do and calls specialised agents as tools: a researcher with a search tool, a writer with a style guide. Each subagent runs its own loop with its own prompt and tools, then returns a result. All routing goes through the main agent, which is what the LangChain docs call centralised control.

callresultcallresultusersupervisorcreate_agentresearchsubagent as toolwritersubagent as toolweb_search
The subagents pattern: only the supervisor talks to the user. Each subagent is a tool with its own prompt and tools, and returns its result to the supervisor.
from langchain.agents import create_agent
from langchain.tools import tool

researcher = create_agent(model="provider:model-name", tools=[web_search],
                          system_prompt="Find facts and cite sources.")

@tool("research", description="Research a topic and return findings")
def call_researcher(query: str) -> str:
    result = researcher.invoke({"messages": [{"role": "user", "content": query}]})
    return result["messages"][-1].content

supervisor = create_agent(model="provider:model-name",
                          tools=[call_researcher, call_writer],
                          system_prompt="Plan the work and delegate it.")
A supervisor built from two create_agent calls. The researcher becomes a tool; the supervisor treats it like any other tool.

A worked example

“Write a one-paragraph brief on battery prices with sources.” The supervisor calls research, which runs its own search loop and returns three facts with links. It then calls the writer with those facts; the writer returns a paragraph. The supervisor checks that each claim has a source and replies to the user. The user never sees the subagents’ internal steps, only the result.

In practice

Use this pattern when tasks split into clear specialities or can run in parallel, and when one place should enforce the rules. It costs extra model calls for planning and summarising, so measure whether it beats a single agent with the same tools. A tool can also return a Command to pass chosen state keys back, not just text.

Easy to confuse

Check yourself · 1 of 3

In the subagents pattern, who talks to the user?

Check yourself · 2 of 3

How is a subagent exposed to the supervisor in LangChain?

Check yourself · 3 of 3

Why give each subagent its own narrow prompt and tools?

Read more in the books

  • LangChain and LangGraph documentation, LangChain: LangChain: Multi-agent, the subagents pattern.
  • An Introduction to MultiAgent Systems (2nd ed.), Michael Wooldridge: Ch. 1, “Introduction”.
All books
Labdelegate the work
How to read this
  • The stage map shows the supervisor and its two subagents; the lit one is working. Next message reveals the run one message at a time.
  • Notice that the subagents only ever answer the supervisor; the user hears from the supervisor alone. The tiles count tokens per agent.