Using Claude Code to Run Deep Research
Deep research is an AI system that spawns its own research teams, coordinates parallel investigations, and produces comprehensive reports—all without human intervention. You can build this yourself with Claude Code.

We'll build a multi-agent orchestration system to demonstrate how AI can automate the work of entire research teams, with a lead agent intelligently delegating tasks to specialized researcher and report-writer subagents.
By showcasing how large language models can handle complex, multi-step tasks through planning, tool use, and memory management, Claude's deep research agents offer a glimpse into the future of AI-assisted knowledge work.
The Architecture: Multi-Agent Research System
At its core, the deep research system employs a manager-worker design with three distinct agent types, each playing a crucial role in the research process. The Lead Agent serves as the orchestrator, analyzing incoming queries and strategically breaking them down into manageable subtopics. Rather than conducting research itself, this coordinator focuses purely on planning and delegation.

The system's intelligence lies in its task decomposition approach. When presented with a complex query like Research current developments in quantum computing, the Lead Agent might identify several key areas: hardware breakthroughs, algorithm advances, commercialization efforts, and academic research highlights. This division of labor helps ensure comprehensive coverage while preventing any single agent from becoming overwhelmed.
Parallel execution represents another architectural strength. Instead of processing subtopics sequentially, the system spawns multiple Researcher agents simultaneously. Each researcher operates in its own context window, investigating its assigned subtopic independently. This parallelism not only saves time—with reports of 6.7× faster processing—but also prevents context pollution between different research threads.
Each agent type comes with a restricted toolset appropriate to its role. The Lead Agent only accesses the Task tool for spawning subagents. Researchers utilize WebSearch and Write tools to gather and document findings. Report-writers employ Read, Glob, and Write tools to synthesize the final output. This specialization ensures agents remain focused on their core competencies without overstepping boundaries.
The Task tool serves as the linchpin of the entire system. When the Lead Agent invokes this tool, it spawns new subagents with specific roles and objectives. Each invocation includes parameters defining which agent template to use (researcher or report-writer) and the particular subtask to accomplish. The SDK handles the complexity of managing these concurrent agents, tracking their progress through unique identifiers.
WebSearch brings real-time information into the system. When a researcher needs current data, it formulates search queries based on its assigned subtopic. The tool returns titles, snippets, and URLs from web results. Researchers can iteratively refine their searches, following promising leads until they've gathered sufficient information. This live querying capability ensures the system accesses information beyond Claude's training cutoff.
The file system tools create a persistent workspace for collaboration. The Write tool allows agents to save their findings to disk, creating a durable record that outlasts any single agent's context window. Researchers use this to document their discoveries in markdown files within the files/research_notes/ directory. Each file becomes a knowledge artifact that other agents can access.
Read and Glob tools complete the file system toolkit. The Glob tool enables agents to discover files matching specific patterns—essential when the report-writer needs to find all research notes without knowing exact filenames. The Read tool then loads these files' contents, allowing the report-writer to ingest all gathered research systematically.

This tool ecosystem enables coordination without direct communication. Agents never exchange messages directly; instead, they communicate through the shared file system. A researcher writes findings to a file, and later the report-writer reads that file—elegant in its simplicity yet powerful in practice.
Code Example
See the following code snippet as an example.
# research_agent.py
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient, AgentDefinition # type: ignore
agents = {
"researcher": AgentDefinition(
description="Find sources for a single subtopic and write a short note.",
prompt=(
"You are a Researcher.\n"
"- Use WebSearch to gather current, credible sources.\n"
"- Summarize concisely; include URLs.\n"
"- When done, Write a markdown note to files/research_notes/{slug}.md"
),
tools=["WebSearch", "Write"],
model="haiku", # cost/latency friendly
),
"report_writer": AgentDefinition(
description="Synthesize research notes into a cohesive report.",
prompt=(
"You are a Report Writer.\n"
"- Use Glob to list files/research_notes/*.md and Read to ingest them.\n"
"- Write a single report to files/reports/{slug}.md with sections and citations.\n"
"- Do not perform new web searches."
),
tools=["Glob", "Read", "Write"],
model="haiku",
),
}
lead_system_prompt = (
"You are the Lead Research Coordinator.\n"
"Break the user query into 2–4 subtopics.\n"
"For each subtopic, call the Task tool to spawn the 'researcher' with a clear objective.\n"
"Wait for notes to be written to files/research_notes/.\n"
"Then call Task to spawn 'report_writer' to compile a final report in files/reports/.\n"
"Never use WebSearch or file tools yourself; delegate via Task.\n"
"Acknowledge progress briefly; be concise."
)
options = ClaudeAgentOptions(
system_prompt=lead_system_prompt,
allowed_tools=["Task"], # Lead only spawns subagents
agents=agents, # Programmatic subagent registry
permission_mode="bypassPermissions", # Use stricter mode in prod
)Walking Through a Research Query
Let's trace the journey of a research query from start to finish. When a user asks, "What are the current trends in renewable energy?" the Lead Agent springs into action. Its system prompt guides it to analyze the query and identify key research areas. Through its chain-of-thought reasoning, it might identify subtopics: solar energy trends, wind power developments, energy storage advances, and policy changes.
The Lead Agent then deploys researchers in parallel. It calls the Task tool multiple times, spawning a researcher for each identified subtopic. Researcher-1 might receive the directive "Research recent developments and trends in solar energy worldwide," while Researcher-2 investigates wind energy. Each spawned agent receives the researcher system prompt plus its specific assignment.
Each researcher searches the web using its WebSearch tool. Researcher-1 might query "2025 solar energy trends global" and receive results about new efficiency records and deployment statistics. It can follow up with more specific searches, perhaps investigating a promising article about perovskite solar cells. The researcher exercises judgment about which leads to pursue and when it has gathered sufficient information.
After gathering data, researchers write findings to files. Each creates a summary document in the research notes directory. Researcher-1 might produce solar.txt containing key developments, statistics, and source citations. These notes aren't polished reports—they're structured information dumps designed for the report-writer's consumption.
Once all researchers complete their work, the Lead Agent spawns the report-writer. This final agent receives a directive like "Compile a report on current trends in renewable energy using all available research notes." The report-writer uses Glob to discover all note files, then systematically reads each one, building a comprehensive picture of the research landscape.
The report-writer synthesizes the final report, weaving together insights from all research notes into a coherent narrative. It might organize findings by energy type, highlight cross-cutting themes, and ensure proper attribution to sources. The final document lands in files/reports/, ready for the user's review.
Consider a real example: researching quantum computing developments. The Lead Agent might spawn researchers for hardware advances, software breakthroughs, and commercial applications. One researcher discovers news about a quantum supremacy milestone, another finds information about new error correction algorithms, and a third uncovers venture capital investments in quantum startups. The report-writer synthesizes these threads into a comprehensive overview of the quantum computing landscape.
Memory and State Management
The file system serves as shared workspace and external memory for the agent collective. Unlike traditional chatbots limited by context windows, this system can accumulate vast amounts of information across multiple files. Each file acts as a memory cell, storing specific findings that any agent can later retrieve.
Context window management happens through subagent isolation. Each researcher operates within its own context, preventing information overflow. When Researcher-1 investigates solar energy, it doesn't need to worry about wind energy data cluttering its context. This isolation allows each agent to dive deep into its specific domain without hitting token limits.
The Claude Agent SDK provides automatic context compaction as a safety net. If any agent's conversation grows too long, the SDK automatically summarizes earlier portions to free up space. This happens transparently, ensuring agents can complete lengthy research tasks without crashing. The system essentially manages its own memory, deciding what to keep in immediate focus versus what to summarize.
Notes persist across subagents who never directly communicate. This asynchronous collaboration pattern mimics how human research teams operate—leaving notes for colleagues to find later. A researcher might uncover a crucial statistic at 2 PM, write it to a file, and the report-writer discovers it at 2:30 PM without any direct handoff. The file system provides durability and discoverability that ephemeral message passing cannot match.
What Makes This Different
Compared to LangChain, Claude's approach emphasizes internal planning over external orchestration. LangChain typically requires developers to code the control flow—explicitly managing when to search, when to summarize, and how to coordinate multiple agents. Claude's system, by contrast, learns these patterns from its prompts. The Lead Agent autonomously decides how many researchers to spawn and what topics they should investigate.
The contrast with OpenAI function-calling reveals another distinction. OpenAI's system excels at structured API calls but doesn't natively support spawning multiple LLM instances working in parallel. A developer could approximate multi-agent behavior by manually managing multiple API calls, but Claude's Task tool makes this a first-class capability. One command spawns an entirely new agent with its own context and goals.
Claude's autonomous task decomposition happens without hardcoded logic. There's no fixed rule saying "always create three researchers" or "always investigate these specific subtopics." Instead, the model genuinely analyzes each query and adapts its approach. For a narrow technical question, it might spawn just two specialized researchers. For a broad societal topic, it could spawn four researchers covering different perspectives.
Performance data validates this approach: 90% performance improvement over single-agent systems on research tasks. This dramatic gain comes from parallel processing, specialized expertise, and intelligent task decomposition. Where a single agent might struggle with information overload or context limitations, the multi-agent system thrives through division of labor.
Practical Applications
Literature reviews and competitive intelligence represent natural applications. Academic researchers could use the system to survey recent publications on niche topics, with each researcher agent focusing on different journals or methodologies. Business analysts might investigate competitor strategies, with agents separately analyzing product launches, financial reports, and customer reviews before synthesizing insights.
For customer support knowledge synthesis, the system could digest support tickets, documentation, and forum posts to identify trending issues. Researcher agents might specialize by product line or issue type, creating comprehensive briefings for support teams. The file system could accumulate institutional knowledge over time, building a searchable archive of synthesized insights.
Personal research assistant capabilities bring this power to individual users. Planning a trip? The system could research destinations, accommodations, and activities in parallel, producing a detailed itinerary. Investigating health topics? Separate agents could explore scientific studies, practical advice, and personal experiences, synthesizing balanced perspectives.
Domain-specific extensions unlock even more potential. Financial analysis agents could combine web research with live market data, using code execution tools to run calculations. Legal research agents might search case law while simultaneously analyzing statutory changes. The system's modular design makes such extensions straightforward—just add appropriate tools and prompts for new domains.
The Path Forward
Deep research agents showcase the power of multi-agent coordination in tackling complex information challenges. Through intelligent task decomposition, parallel execution, and persistent memory, these systems achieve what would take human research teams hours or days to accomplish.
The key principles—tool use, planning, parallelism, and external memory—offer a blueprint for building sophisticated AI assistants. Rather than trying to stuff everything into a single context window, the system embraces distributed intelligence. Each agent contributes its specialized expertise while the file system provides the connective tissue.
This approach represents Anthropic's philosophy of "giving Claude a computer"—not just access to tools, but the ability to coordinate complex workflows autonomously. The system doesn't just retrieve information; it genuinely researches, synthesizes, and reasons about topics in depth.
Looking ahead, these capabilities open possibilities for AI agents as research collaborators rather than mere assistants. As the tools expand and the agents grow more sophisticated, we move closer to AI systems that can genuinely augment human intelligence in knowledge work. The deep research agent offers a compelling preview of that future—one where AI doesn't just answer questions but truly investigates them.
Want to build your own research agent? Start with Claude's deep research demo on GitHub. The code is open and the SDK handles the complexity. Within hours, you could have an AI team conducting research that would take humans days.