Skip to main content

Overview

This guide shows how to build a multi-step web research agent with Deep Agents. The agent decomposes research questions into focused tasks, delegates them to specialized sub-agents, and synthesizes findings into a comprehensive report. The agent you build will:
  1. Plan research using the opt-in todo list middleware
  2. Delegate focused research tasks to sub-agents with isolated context
  3. Assess search results and plan next steps as you gather information
  4. Synthesize findings with proper citations into a final report
The spawned sub-agents conduct web searches with Tavily, fetching full webpage content for analysis.

Key concepts

This tutorial covers:

Prerequisites

API keys for:
  • Anthropic (Claude) or Google (Gemini)
  • Tavily for web search (optional; free tier is sufficient)
  • LangSmith for tracing (optional if you are using the SDK; required for Managed Deep Agents)

Choose your path

This guide shows how to build this agenet with Managed Deep Agents and the Deep Agnets SDK. Managed Deep Agents laets you deploy agents without having to manage infrastructure. The Deep Agents SDK, lets you have maximum flexibility while using the same Deep Agents harness and you can host agents yourself, or run a custom LangSmith Deployment.
Managed Deep Agents is in public beta on LangSmith Cloud.

Setup

To follow along, you need:
  • Python and uv.
  • An API key for your model provider of choice.
1

Create the project

2

Add API keys

Add your model provider key, Tavily key, and LangSmith API key to .env:
.env
Do not commit the .env file into version control. It contains secrets.
3

Install search dependencies

Build the agent

1

Add tools

Create a custom search tool. The tavily_search tool uses Tavily for URL discovery, then fetches full webpage content so the agent can analyze complete sources instead of summaries.Create tools/search.py:
tools/search.py
2

Add orchestrator instructions

Put the research workflow and sub-agent coordination guidance in instructions.md. Managed Deep Agents loads this file as the orchestrator system prompt:
instructions.md
When you deploy, Managed Deep Agents syncs these instructions to Context Hub.
3

Create the agent

You just put the main agent’s instructions in instructions.md. Replace the scaffolded agent entry with the full file below. It sets the model, tools, the research sub-agent (including that sub-agent’s own prompt), and TodoListMiddleware so the agent can call write_todos for task planning. name is required: MDA uses it as the LangGraph assistant ID and the default deployment name.Replace agent.py. Choose your provider:
agent.py

Run the agent

1

Run locally

Install dependencies and start the agent:
mda dev loads API keys from .env, starts a local Agent Server, and opens the agent in LangSmith Studio.In Studio, send a research question such as:
You should see the orchestrator plan with write_todos, delegate to the research sub-agent, and write a report. For more information, see Develop locally with LangSmith Studio.
2

Deploy (optional)

On success, the CLI prints the deployment dashboard URL. See Deploy.

Next steps

Now that you’ve built the agent, customize the workflow by editing the orchestrator instructions (Managed Deep Agents: instructions.md; SDK: prompt constants in your agent file). You can also tune the delegation limits to allow more parallel sub-agents or delegation rounds. For more information on the concepts in this tutorial, see: