AI Agent Assurance for Your Agent Deployments
Agent Assurance Tests How Your Agent Actually Behaves across Workflows, Tools, and Actions to Catch Failures and Vulnerabilities.
npm install -g @testmuai/rook@latest
What Are Deep Agents? How They Plan, Delegate and Get Tested
Deep agents plan with a todo tool, keep context in files and hand work to subagents. See the architecture, LangChain deepagents, failure modes and testing.
OVERVIEW
An HR team asks an agent to summarise the company's leave policies from a stack of source documents. Manus, a general agent of this kind, reports that a typical task takes around 50 tool calls (Manus engineering blog, July 2025). In a plain loop, every one of those results piles into a single context window.
A deep agent handles that work by writing a task list, parking notes in files and handing the reading to a subagent, then reports back with every task ticked. In the scripted run later in this hub, one ticked task, "Write report.md", has no file behind it, which is why testing a deep agent starts with what changed rather than what the plan says. For how this pattern relates to the wider vocabulary, see AI agents vs agentic AI.
Overview
Deep agents are LLM agents that plan long, multi-step tasks and stay on track while carrying them out. They write a task list, keep working context in files and hand side tasks to subagents with their own context windows. LangChain named the pattern in July 2025 and ships it as the deepagents package.
What Are the Parts of a Deep Agent?
- Detailed system prompt: The standing instructions that tell a deep agent when to plan, what to write to files and which work to delegate. Since version 0.7.0, deepagents no longer provides an authored base prompt, so the builder writes this part.
- Planning tool: The write_todos tool records and updates a deep agent's task list and changes nothing outside that list. Planning is not on by default in deepagents: since version 0.7 it is opt-in through TodoListMiddleware.
- Virtual file system: File tools that let a deep agent read, write and edit files over a pluggable backend. By default the files live in the agent's LangGraph state on one thread, shared by the main agent and its subagents as a workspace.
- Subagents: Agents the main deep agent starts through the task tool, each with an isolated context window. A subagent can make dozens of tool calls, and the main agent receives only its final result, which keeps the main context small.
- Testing a deep agent: A ticked task list does not prove the work was done, because it is the agent's own account. Agent Assurance from TestMu AI grades the files changed under declared paths and the tool calls made, not the agent's own account, for agents that change files, call tools and send API requests.
What Are Deep Agents?
Deep agents are LLM agents designed to plan complex tasks and then work on them over long time horizons, using a task list, a file system and subagents to stay on track. Harrison Chase of LangChain coined the term in the LangChain post "Deep Agents" on July 30, 2025, writing that he calls them deep agents "for their ability to dive deep on topics."
That post named four parts: "a planning tool, sub agents, access to a file system, and a detailed prompt." It also released a Python package, deepagents, meant as a general purpose deep agent you customize into your own.
- Current version - deepagents 0.7.44, released December 1, 2026, for Python 3.11 or newer, per its PyPI listing.
- License and reach - MIT, with 31.8k stars and 4.5k forks on the deepagents GitHub repository as of 2026-12-04.
- LangChain's own label - the README calls it "an open source agent harness," the layer of prompts, tools and context handling around a model, which the agent harness hub covers in general terms.
The term names a design pattern. Any agent that plans explicitly, keeps context outside its conversation and delegates to isolated workers fits it, whether or not it was built with LangChain.
Deep Agent vs Shallow Agent: What Changes?
A shallow agent is an LLM that calls tools in a loop until the task looks done, which the LangChain post calls "the simplest form of an agent." "Shallow," in the same post, refers to an agent's inability "to plan over longer time horizons and do more complex tasks." Each tool result goes back into one conversation, so the context grows with every step of tool calling.
The standard shallow design is the ReAct agent, from the 2022 ReAct paper by Yao et al., which interleaves reasoning traces with actions. A deep agent keeps that same loop at its core: the Deep Agents overview says it is "the same core tool calling loop as other agent frameworks." The difference is what surrounds the loop.
| Attribute | Shallow agent | Deep agent |
|---|---|---|
| Core loop | The model picks a tool, reads what comes back and chooses the next call. | The same loop, plus planning, file and delegation tools the model calls like any other tool. |
| Plan | Implicit in the model's reasoning, so the goal drifts as the context grows. | An explicit task list the agent rewrites, keeping the goal near the end of the context. |
| Context | Every tool result stays in one conversation and fills the window. | Large outputs and notes go into files, read back only when needed. |
| Delegation | None: one agent does every side task in the same context. | Subagents run side tasks in isolated contexts and return only a final result. |
| State between steps | The message history only, lost once it leaves the window or is summarised. | The task list, the files and, when configured, memory files loaded on every run. |
| Typical task | A few calls, such as fetching a record and answering one question about it. | Research, coding and analysis that run for dozens of calls and produce files. |
Delegation is the change with the biggest effect on context. LangChain's subagent documentation says the main agent gets "only the final result, not the dozens of tool calls that produced it," so a subagent can work through a stack of documents while the main agent sees one result.
Deep Agents Architecture: The Four Parts
The four parts in the original post still describe deep agents architecture, but the deepagents package now treats them differently. In 0.7.44 the file tools and subagents come built in, planning is opt-in and the system prompt is yours to write. Each part below says what it does and what changed.
The Detailed System Prompt
The system prompt tells the agent how to use everything else: when to plan, what to write to files and which work to delegate. The 2025 post pointed to Claude Code, whose "recreated system prompts are long," as the model to copy, and early deepagents versions shipped a base prompt of their own.
That changed in 0.7.0. The installed package source (deepagents/graph.py, version 0.7.44) marks BASE_AGENT_PROMPT as deprecated in 0.7.0 and due for removal in 0.9.0, and states that Deep Agents "no longer provides an authored base prompt." In the scripted run below, a 37-character system prompt reached the model as 1,409 characters in 2 text blocks: the prompt as written plus the planning guidance that the todo middleware adds.
Write the delegation rules, file conventions and stopping conditions yourself, and review that prompt like code.
The Planning Tool and write_todos
The planning tool lets the agent write and update a task list with a status on each item, and Harrison Chase was candid about it in the original post: "this doesn't do anything! It's basically a no-op," and its purpose is "context engineering strategy to keep the agent on track." Rewriting the list puts the plan back at the end of the context, near the newest messages; the guide to context engineering covers the wider practice.
Manus describes the same trick: by rewriting its todo list, the agent is "reciting its objectives into the end of the context." In deepagents, the Deep Agents overview notes that "Starting in v0.7 task planning is opt-in only," enabled by passing TodoListMiddleware through the middleware argument, which adds the write_todos tool.
The Virtual File System
The file system gives the agent somewhere to put context it does not want in the conversation: search results, drafts, notes and outputs. The original post adds that it "acts as a shared workspace for all agents (and sub agents) to collaborate on." The default tools are ls, read_file, write_file, edit_file, glob and grep, and delete needs deepagents>=0.7, per the Deep Agents overview.
Where those files live depends on the backend. The Deep Agents backends documentation describes several, including these four:
| Backend | Where files live | Scope | What to watch |
|---|---|---|---|
| StateBackend (default) | In LangGraph state, with nothing written to disk. | One thread: files persist across turns but not into a new thread. | Outside tools see these files only if your code returns them. |
| FilesystemBackend | Real files under a configurable root directory. | Every thread and run that points at that directory. | Its default mode is not a security boundary, even with a root directory set; see the file clobbering section below. |
| StoreBackend | A LangGraph store, described as cross-thread durable storage. | Across threads and conversations. | Durable notes can carry a bad instruction from one run into later ones. |
| CompositeBackend | Different backends chosen by path prefix. | Per prefix, mixing thread-scoped and durable files. | A test must know which prefix maps to which backend. |
Long-lived instructions use a separate mechanism: AGENTS.md files passed through the memory parameter, which the overview says "are always loaded," unlike skills. For memory types and stores beyond files, see the hub on AI agent memory.
Subagents and the task Tool
The main agent starts a subagent by calling the built-in task tool, which the overview says creates "ephemeral subagents." By default each call creates a new agent instance with its own context (mode: "isolated"). If you define no subagent named general-purpose, deepagents adds a synchronous one automatically.
- name - required, a unique identifier the main agent uses to pick the subagent.
- description - required; the subagent docs say the main agent "uses this to decide when to delegate," so it should be "specific and action-oriented."
- tools - inherited from the main agent unless you list a narrower set.
- model - overrides the main agent's model for that subagent.
The subagent docs give the reason subagents exist: "Subagents solve the context bloat problem." Forked subagents need deepagents>=0.7.13 and are still marked beta in those docs.
LangChain Deep Agents: What the deepagents Package Ships
LangChain Deep Agents is the deepagents package: one function, create_deep_agent, that returns a ready agent with the file tools, the task tool and a default backend. PyPI summarises it as an "extensible agent harness with a built-in filesystem and context management." Install it with pip or uv (Python 3.11 or newer); the JavaScript twin installs with npm install deepagents langchain @langchain/core.
pip install deepagents
# or, with uv
uv add deepagentsLangChain's post "Deep Agents vs LangChain vs LangGraph" (Sydney Runkle, August 6, 2026) places it in the stack: "LangGraph is an agent runtime, LangChain is an agent framework, and Deep Agents is an agent harness." The same post says Deep Agents "is actually just the core LangChain agent plus a bunch of middleware," so LangGraph deep agents and LangChain deep agents are one thing seen from two layers. See LangChain vs LangGraph for those two layers.
- Context management - the README lists summarising long threads and offloading tool outputs to disk.
- Human-in-the-loop - approve, edit or reject tool calls before they run, built on LangGraph interrupts.
- Tools - your own functions or the tools of any MCP server.
- Coding agent - a pre-built coding agent that runs in your terminal.
Older tutorials often skip the model argument, but the package source says relying on the default model (model=None) is deprecated since 0.5.3 and goes away in 1.0.0, so construct your model explicitly.
LangChain's comparison page places deepagents next to the Claude Agent SDK: "Both are harnesses for building custom agents." For the wider field, see agentic AI frameworks.
A Deep Agent Run With a Scripted Model
To see what the package itself does, a script was run on 2026-12-04 with deepagents 0.7.44, langgraph 1.2.25 and Python 3.14.6 on Windows. The model is a scripted fake (LangChain's GenericFakeChatModel, extended to accept tool binding) that replays eight messages, so no API key or model call is involved. The tools, file system and subagent are the package's own.
The last todo update was scripted on purpose to mark "Write report.md" completed without writing the file. The run shows how the package responds to that; what a real model would decide is outside its scope. Excerpt (re-wrapped to fit the page; the full script prints the counts below):
# deepagents 0.7.44, scripted model, no API key
# ScriptedModel: a GenericFakeChatModel that
# accepts bind_tools and replays these messages.
script = [
# main agent: plan
call("write_todos", todos=[
{"content": "Write outline.md",
"status": "in_progress"},
{"content": "Delegate findings",
"status": "pending"},
{"content": "Write report.md",
"status": "pending"},
]),
# main agent: write a file
call("write_file", file_path="/research/outline.md",
content=PLAN),
# main agent: delegate to the general-purpose subagent
call("task", subagent_type="general-purpose",
description="Read /research/outline.md, write "
"findings to /research/findings.md"),
# subagent turns
call("read_file", file_path="/research/outline.md"),
call("write_file", file_path="/research/findings.md",
content=SUMMARY),
AIMessage(content="Findings written to "
"/research/findings.md"),
# main agent: tick every todo,
# including one never done
call("write_todos", todos=[
{"content": "Write outline.md",
"status": "completed"},
{"content": "Delegate findings",
"status": "completed"},
{"content": "Write report.md",
"status": "completed"},
]),
AIMessage(content="All three tasks are done."),
]
model = ScriptedModel(messages=iter(script))
agent = create_deep_agent(
model=model,
system_prompt="You are a careful research assistant.",
middleware=[TodoListMiddleware()],
)
# subgraphs=True also streams the subagent's own steps
for ns, mode, data in agent.stream(
{"messages": [{
"role": "user",
"content": "Summarise our leave policies."}]},
{"recursion_limit": 50},
stream_mode=["updates", "values"],
subgraphs=True,
):
... # collect tool results per namespaceThe printed output, verbatim:
deepagents 0.7.44, langgraph 1.2.25
----------------------------------------------------------
System prompt we wrote: 37 characters
System prompt the model got: 1,409 characters
in 2 text blocks
----------------------------------------------------------
Tools offered to the main agent's model:
ls, read_file, write_file, edit_file
delete, glob, grep, task
write_todos
----------------------------------------------------------
Tool calls, in order:
write_todos: Updated todo list to [{'content': 'Write ou
write_file: Updated file /research/outline.md
task: Findings written to /research/findings.md
write_todos: Updated todo list to [{'content': 'Write ou
----------------------------------------------------------
Tool results in the main transcript: 4
Tool results inside the subagent: 2
subagent ran read_file
subagent ran write_file
----------------------------------------------------------
Todo list (the agent's own account):
[completed] Write outline.md
[completed] Delegate findings
[completed] Write report.md
----------------------------------------------------------
Virtual file system (2 files):
/research/findings.md (1 line)
/research/outline.md (3 lines)
----------------------------------------------------------
Check: each completed todo against the files
Write outline.md: file found
Write report.md: NO FILE
Final message: All three tasks are done.- The prompt is mostly not yours - of the 1,409 characters the model received, 37 were the prompt in the script; the rest is the planning guidance the todo middleware adds. The package source confirms 0.7 ships no base prompt of its own.
- No shell by default - the model was offered nine tools and
executewas not among them, because the default StateBackend is not a sandbox. - Subagent work is hidden from the parent - the main transcript holds 4 tool results, and the subagent's
read_fileandwrite_fileare not among them. The script saw them only because it streamed the subagent's own steps (subgraphs=True), yet its file landed in the shared file system. - The plan is not evidence - the todo list reports three completed steps, the file system holds two files, and the agent's last message says all three tasks are done. write_todos accepted the update without complaint.
Deep Agent Examples: Claude Code, Deep Research and Manus
The LangChain post built the term from three applications that, in its words, "have gotten around this limitation" of shallow loops: OpenAI's deep research, Manus and Claude Code. Each shows a different part of the pattern in its own documentation.
| Example | What its maker says | Part of the pattern it shows |
|---|---|---|
| Claude Code | Each subagent runs in its own context window with a custom system prompt, its own tool access and your permission rules. | Subagents, a long system prompt and a to-do list; deepagents was inspired by it. |
| OpenAI deep research | Multi-step research on the internet, done in tens of minutes instead of the many hours a person needs. | Long-horizon work: many searches and reads planned toward one report. |
| Manus | Treats the file system as the ultimate context and keeps rewriting a todo list during a task. | Files as memory and a recited plan, which the file and planning tools copy. |
In Claude Code, project subagents live in .claude/agents/, per its subagent documentation; the guide to Claude Code subagents covers their frontmatter and delegation rules.
OpenAI introduced deep research on February 2, 2025, about six months before LangChain named the pattern it helped to define.
When Should You Use a Deep Agent?
Use a deep agent when a task is open-ended, needs many tool calls and produces something large enough to need files, such as a research report or a code change. Use a plain tool loop for short tasks, and a fixed workflow when the steps are known in advance.
LangChain's comparison post draws the same line: "Reach for Deep Agents when you want a capable agent out of the box." For the other case it says: "Reach for LangGraph when your agent doesn't fit a standard loop, or you need to mix deterministic and agentic steps in the same workflow."
| Situation | Better fit | Why |
|---|---|---|
| One lookup or one action, answered in a few calls | Plain tool loop | Planning and delegation add calls with nothing to plan; the subagent docs list single-step tasks as a case where subagents do not pay off. |
| Known steps in a fixed order, such as extract, validate, then file a record | Fixed workflow | Deterministic steps are easier to test than a model choosing the order each time. |
| Open-ended research or coding with dozens of calls and file outputs | Deep agent | The task list holds the goal, files hold the bulk and subagents isolate side work. |
| A long task whose steps all depend on the same intermediate details | Deep agent without subagents | Isolated subagents would lose those details, a reason not to delegate in the subagent docs. |
The LangChain team's October 2025 post "Doubling down on Deep Agents" called Deep Agents "great for building more autonomous, long running agents," and that is the boundary to keep. For fixed pipelines, see agentic workflows; for systems of peer agents with their own roles, see multi-agent AI systems.
Deep Agent Failure Modes
Each part fixes a shallow-loop problem and adds one of its own: the context still grows, subagents multiply hidden calls, files can be overwritten or poisoned, and the todo list can claim work that never happened. Each section below names the failure and a way to catch or limit it.
Context Bloat and Context Rot
Long tasks still fill the main context with plans, file reads and subagent results. Anthropic's guide to effective context engineering for AI agents describes the effect: as context grows, the model's ability to recall information from it decreases.
The fixes are the ones deep agents already carry: offload large tool outputs to files, delegate reading-heavy side tasks and summarise long threads. Anthropic calls that last step compaction, summarising a conversation nearing the context window limit.
Runaway and Overlapping Subagents
Subagents multiply calls you cannot see from the main transcript, as the run's single task result showed. At dozens of calls per subagent, cost and side effects grow out of view. Nesting widens the spread: the Claude Code subagent documentation cited above lets a subagent start its own, up to three layers below the main conversation by default.
- Vague descriptions - the main agent picks a subagent by its description, so two broad ones invite duplicate reading.
- Inherited tools - subagents inherit the main agent's tools unless you list fewer, and those can include
write_fileanddelete. - No turn limit - set
recursion_limiton every run (the run used 50) and give each subagent a narrow tool list.
File Clobbering and Unsafe File Backends
The file system is shared, and write_file will "Create a new file, or overwrite an existing one," per the Deep Agents overview. Two subagents told to write findings to the same path will overwrite each other, and the last writer wins without an error. It is a design risk with no published incident, and it is cheap to prevent: give each subagent its own path prefix.
The stakes rise with a disk-backed backend. The backends documentation says FilesystemBackend "grants agents direct filesystem read/write access," and that its default, virtual_mode=False, "provides no security even with root_dir set." Run such agents in a disposable directory or a sandbox backend, and set the permission rules the Deep Agents overview describes for the paths that matter.
An agent that edits files through the filesystem MCP server has a different limit: that server works only inside its allowed directories.
Todo Items Marked Completed Without the Work Done
Because the planning tool is a no-op, a status of completed is whatever the model wrote, as the scripted run's missing report.md showed. A real model can make the same claim after a failed write, a skipped step or a subagent that returned early.
Treat the todo list as a log of intentions, and check the matching output before trusting any completed item.
Poisoned Files and Shared Context
A shared workspace spreads bad content as easily as good. OWASP ASI06, Memory and Context Poisoning, warns that "Contaminated context or shared memory spreads between cooperating agents, compounding corruption," and its mitigations include preventing "automatic re-ingestion of an agent's own generated outputs into trusted memory." In a deep agent, a subagent's findings file is that kind of output.
The same files can carry a goal hijack. OWASP ASI01, Agent Goal Hijack, lists "hidden instruction payloads embedded in web pages or documents" among its examples: a page a subagent fetched and summarised into the workspace can redirect the main agent's next task. The hub on indirect prompt injection covers how such payloads are built and caught.
How Do You Test a Deep Agent?
Test a deep agent on what its run changed: the files it wrote, the tools its subagents called and the paths it touched, then compare those with its plan and final message. The run above is the smallest case, a ticked step with no file. The checks below scale that comparison to a real agent.
| Check | Compare | Evidence to collect |
|---|---|---|
| Plan against outputs | Every completed todo against the file, record or call it promised. | The file system after the run, read from the backend (the files key of the final state with StateBackend). |
| Subagent handoff | What the subagent was asked to do against what it did and what it returned. | Subgraph events from the stream; the main transcript holds only the task result. |
| Write scope | Paths written or deleted against the paths your permission rules allow. | A before-and-after diff of the files, plus denied calls. |
| Approval on sensitive calls | Calls you marked for human approval against calls that ran without a pause. | Interrupt events and the decision recorded for each one. |
| Planted instruction | The agent's next actions against its task after it reads a seeded document. | Tool calls made after the read, checked for actions outside the task. |
With the default StateBackend, the files come back in the run's final state under the files key; compare each completed todo with those paths, as the run's last check did. The permission rules in the Deep Agents overview are evaluated top to bottom and the first match wins, so test the rule order with a path that two rules both match. The overview also says permissions "do not apply to sandbox backends," which support arbitrary command execution, so a sandboxed agent needs its limits tested at the sandbox level.
When a check finds no evidence, record it as unverified rather than passed. For LangGraph-specific trajectory tests, see how to test a LangGraph agent; for handoffs between several agents, see multi-agent testing.
Testing a Deep Agent's Files and Subagents With Agent Assurance
A deep agent's todo updates, file writes and subagent calls are actions; its ticked list only reports on them. Agent Assurance from TestMu AI is built for agents that take actions, and its product team puts it this way: "An agent's account of what it did is the weakest evidence available about what it did."
It reaches your agent through a profile, with reviewable hook scripts that send each turn and collect evidence (see profiles and hooks). A deep agent is therefore tested through its own endpoint or command, and the Agent Assurance docs say it works with any agent framework.
For Claude Code-style agents, discovery of the declared agents, subagents, skills and MCP servers is deterministic, followed by the same checks on changed files and tool calls (see the coding agent docs). A subagent you can only reach through the main agent gets tested through the main agent.
Where the agent writes real files under declared paths, the files changed there are evidence. Files kept only in agent state reach the grader only if your hooks return them; without that evidence, the criterion is graded Unable to Verify, neither pass nor fail. Only Pass and Fail results feed the pass rate; Unable to Verify sits outside it.
Rook CLI also generates adversarial scenarios, and one category, hijacking, fits shared-workspace content that tries to pull a subagent off its task; an attack that plants such content runs only when your open hook seeds it. Because a run makes real writes, use a staging copy of every system the agent can change.
The npm route for Rook CLI requires Node.js 20 or later. Neither Homebrew nor the shell installer needs Node (see the install docs), while the skill route, npx @testmuai/rook-skill, asks for Node.js 22 or later. You can try it for 7 days on 10,000 free trial credits; the pricing page for Agent Assurance shows what comes after.
npm install -g @testmuai/rook@latestDecisions to Pin Down Before You Build a Deep Agent
Before writing a line of agent code, decide which backend holds the files, which paths each subagent may write and what evidence will prove each todo item done. Then follow the Agent Assurance quickstart for a first run against a staging copy.
Pin the package version your tests ran against, because it moves fast: the LangChain team announced the 0.2 release with pluggable backends on October 28, 2025, in the "Doubling down on Deep Agents" post quoted above, and the PyPI listing cited earlier shows 0.7.44 on December 1, 2026.
npm install -g @testmuai/rook@latest, or for a full walkthrough of the product.Was this helpful?
Authors

Samyak Goyal
Author · 05 hubs
Samyak Goyal is a Senior Member of Technical Staff at TestMu AI engineering Kane CLI, the command-line tool that runs browser automation from the terminal, where a flow described in natural language executes in a real Chrome browser and returns pass or fail with shareable proof. He is a backend engineer with 4+ years of experience, previously an SDE at Innovaccer, where he built APIs, introduced Kafka, and cut deployment from weeks to hours. Samyak also builds multi-agent systems, skill-orchestration frameworks, and a personal copilot that indexes 200+ microservice repositories.

Sirajuddin Khan
Reviewer
Sirajuddin Khan is Vice President of Product Management at TestMu AI, where he drives the company's agentic AI product strategy, building a suite of autonomous agents that includes Agentic Browsers and Agentic Visual Testing and shifting the unit of work from test execution to autonomous outcomes. One of the company's earliest product leaders, he has owned the roadmap for the high-performance execution cloud and grew the cross-browser testing products from early adoption to market leadership. He brings over a decade of experience across SaaS, B2B, and eCommerce, with earlier product roles at Wydr and ShopClues, where his catalog and search work cut delivery SLAs and lifted seller activity. Sirajuddin holds an MBA in Information Technology from Sikkim Manipal University and a B.Tech in Computer Science Engineering from Maharshi Dayanand University.
Deep Agents FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests


