A beginner-friendly guide to building AI agents with LangChain's Deep Agents framework.
Deep Agents make it easy to create LLM-powered assistants that can plan, use tools, delegate to subagents, and remember things across conversations.
deepagents-tutorial/
│
├── 01_hello_world/ # Start here! Simplest possible agent
├── 02_research_agent/ # Agent that searches the web and writes reports
├── 03_memory_agent/ # Agent that remembers users across conversations
├── 04_subagents_team/ # Team of specialist agents working together
├── 05_streaming/ # Real-time token output with agent.stream()
├── 06_human_in_loop/ # Agent pauses for human approval on sensitive actions
├── 07_fastapi_server/ # Full REST API server with streaming + sessions
│
├── requirements.txt # All Python dependencies
└── README.md # You are here
git clone https://github.com/mkassaf/deepagents-tutorial.git
cd deepagents-tutorialpip install -r requirements.txt# Required: pick one LLM provider
export ANTHROPIC_API_KEY="your-anthropic-key" # get at console.anthropic.com
# OR
export OPENAI_API_KEY="your-openai-key" # get at platform.openai.com
# Required for examples 02 and 04 (web search)
export TAVILY_API_KEY="your-tavily-key" # free tier at tavily.com# Start with the simplest one
python 01_hello_world/agent.py| # | Example | What it teaches | Difficulty |
|---|---|---|---|
| 01 | Hello World | Creating your first agent, basic tools | ⭐ Beginner |
| 02 | Research Agent | Web search, planning, file system | ⭐⭐ Beginner+ |
| 03 | Memory Agent | Long-term memory across sessions | ⭐⭐⭐ Intermediate |
| 04 | Subagents Team | Multiple specialist agents, delegation | ⭐⭐⭐ Intermediate |
| 05 | Streaming Agent | Real-time token output, SSE streaming | ⭐⭐ Beginner+ |
| 06 | Human-in-the-Loop | Agent pauses for human approval | ⭐⭐⭐ Intermediate |
| 07 | FastAPI Server | REST API, multi-session, production deploy | ⭐⭐⭐ Intermediate |
User asks a question
↓
Deep Agent (brain)
├── Plans steps with write_todos
├── Reads/writes files to manage context
├── Calls your custom tools (search, APIs...)
└── Spawns subagents for complex subtasks
↓
Final answer returned to user
The key insight: unlike a simple chatbot, a Deep Agent actively manages its own workflow. It decides what to do next, tracks progress, and handles errors — just like a human assistant would.
| Concept | What it is | Analogy |
|---|---|---|
| Agent | The main AI brain | A project manager |
| Tool | A Python function the agent can call | A tool in a toolbox |
| Planner | write_todos built-in tool |
A to-do list |
| File system | read/write files for large data | A scratchpad |
| Subagent | A specialized mini-agent | A team member |
| Memory | Persistent storage across sessions | A notebook |
deepagents— The main frameworklangchain— Core building blockslanggraph— Runtime for durable executionanthropic— Claude LLM providertavily-python— Web search API
Found a bug or want to add an example? Open an issue or PR!
Built with ❤️ using LangChain Deep Agents