Deep Research Agent with Sub-Agents
Orchestrate multiple AI specialists to research any topic in depth
The Problem
Building a research agent that can break complex topics into sub-tasks, search the web, and synthesize findings requires coordinating multiple specialists — web searchers, analyzers, writers — while maintaining context across all of them.
The Solution
Deep Agents provides built-in sub-agent delegation via the `task` tool, web search integration, and automatic context management. Define specialist sub-agents, give them tools, and the orchestrator handles coordination, context isolation, and result aggregation.
Working Code
from deepagents import create_deep_agentfrom langchain.chat_models import init_chat_modelfrom langchain_core.tools import tool
@tooldef web_search(query: str, max_results: int = 5) -> dict: """Search the web for current information.""" from tavily import TavilyClient client = TavilyClient() return client.search(query, max_results=max_results)
research_sub_agent = { "name": "researcher", "description": "Delegate research to a specialist sub-agent.", "system_prompt": "You are a research specialist. Search thoroughly and synthesize findings.", "tools": [web_search],}
agent = create_deep_agent( model=init_chat_model("anthropic:claude-sonnet-4-5-20250929"), tools=[web_search], system_prompt="You are a research orchestrator. Break complex topics into sub-tasks and delegate to researchers.", subagents=[research_sub_agent],)
result = agent.invoke({"messages": [("user", "Research the latest advances in AI agent architectures")]})Step by Step
Install & configure
Install deepagents with `pip install deepagents` and set your API keys for Anthropic and Tavily (web search).
Define search tools
Create a `web_search` tool using Tavily that the agent and sub-agents can use to find current information on any topic.
Create sub-agents
Define specialist sub-agents as dictionaries with a name, description, system prompt, and tools. The orchestrator will delegate tasks to them automatically via the `task` tool.
Run the orchestrator
Invoke the agent with your research question. It will plan sub-tasks, delegate to researchers, collect results, and synthesize everything into a comprehensive answer.
Related Use Cases
Text-to-SQL Agent with Memory
Build an agent that converts natural language questions into SQL queries, explores database schemas, and learns from past interactions through persistent filesystem-backed memory.
Content Generation Agent with Image Creation
Build a multi-agent content pipeline that researches topics, writes blog posts following brand guidelines, and generates cover images — all orchestrated by a single agent with sub-agents and custom tools.
Ready to build this?
Get started with Vstorm's open-source tools — production-tested, fully documented, and free.
Get StartedReady to build your first production AI agent?
Open-source tools, battle-tested patterns, zero boilerplate. Configure your stack and ship in minutes — not months.