What are Deep Agents?

LangChain · Intermediate ·🧠 Large Language Models ·11mo ago

Key Takeaways

The video discusses the concept of deep agents, which are agents that use LLMs to call tools in a loop, and provides examples of applications such as Claude Code and Manessa that have implemented this architecture. It also highlights the characteristics of deep agents, including planning tools, sub-agents, access to a file system, and detailed system prompts.

Full Transcript

Claude Code is a fantastic agent and has recently taken the developer community by storm and interestingly not just for coding related things but for other things in general writing books, writing reports, things like that. And part of the reason is that it is so good at general purpose and longer time horizon planning and and doing things deeply that it it can be extended to to all of these things. This isn't the first agent that has come out that has been able to do these deep work. So we have Manessa, a general purpose agent, open AI's deep research and now claude code and and and these are all examples of agents that can act on long time horizons on complex tasks and go deep into different kind of like rabbit holes but then bubble back up and and accomplish kind of like a highle goal. I would argue that these all have a few things in common. And I came up with the term deep agents to describe agents that have these characteristics. There are four characteristics that make up deep agents. They have a planning tool. They use sub agents. They have access to a file system. And they have a detailed system prompt. Let's break it down. Under the hood, deep agents use the same tool calling loop that a simple React style agent would use. They run in a loop. They make an LLM call and then based on that, they either stop or they go back and they take action on their environment. and they get some feedback. If you try doing this naively with uh LLM, they're really good at at doing one or two or even three or four tool calls, but they struggle with longer time horizon tasks, planning on those tasks, and then executing and and going deep into specific areas and subcomponents of that task. Deep agents, on the other hand, are able to do those longer time horizon, more complex tasks. And it's not that they're using a different algorithm. They're using the same algorithm. What's different is the four things I mentioned earlier, the prompt and the tools that has access to. Let's go through these one by one. First up, let's talk about a planning tool. This is an excerpt from Manis' system prompt where it talks about the planner module that it has. And so you can see that it has a planner module that's used for overall task planning. Task planning will be provided as events in the event stream. And then basically it it tells the agent in the system prompt to do everything in in in this plan. Claude code also has this to-do write tool which creates and manages structured tasks lists. So by prompting the agent to generate this this plan, it can then have this plan in its context as it executes upon the various steps. Now this tool that does the planning could actually be quite simple. So, Claude Code, for example, with this to-do write tool, it doesn't actually do anything. It's a noop tool. So, it basically isn't a chance for the model to come up with a to-do list and then it can quote unquote modify the to-do list, but it does that by just generating a new to-do list every time. So, it doesn't actually track this in a data structure or anything like that. Why does this work then? It works because it creates these messages that are in the model's context that show this to-do list that it's tracking. And so it helps it kind of like keep on track even if it's as simple as just putting this to-do list in the model's context. So the planning tool helps solve the issue that the agent isn't able to act cohesively over longer time horizon. Let's now talk about sub aents. This is a diagram from Anthropic's advanced research paper and you can see that they use a few different sub aents here. They have a citation sub aents and then a bunch of search sub aents that they can kick off in parallel. Manis also uses sub aents to accomplish its task. And so you can see that there are sub aents that can focus on browsing or information gathering while this higher level orchestrator the mainus brain coordinates all of them. This article from anthropic on the use of sub aents and clawed code summarizes a few of these key benefits. First is context preservation. So each sub aent operates in its own context. So basically when it does its own tool calling loop, those don't pollute the main agents context. So it can go off and it can do these rabbit holes and go really deep in these rabbit holes, but then those don't bubble back up to the main agent. And conversely, any work that the main agent might have done up to that point doesn't pollute the context of the sub aent. So it just has a specific dedicated f focus. You can give these sub aents specialized expertise. This usually comes in the form of system prompts or tools that they have. And so this can allow them to really focus on a particular area or take a point of view that might be different from that of the main agent. And and different opinions are good. They help arrive at kind of like a better result. These last two points really mostly relate to clawed code, but if you're designing a system that has a deep agent, they're probably applicable there as well. So a these sub aents can be reusable. So you can create one sub aent to use with one agent and then and then reuse it in another place. And likewise, these sub aents can have different permissions. This kind of gets to the specialized expertise, but is a little bit finer grain of a point. So one sub aent could have access to write files and the other one couldn't. And so you can actually scope down what what these sub aents can do in terms of yielding better results. I think the main thing to realize about sub aents is that they allow you to go deeper in specific areas by having this combination of context preservation and just really focusing on one thing and also this specialized expertise which guides that focus. Next, let's talk about file systems. So this is from a blog that Manis wrote on using the file system as a context. And so why does this work? So again, a key part of these agents is that as they do more things, more and more context is generated. And if you just keep on passing this in a loop to the LLM, that context will eventually degrade the LLM performance. So file systems are great because they let you offload some of this context to files, which the the agent can then see and access and read if it wants to, but it doesn't necessarily pollute. And this is again from the Manis blog post. But if we just look at this, we can see the difference in what is in the context of the LLM. So rather than just putting large observations directly in the context, we can see that we have short observations which reference the file system with document X or file Y. And these can then be read back in deliberately or written to if they want. One really interesting point here is that Anthropics models are fine-tuned to use a specific. Now, this tool doesn't actually run server side. And if you look in their docs, they show how to call this tool, as in to get the model to generate the payload for these tools. But then you actually have to implement and and and execute the tools yourself. And so these tools are for editing files. Um, so there's some built-in file editing tools into claw that it's really good at using. And so combining this file system idea with claude, you can actually get a system that where the model is fine-tuned to know how to write to and manage files. And that's really useful for managing the context. And then finally, I want to talk about system prompts. So this sounds really basic. Of course, agents have system prompts. I think one underappreciated thing is that these system prompts are often really long and really detailed. So there's a bunch of leaked system prompts, but this is actually from the deep research system prompt that Anthropic open source. And this is just part of it. It's way longer than this. And so you can see that these system prompts start to get to be hundreds or thousands of lines. I think a common misconception is that because the models are so good, you can write a pretty short system prompt. And that's not at all the case. You need to give it a bunch of context on how to use these tools like the to-do list tool and the planning tool and the uh file system tools and the sub aents. And you also need to give it information about the tasks that it's trying to do and how these should act. So again, obviously agents have system prompts, but I think the underappreciated thing here is that prompting absolutely still matters and all the best deep agents are spending a ton of time and writing hundreds if not thousands of lines into their system prompts. I wrote a blog on this that goes over a few of these concepts and links to more articles if you want to check it out here. I also made a Python package called deep agents which comes with some off-the-shelf scaffolding for these types of deep agents. Specifically, it comes with built-in things for those four different attributes. So, it comes with a built-in planning tool, a built-in file system tool, a built-in sub aent tool, and a built-in system. And then you just provide a few custom instructions and any additional tools that you wanted to have access to and you can pretty easily create deep agents for research or coding in far fewer lines than you could if you were writing it from scratch. So if you're building or you want to build deep agents, I would highly encourage you to check this out. If you're interested in using this package, I'll do a deep dive video on the code behind this in a future video. Thanks for watching.

Original Description

Using an LLM to call tools in a loop is the simplest form of an agent. This architecture, however, can yield agents that are “shallow” and fail to plan and act over longer, more complex tasks. Applications like “Deep Research”, “Manus”, and “Claude Code” have gotten around this limitation by implementing a combination of four things: a planning tool, sub agents, access to a file system, and a detailed prompt. Deep Agents are agents that use these four things to execute on longer time horizon tasks. Blog: https://blog.langchain.com/deep-agents/ GitHub: https://github.com/hwchase17/deepagents Learn to build Deep Agents on LangChain Academy: https://academy.langchain.com/courses/deep-agents-with-langgraph/?utm_medium=social&utm_source=youtube&utm_campaign=q4-2025_youtube-academy-links_aw Observe, evaluate, and deploy agents with LangSmith: https://smith.langchain.com/?utm_medium=social&utm_source=youtube&utm_campaign=q4-2025_youtube-links_aw
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LangChain · LangChain · 0 of 60

← Previous Next →
1 Chat With Your Documents Using LangChain + JavaScript
Chat With Your Documents Using LangChain + JavaScript
LangChain
2 LangChain SQL Webinar
LangChain SQL Webinar
LangChain
3 LangChain "OpenAI functions" Webinar
LangChain "OpenAI functions" Webinar
LangChain
4 LangSmith Launch
LangSmith Launch
LangChain
5 LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain
6 LangChain Expression Language
LangChain Expression Language
LangChain
7 Building LLM applications with LangChain with Lance
Building LLM applications with LangChain with Lance
LangChain
8 Benchmarking Question/Answering Over CSV Data
Benchmarking Question/Answering Over CSV Data
LangChain
9 LangChain "RAG Evaluation" Webinar
LangChain "RAG Evaluation" Webinar
LangChain
10 Fine-tuning in Your Voice Webinar
Fine-tuning in Your Voice Webinar
LangChain
11 Tabular Data Retrieval
Tabular Data Retrieval
LangChain
12 Building an LLM Application with Audio by AssemblyAI
Building an LLM Application with Audio by AssemblyAI
LangChain
13 Superagent Deepdive Webinar
Superagent Deepdive Webinar
LangChain
14 Lessons from Deploying LLMs with LangSmith
Lessons from Deploying LLMs with LangSmith
LangChain
15 Shortwave Assistant Deepdive Webinar
Shortwave Assistant Deepdive Webinar
LangChain
16 Cognitive Architectures for Language Agents
Cognitive Architectures for Language Agents
LangChain
17 Effectively Building with LLMs in the Browser with Jacob
Effectively Building with LLMs in the Browser with Jacob
LangChain
18 Data Privacy for LLMs
Data Privacy for LLMs
LangChain
19 "Theory of Mind" Webinar with Plastic Labs
"Theory of Mind" Webinar with Plastic Labs
LangChain
20 LangChain Templates
LangChain Templates
LangChain
21 Using Natural Language to Query Postgres with Jacob
Using Natural Language to Query Postgres with Jacob
LangChain
22 Building a Research Assistant from Scratch
Building a Research Assistant from Scratch
LangChain
23 Benchmarking RAG over LangChain Docs
Benchmarking RAG over LangChain Docs
LangChain
24 Skeleton-of-Thought: Building a New Template from Scratch
Skeleton-of-Thought: Building a New Template from Scratch
LangChain
25 Benchmarking Methods for Semi-Structured RAG
Benchmarking Methods for Semi-Structured RAG
LangChain
26 LangSmith Highlights: Getting Started
LangSmith Highlights: Getting Started
LangChain
27 LangSmith Highlights: Debugging
LangSmith Highlights: Debugging
LangChain
28 LangSmith Highlights: Datasets
LangSmith Highlights: Datasets
LangChain
29 LangSmith Highlights: Evaluation
LangSmith Highlights: Evaluation
LangChain
30 LangSmith Highlights: Human Annotation
LangSmith Highlights: Human Annotation
LangChain
31 LangSmith Highlights: Monitoring
LangSmith Highlights: Monitoring
LangChain
32 LangSmith Highlights: Hub
LangSmith Highlights: Hub
LangChain
33 SQL Research Assistant
SQL Research Assistant
LangChain
34 Getting Started with Multi-Modal LLMs
Getting Started with Multi-Modal LLMs
LangChain
35 Build a Full Stack RAG App With TypeScript
Build a Full Stack RAG App With TypeScript
LangChain
36 Auto-Prompt Builder (with Hosted LangServe)
Auto-Prompt Builder (with Hosted LangServe)
LangChain
37 LangChain v0.1.0 Launch: Introduction
LangChain v0.1.0 Launch: Introduction
LangChain
38 LangChain v0.1.0 Launch: Observability
LangChain v0.1.0 Launch: Observability
LangChain
39 LangChain v0.1.0 Launch: Integrations
LangChain v0.1.0 Launch: Integrations
LangChain
40 LangChain v0.1.0 Launch: Composability
LangChain v0.1.0 Launch: Composability
LangChain
41 LangChain v0.1.0 Launch: Streaming
LangChain v0.1.0 Launch: Streaming
LangChain
42 LangChain v0.1.0 Launch: Output Parsing
LangChain v0.1.0 Launch: Output Parsing
LangChain
43 LangChain v0.1.0 Launch: Retrieval
LangChain v0.1.0 Launch: Retrieval
LangChain
44 LangChain v0.1.0 Launch: Agents
LangChain v0.1.0 Launch: Agents
LangChain
45 Build and Deploy a RAG app with Pinecone Serverless
Build and Deploy a RAG app with Pinecone Serverless
LangChain
46 Hosted LangServe + LangChain Templates
Hosted LangServe + LangChain Templates
LangChain
47 LangGraph: Intro
LangGraph: Intro
LangChain
48 LangGraph: Agent Executor
LangGraph: Agent Executor
LangChain
49 LangGraph: Chat Agent Executor
LangGraph: Chat Agent Executor
LangChain
50 LangGraph: Human-in-the-Loop
LangGraph: Human-in-the-Loop
LangChain
51 LangGraph: Dynamically Returning a Tool Output Directly
LangGraph: Dynamically Returning a Tool Output Directly
LangChain
52 LangGraph: Respond in a Specific Format
LangGraph: Respond in a Specific Format
LangChain
53 LangGraph: Managing Agent Steps
LangGraph: Managing Agent Steps
LangChain
54 LangGraph: Force-Calling a Tool
LangGraph: Force-Calling a Tool
LangChain
55 LangGraph: Multi-Agent Workflows
LangGraph: Multi-Agent Workflows
LangChain
56 Streaming Events: Introducing a new `stream_events` method
Streaming Events: Introducing a new `stream_events` method
LangChain
57 Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
LangChain
58 OpenGPTs
OpenGPTs
LangChain
59 Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
LangChain
60 LangGraph: Persistence
LangGraph: Persistence
LangChain

This video teaches the concept of deep agents and how they can be used to perform complex tasks over long time horizons. It highlights the importance of planning tools, sub-agents, and file systems in building deep agents. By watching this video, viewers can learn how to design and implement deep agents using LLMs.

Key Takeaways
  1. Identify the characteristics of deep agents
  2. Design sub-agents with specialized expertise
  3. Implement a tool calling loop using LLMs
  4. Use file systems to offload context
  5. Fine-tune LLMs for specific tasks
  6. Utilize system prompts for deep agents
  7. Build a deep agent using a Python package
💡 Deep agents can struggle with longer time horizon tasks, planning, and execution, but with the right tools and prompts, they can accomplish complex tasks.

Related Reads

📰
🚀 Day 3 of 100 Days of GenAI for DevOps is LIVE!
Learn how to estimate GPU memory needs for Large Language Models (LLMs) and optimize deployment as a DevOps engineer
Dev.to AI
📰
Unlocking Open-Weight LLMs: A Developer's Guide to Seamless API Integration
Learn to integrate Open-Weight LLMs into your applications using seamless API integration and unlock new possibilities for natural language processing
Dev.to · NovaStack
📰
We Built AI Using Wikipedia, But Wikipedia Is 40% Wrong
Learn how AI built using Wikipedia can be flawed due to the platform's inaccuracies and why this matters for AI development
Medium · Machine Learning
📰
LLM vs RAG Explained (EP2): How AI Actually Finds the Right Answers
Learn how LLMs and RAGs work together to help AI find the right answers, and why they sometimes get things wrong
Medium · Data Science
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →