Deep Agents Setup and Configuration
Deep Agents are an agent harness on top of LangChain + LangGraph with built-in planning, filesystem context management, and subagent delegation.
Use This Skill When
- You need a Deep Agent quickly (Python or JavaScript).
- You need subagents, filesystem-backed context, planning (
write_todos), or long-term memory patterns.
- You need migration guidance from older
create_react_agent flows.
- You need to scaffold a starter project with repository scripts.
- You need to statically validate an
agent.py / agent.js / agent.ts config.
- You need safety checks before open-sourcing Deep Agents examples/templates.
Tooling In This Skill
scripts/init_deep_agent_project.py: scaffolds Python/JS projects with templates.
scripts/validate_deep_agent_config.py: static checks for Deep Agent config quality.
references/deep-agents-reference.md: detailed API, middleware, backends, migration, troubleshooting.
assets/templates/deep-agent-simple/: minimal Python starter template.
assets/examples/basic-deep-agent/: richer Python example.
Recommended Workflow
- Decide if Deep Agents is the right abstraction.
- Scaffold with
init_deep_agent_project.py (Python or JS).
- Customize tools, prompt, backend, subagents, and persistence.
- Run
validate_deep_agent_config.py.
- Use
references/deep-agents-reference.md for advanced configuration.
- Run the generated project and verify traces/behavior.
Choose The Right Abstraction
| Need |
Deep Agents |
LangChain create_agent |
LangGraph |
| Built-in planning/filesystem/subagents |
✅ Best fit |
⚠️ Manual middleware setup |
❌ Manual graph design |
| Fast path for complex multi-step tasks |
✅ |
⚠️ |
⚠️ |
| Fully custom graph topology |
❌ |
❌ |
✅ Best fit |
| Minimal/simple agent (1-3 steps) |
⚠️ Overhead |
✅ Best fit |
⚠️ |
Initialize A Project
Use repo-local scripts and prefer uv run.
# Python simple template
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template simple --path skills/
# Python with subagents
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template with-subagents --path skills/
# Python CLI-config template (memory/checkpointer toggles)
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template cli-config --path skills/
# JavaScript template
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language javascript --template simple --path skills/
Templates currently supported by the script:
simple
with-subagents
cli-config
Generated outputs include:
agent.py or agent.js
tools/example_tools.py or tools/example_tools.js
.env.example
README.md
.gitignore
pyproject.toml (Python) or package.json (JavaScript)
Validate Agent Configuration
Run static validation before shipping examples/templates:
uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.py
uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.js
uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.ts
Validator behavior:
- Errors on missing agent calls or invalid file types.
- Warns on risky/weak configs (missing prompt, odd backend usage, deprecated models).
- Supports dynamic config patterns (
create_deep_agent(**kwargs), createDeepAgent(config)), with warning that some static checks are skipped.
- Validates HITL style:
interrupt_on / interruptOn should be mapping/object, and requires checkpointer.
Current Deep Agents Defaults (Verified)
Default middleware includes:
TodoListMiddleware
FilesystemMiddleware
SubAgentMiddleware
SummarizationMiddleware
AnthropicPromptCachingMiddleware
PatchToolCallsMiddleware
Conditionally added middleware:
MemoryMiddleware when memory is set
SkillsMiddleware when skills is set
HumanInTheLoopMiddleware when interrupt_on / interruptOn is set
Core Configuration Patterns
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929", # string or model object
tools=[...],
system_prompt="...",
subagents=[...], # optional delegation specialists
middleware=[...], # optional custom middleware
store=store, # needed for StoreBackend patterns
backend=backend_factory, # State/Store/Filesystem/Composite
checkpointer=checkpointer # required for HITL interrupts
)
Backend guidance:
StateBackend (default): thread-scoped, ephemeral.
StoreBackend: persistent files via LangGraph store (requires store=).
CompositeBackend: route prefixes (common /memories/ -> StoreBackend).
FilesystemBackend: direct disk access; use carefully, prefer virtual_mode=True with root_dir.
HITL And Persistence
If using human approval interrupts:
- Python: use
interrupt_on={...}
- JavaScript: use
interruptOn={...}
- Always provide a checkpointer (
InMemorySaver, MemorySaver, Sqlite/Postgres saver, etc.)
Migration Guidance
langgraph.prebuilt.create_react_agent is deprecated in LangGraph v1.
- For standard agents, prefer
langchain.agents.create_agent.
- For harness capabilities (planning/filesystem/subagents), use
deepagents.create_deep_agent / createDeepAgent.
Versioning Note
deepagents is currently a pre-1.0 package, so minor-version upgrades may include API changes.
- Re-validate generated templates and examples when bumping
deepagents versions.
Open-Source Safety Checklist
Before publishing this skill:
- Ensure no real secrets are committed (
.env.example must stay placeholder-only).
- Remove generated artifacts like
__pycache__/ and *.pyc from skill folders.
- Avoid absolute local paths in code/examples.
- Keep provider credentials in environment variables only.
- Re-run validator on all shipped
agent.py / agent.js templates.
Troubleshooting Quick Hits
- Model/tool-call errors: verify tool-calling model and provider credentials.
- Files not persisting: confirm
StoreBackend route + store= wiring.
- HITL not interrupting: verify interrupt mapping/object and checkpointer.
- Too much overhead for simple tasks: use
create_agent or plain LangGraph.
Resources
1---2name: deepagents-setup-configuration3description: Initialize, validate, and troubleshoot Deep Agents projects in Python or JavaScript using the `deepagents` package. Use when users need to create agents with built-in planning/filesystem/subagents, configure middleware/backends/checkpointing/HITL, migrate from `create_react_agent` or `create_agent`, scaffold projects with repo scripts, validate agent config files, and confirm compatibility with current LangChain/LangGraph/LangSmith docs.4---5
6# Deep Agents Setup and Configuration
7
8Deep Agents are an agent harness on top of LangChain + LangGraph with built-in planning, filesystem context management, and subagent delegation.
9
10## Use This Skill When
11
12- You need a Deep Agent quickly (Python or JavaScript).
13- You need subagents, filesystem-backed context, planning (`write_todos`), or long-term memory patterns.
14- You need migration guidance from older `create_react_agent` flows.
15- You need to scaffold a starter project with repository scripts.
16- You need to statically validate an `agent.py` / `agent.js` / `agent.ts` config.
17- You need safety checks before open-sourcing Deep Agents examples/templates.
18
19## Tooling In This Skill
20
21- `scripts/init_deep_agent_project.py`: scaffolds Python/JS projects with templates.
22- `scripts/validate_deep_agent_config.py`: static checks for Deep Agent config quality.
23- `references/deep-agents-reference.md`: detailed API, middleware, backends, migration, troubleshooting.
24- `assets/templates/deep-agent-simple/`: minimal Python starter template.
25- `assets/examples/basic-deep-agent/`: richer Python example.
26
27## Recommended Workflow
28
291. Decide if Deep Agents is the right abstraction.
302. Scaffold with `init_deep_agent_project.py` (Python or JS).
313. Customize tools, prompt, backend, subagents, and persistence.
324. Run `validate_deep_agent_config.py`.
335. Use `references/deep-agents-reference.md` for advanced configuration.
346. Run the generated project and verify traces/behavior.
35
36## Choose The Right Abstraction
37
38| Need | Deep Agents | LangChain `create_agent` | LangGraph |
39|------|-------------|--------------------------|-----------|
40| Built-in planning/filesystem/subagents | ✅ Best fit | ⚠️ Manual middleware setup | ❌ Manual graph design |
41| Fast path for complex multi-step tasks | ✅ | ⚠️ | ⚠️ |
42| Fully custom graph topology | ❌ | ❌ | ✅ Best fit |
43| Minimal/simple agent (1-3 steps) | ⚠️ Overhead | ✅ Best fit | ⚠️ |
44
45## Initialize A Project
46
47Use repo-local scripts and prefer `uv run`.
48
49```bash
50# Python simple template
51uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template simple --path skills/
52
53# Python with subagents
54uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template with-subagents --path skills/
55
56# Python CLI-config template (memory/checkpointer toggles)
57uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template cli-config --path skills/
58
59# JavaScript template
60uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language javascript --template simple --path skills/
61```
62
63Templates currently supported by the script:
64- `simple`
65- `with-subagents`
66- `cli-config`
67
68Generated outputs include:
69- `agent.py` or `agent.js`
70- `tools/example_tools.py` or `tools/example_tools.js`
71- `.env.example`
72- `README.md`
73- `.gitignore`
74- `pyproject.toml` (Python) or `package.json` (JavaScript)
75
76## Validate Agent Configuration
77
78Run static validation before shipping examples/templates:
79
80```bash
81uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.py
82uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.js
83uv run skills/deepagents-setup-configuration/scripts/validate_deep_agent_config.py path/to/agent.ts
84```
85
86Validator behavior:
87- Errors on missing agent calls or invalid file types.
88- Warns on risky/weak configs (missing prompt, odd backend usage, deprecated models).
89- Supports dynamic config patterns (`create_deep_agent(**kwargs)`, `createDeepAgent(config)`), with warning that some static checks are skipped.
90- Validates HITL style: `interrupt_on` / `interruptOn` should be mapping/object, and requires checkpointer.
91
92## Current Deep Agents Defaults (Verified)
93
94Default middleware includes:
951. `TodoListMiddleware`
962. `FilesystemMiddleware`
973. `SubAgentMiddleware`
984. `SummarizationMiddleware`
995. `AnthropicPromptCachingMiddleware`
1006. `PatchToolCallsMiddleware`
101
102Conditionally added middleware:
103- `MemoryMiddleware` when `memory` is set
104- `SkillsMiddleware` when `skills` is set
105- `HumanInTheLoopMiddleware` when `interrupt_on` / `interruptOn` is set
106
107## Core Configuration Patterns
108
109```python
110agent = create_deep_agent(
111 model="anthropic:claude-sonnet-4-5-20250929", # string or model object
112 tools=[...],
113 system_prompt="...",
114 subagents=[...], # optional delegation specialists
115 middleware=[...], # optional custom middleware
116 store=store, # needed for StoreBackend patterns
117 backend=backend_factory, # State/Store/Filesystem/Composite
118 checkpointer=checkpointer # required for HITL interrupts
119)
120```
121
122Backend guidance:
123- `StateBackend` (default): thread-scoped, ephemeral.
124- `StoreBackend`: persistent files via LangGraph store (requires `store=`).
125- `CompositeBackend`: route prefixes (common `/memories/` -> `StoreBackend`).
126- `FilesystemBackend`: direct disk access; use carefully, prefer `virtual_mode=True` with `root_dir`.
127
128## HITL And Persistence
129
130If using human approval interrupts:
131- Python: use `interrupt_on={...}`
132- JavaScript: use `interruptOn={...}`
133- Always provide a checkpointer (`InMemorySaver`, `MemorySaver`, Sqlite/Postgres saver, etc.)
134
135## Migration Guidance
136
137- `langgraph.prebuilt.create_react_agent` is deprecated in LangGraph v1.
138- For standard agents, prefer `langchain.agents.create_agent`.
139- For harness capabilities (planning/filesystem/subagents), use `deepagents.create_deep_agent` / `createDeepAgent`.
140
141## Versioning Note
142
143- `deepagents` is currently a pre-1.0 package, so minor-version upgrades may include API changes.
144- Re-validate generated templates and examples when bumping `deepagents` versions.
145
146## Open-Source Safety Checklist
147
148Before publishing this skill:
149- Ensure no real secrets are committed (`.env.example` must stay placeholder-only).
150- Remove generated artifacts like `__pycache__/` and `*.pyc` from skill folders.
151- Avoid absolute local paths in code/examples.
152- Keep provider credentials in environment variables only.
153- Re-run validator on all shipped `agent.py` / `agent.js` templates.
154
155## Troubleshooting Quick Hits
156
157- Model/tool-call errors: verify tool-calling model and provider credentials.
158- Files not persisting: confirm `StoreBackend` route + `store=` wiring.
159- HITL not interrupting: verify interrupt mapping/object and checkpointer.
160- Too much overhead for simple tasks: use `create_agent` or plain LangGraph.
161
162## Resources
163
164- `references/deep-agents-reference.md` for detailed API and migration patterns.
165- `assets/templates/deep-agent-simple/` for minimal template files.
166- `assets/examples/basic-deep-agent/` for a fuller runnable example.
167- Python docs: https://docs.langchain.com/oss/python/deepagents/overview
168- JavaScript docs: https://docs.langchain.com/oss/javascript/deepagents/overview
169- LangGraph v1 migration: https://docs.langchain.com/oss/python/migrate/langgraph-v1