Supervisor & subagents
One agent plans and delegates; specialised agents do the work and report back. This keeps control in one place.
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.
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 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
- A subagent is not a separate service: it is another create_agent with its own prompt and tools, called inside a tool function.
- Centralised control helps reliability but makes the supervisor a bottleneck: every message passes through it.
In the subagents pattern, who talks to the user?
Subagents are called as tools and return their results to the main agent, which keeps control and writes the reply.
How is a subagent exposed to the supervisor in LangChain?
Wrapping the subagent’s invoke call in a @tool function lets the supervisor call it like any other tool.
Why give each subagent its own narrow prompt and tools?
A researcher does not need the email tool and a writer does not need the search history; isolation improves focus and limits damage.
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”.