LangChain Deep Agents: a structured runtime for planning, memory, and context isolation
LangChain's Deep Agents, released in March 2026, provides a structured runtime for LangGraph with built-in planning, filesystem-based context management, and subagent delegation for complex AI workflows.
LangChain released Deep Agents on March 15, 2026 — a structured runtime that gives AI agents built-in planning, filesystem-based context management, and subagent delegation. It fills a gap that most agent frameworks have ignored: what happens when a task takes more than a few tool calls to finish.
What Deep Agents actually is
Deep Agents is an "agent harness" built on top of LangGraph, LangChain's runtime for durable execution. It packages a set of defaults and built-in tools around the standard tool-calling loop. Developers get planning, context offloading, and subtask delegation without building those systems from scratch.
The library ships with several core components: a write_todos planning tool, filesystem tools (read_file, write_file, edit_file, ls, glob, grep), sandboxed shell access via execute, a task tool for spawning subagents, and auto-summarization for context management.
Calling create_deep_agent(...) returns a CompiledStateGraph — a standard LangGraph object. This means Deep Agents is not a separate abstraction layer. It runs on the same runtime, supports streaming, LangGraph Studio, and checkpointers out of the box.
Why planning matters for multi-step agents
Most LLM agents work well for short tool-calling sequences: search the web, parse a result, return an answer. They start to degrade when the task requires ten, twenty, or fifty steps with intermediate decisions.
Without a planning layer, the model improvises each step based on whatever is currently in the prompt window. Deep Agents addresses this with write_todos, a built-in tool that lets the agent break a complex task into discrete steps, track progress, and update the plan as new information appears.
This is useful for concrete workflows: research tasks that require multiple searches and cross-referencing, coding sessions that span several files, or analysis jobs where each step depends on the previous result. The agent writes its plan, executes against it, and marks items complete as it goes.
Filesystem-based context management
Context window overflow is the main failure mode for long-running agents. A single Claude Opus 4 context window holds roughly 200,000 tokens. That sounds like a lot until an agent accumulates search results, code outputs, intermediate notes, and conversation history across dozens of steps.
Deep Agents uses filesystem tools to solve this. Instead of keeping everything in the active prompt, the agent writes large outputs — generated code, research notes, intermediate reports — to files and retrieves them when needed. This approach reduces prompt-window pressure and keeps the working context relevant.
The system supports multiple backend types: StateBackend (ephemeral, stored in LangGraph state), FilesystemBackend, LocalShellBackend, StoreBackend, and CompositeBackend. The default is StateBackend, which stores an ephemeral filesystem for a single thread.
Autonomous context compression
On March 11, LangChain released a companion feature: autonomous context compression. Rather than compacting at a fixed token threshold (the standard approach, typically at 85% of available context), Deep Agents now exposes a tool that lets the agent trigger compression itself.
The reasoning is straightforward. There are good and bad times to compact context:
- Bad: mid-refactor, when the agent needs recent details to make correct edits
- Good: after finishing a deliverable, before starting a new task, or after extracting a conclusion from a large research pass
By giving the model control over when to compress, the system avoids situations where a fixed threshold triggers compaction at the worst possible moment. The compression retains recent messages (10% of available context) and summarizes everything before that point.
This follows what LangChain calls "the bitter lesson" — let the model handle more of its own operational decisions rather than hardcoding harness behavior.
Subagents and context isolation
Deep Agents includes a built-in task tool for spawning subagents with isolated context. The main agent can delegate specific subtasks — say, researching a single API, writing a test file, or summarizing a document — to a subagent that starts with a clean context window.
This addresses a common failure mode. When a single agent thread accumulates multiple objectives, tool outputs, and temporary decisions, output quality drops. The model loses track of what it was doing. Subagent isolation keeps the main thread clean while allowing deeper work on specific subtasks.
The pattern is similar to how OpenClaw, Codex CLI, and other agent harnesses handle delegation, but Deep Agents bakes it into the standard runtime rather than leaving it to application developers.
Long-term memory across conversations
Deep Agents supports persistent memory through LangGraph's Memory Store. This allows the agent to save and retrieve information from previous conversations — user preferences, project-specific context, or decisions made in earlier sessions.
This is a layer above the filesystem-based context management. The filesystem handles within-session state. Memory Store handles cross-session persistence. Together, they give the agent both working memory and long-term recall.
How to get started
The setup is minimal. Install deepagents plus any tool providers you need:
pip install -qU deepagents tavily-python
from deepagents import create_deep_agent
def search_web(query: str) -> str:
"""Search the web for information."""
from tavily import TavilyClient
client = TavilyClient()
return client.search(query)["results"]
agent = create_deep_agent(
model="anthropic:claude-opus-4",
tools=[search_web],
system_prompt="You are a research assistant."
)
result = agent.invoke({"messages": [{"role": "user", "content": "Research the latest AI agent frameworks"}]})
For autonomous context compression, add the summarization middleware:
from deepagents.middleware.summarization import create_summarization_tool_middleware
from deepagents.backends import StateBackend
agent = create_deep_agent(
model="anthropic:claude-opus-4",
middleware=[
create_summarization_tool_middleware("anthropic:claude-opus-4", StateBackend),
],
)
How Deep Agents compares to other agent frameworks
| Feature | Deep Agents | OpenClaw | AutoGen | CrewAI |
|---|---|---|---|---|
| Built-in planning | Yes (write_todos) | Via skills | Manual | Task decomposition |
| Filesystem context | Yes (multiple backends) | Yes (workspace) | No | No |
| Subagent isolation | Yes (task tool) | Yes (sessions_spawn) | Yes (agents) | Yes (crews) |
| Context compression | Autonomous | Auto-compaction | Manual | No |
| Long-term memory | LangGraph Memory Store | SOUL.md + files | Manual | Limited |
| Runtime | LangGraph | Node.js daemon | Python | Python |
| Deployment | LangGraph Cloud | Self-hosted | Self-hosted | Self-hosted |
Who should use Deep Agents
Deep Agents is built for developers who already use or are considering LangChain and need agents that handle tasks lasting more than a few tool calls. Specific use cases include:
- Research automation: tasks that require multiple searches, cross-referencing sources, and producing structured output
- Code generation: multi-file projects where the agent needs to track dependencies across files
- Data analysis: iterative exploration where each step depends on findings from the previous one
- Document processing: long documents that exceed context window limits and need to be processed in chunks
If your agent tasks complete in under five tool calls, simpler LangChain agents or direct API calls are probably sufficient. Deep Agents adds value when the task is complex enough that planning, context offloading, and delegation make a measurable difference.
Conclusion
Deep Agents is a structured runtime from LangChain for multi-step AI agents, released March 15, 2026. It includes built-in planning (write_todos), filesystem-based context management, and subagent delegation. Autonomous context compression lets the agent decide when to compact its own context window. The system runs on LangGraph and returns a standard CompiledStateGraph, so existing LangGraph tooling works. Persistent memory across conversations is supported through LangGraph's Memory Store. Deep Agents is best suited for tasks that require more than five tool calls and benefit from planning and context isolation.
Key Takeaways
- LangChain released Deep Agents on March 15, 2026, as
Conclusion
Deep Agents is a structured runtime from LangChain for multi-step AI agents, released March 15, 2026. It includes built-in planning (write_todos), filesystem-based context management, and subagent delegation. Autonomous context compression lets the agent decide when to compact its own context window. The system runs on LangGraph and returns a standard CompiledStateGraph, so existing LangGraph tooling works. Persistent memory across conversations is supported through LangGraph's Memory Store. Deep Agents is best suited for tasks that require more than five tool calls and benefit from planning and context isolation.
Frequently Asked Questions
What are LangChain Deep Agents and what problem do they solve?
LangChain Deep Agents are a structured runtime built on LangGraph designed to give AI agents built-in planning, filesystem-based context management, and subagent delegation. They address the common failure point of most agent frameworks when tasks require many steps and tool calls, preventing agents from degrading over long, complex workflows.
How do Deep Agents improve planning for multi-step tasks?
Deep Agents include a `write_todos` planning tool that allows the agent to break down complex tasks into discrete steps, track progress, and update its plan dynamically. This prevents the agent from improvising each step and ensures a more structured, goal-oriented execution for tasks like research, coding, or analysis.
How do Deep Agents manage context to prevent overflow?
Deep Agents tackle context window overflow by using filesystem tools. Instead of keeping all information in the active prompt, the agent writes large outputs (like generated code, research notes, or reports) to files and retrieves them only when needed. This reduces prompt-window pressure and keeps the working context relevant and manageable.
What are the core components and tools included with Deep Agents?
The library ships with several core components, including a `write_todos` planning tool, comprehensive filesystem tools (`read_file`, `write_file`, `edit_file`, `ls`, `glob`, `grep`), sandboxed shell access via `execute`, a `task` tool for spawning subagents, and auto-summarization for context management.
Is Deep Agents a new abstraction layer separate from LangGraph?
No, Deep Agents is not a separate abstraction layer. Calling `create_deep_agent(...)` returns a `CompiledStateGraph`, which is a standard LangGraph object. This means it runs on the same runtime, supports streaming, LangGraph Studio, and checkpointers out of the box, integrating seamlessly with existing LangGraph workflows.
Sources
Written by
Optijara