I have recently been learning about deep agents. Before studying, I hope to get a guiding answer. What is the difference between deep agents and ordinary agents? I would be very grateful for a reply.
in general, create_agent is a straightforward mode-and-tools loop. The LLM decides which tols to call, executes them, reads the results and repeats until it’s . That’s it.
And create_deep_agent wraps that same core loop but adds some flavor to it - five build-in capabilities on top:
- planning
- filesystem access
- subagent delegation
- automatic context management
- long-term memory
1. Planning (task decomposition)
Ordinary agents have no built-in planning. They react to the user’s request and call tools immediately, one at a time, without an explicit plan.
Deep agents include a built-in write_todos tool (via TodoListMiddleware) that allows the agent to break complex tasks into discrete, trackable steps:
# The agent can create structured plans like:
write_todos([
{"id": "1", "task": "Research LangGraph architecture", "status": "in_progress"},
{"id": "2", "task": "Compare with LangChain agents", "status": "pending"},
{"id": "3", "task": "Write summary document", "status": "pending"},
])
The agent tracks task status (pending → in_progress → completed), which helps it stay organized during multi-step work.
2. Filesystem access (context offloading)
Ordinary agents keep all information in the conversation context window. When results are large, this fills up the context and degrades performance.
Deep agents come with built-in file tools - ls, read_file, write_file, edit_file, glob, grep, and optionally execute (for shell commands). These allow the agent to offload large content to a filesystem instead of keeping everything in memory.
The key innovation is pluggable backends - the “filesystem” isn’t necessarily a real disk:
| Backend | Description |
|---|---|
StateBackend |
Ephemeral, in-agent-state storage (default) |
FilesystemBackend |
Persistent local disk |
StoreBackend |
Persistent LangGraph Store (cross-thread) |
CompositeBackend |
Hybrid approaches |
| Sandbox backends | Isolated execution environments (Modal, Daytona, etc.) |
3. Subagent spawning (task delegation)
Ordinary agents run as a single agent. If you want parallelism or task isolation, you have to build it yourself with custom LangGraph graphs.
Deep agents include a built-in task tool (via SubAgentMiddleware) that spawns isolated subagents. Each subagent gets:
- Its own isolated context window (doesn’t pollute the main agent’s context)
- Its own model (can be different from the main agent)
- Its own tools and middleware stack
- A focused system prompt for its specific task
The main agent only receives the subagent’s final result as a single message - all intermediate steps stay isolated. Subagents can also run in parallel for independent tasks.
A built-in “general-purpose” subagent is always included automatically.
4. Context management (long conversations)
Ordinary agents have no mechanism to handle context window overflow. Long conversations simply hit token limits and fail.
Deep agents include automatic context management via multiple middleware:
SummarizationMiddleware: When the conversation approaches the token limit, it automatically summarizes older messages using the LLM and replaces them with a compact summary. The agent can also manually trigger this with thecompact_conversationtool.MemoryMiddleware: Loads persistentAGENTS.mdfiles into the system prompt - similar to project-level documentation that persists across conversations.SkillsMiddleware: Progressive disclosure of agent skills (YAML+Markdown files loaded from configurable paths).
5. Long-term memory (cross-conversation learning)
This is a critical capability that deserves its own section because it fundamentally changes how agents interact over time.
Ordinary agents are stateless across conversations. Each new conversation starts from scratch - the agent has no recollection of previous interactions, user preferences, or lessons learned.
Deep agents provide a three-tier memory system that enables persistent, cross-conversation learning:
- Tier 1: session memory (ephemeral)
Using StateBackend (the default), files written by the agent persist within a single conversation thread but are lost when the thread ends. This is useful for scratch work during a task.
- Tier 2: initial context (AGENTS.md)
MemoryMiddleware loads AGENTS.md files into the system prompt at agent startup. These are static, project-level instructions - think of them as the agent’s “briefing documents”:
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
memory=[
"~/.deepagents/AGENTS.md", # Global user preferences
"./.deepagents/AGENTS.md", # Project-specific context
],
)
- Tier 3: persistent long-term memory (cross-thread)
This is the most powerful tier. By using StoreBackend (backed by LangGraph’s BaseStore) or CompositeBackend, the agent can write learnings that persist across all future conversations.
The key insight: the agent learns by calling edit_file to update its own memory files. These updates are stored in LangGraph’s persistent Store and are available in every future thread.
from deepagents import create_deep_agent
from deepagents.backends.composite import CompositeBackend
from deepagents.backends.state import StateBackend
from deepagents.backends.store import StoreBackend
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
tools=[my_tools],
# CompositeBackend routes paths to different backends:
backend=CompositeBackend(
default=StateBackend, # Temporary files → ephemeral
routes={
"/memories/": StoreBackend, # Memory files → persistent cross-thread!
},
),
memory=["/memories/AGENTS.md"], # Load persistent memory at startup
store=my_langgraph_store, # Required for StoreBackend
)
With this setup:
- The agent writes to
/memories/AGENTS.mdusingedit_file→ stored persistently viaStoreBackend - On next conversation (different thread),
MemoryMiddlewareloads/memories/AGENTS.mdfrom the Store → the agent remembers everything it learned
Summary
| Feature | Ordinary Agent (create_agent) |
Deep Agent (create_deep_agent) |
|---|---|---|
| Core loop | LLM → tools → LLM → done | Same core loop, enhanced with middleware |
| Planning | None | Built-in write_todos tool |
| File operations | Manual (add your own tools) | Built-in: ls, read_file, write_file, edit_file, glob, grep |
| Shell execution | Manual | Built-in execute (with sandbox backends) |
| Task delegation | Manual (build custom graphs) | Built-in task tool with isolated subagents |
| Context management | None (hits token limits) | Auto-summarization + memory + skills |
| Long-term memory | None (stateless across conversations) | Persistent cross-thread learning via StoreBackend |
| Middleware stack | Minimal, opt-in | 6+ built-in middleware layers |
| Default model | You choose | Claude Sonnet 4.6 |
| System prompt | Your string only | Your string + deep agent base prompt |