deepagents-setup-configuration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeep Agents Setup and Configuration
Deep Agents 搭建与配置
Deep Agents are an agent harness on top of LangChain + LangGraph with built-in planning, filesystem context management, and subagent delegation.
Deep Agents是基于LangChain + LangGraph构建的Agent封装框架,内置规划、文件系统上下文管理和子代理委托功能。
Use This Skill When
适用场景
- You need a Deep Agent quickly (Python or JavaScript).
- You need subagents, filesystem-backed context, planning (), or long-term memory patterns.
write_todos - You need migration guidance from older flows.
create_react_agent - You need to scaffold a starter project with repository scripts.
- You need to statically validate an /
agent.py/agent.jsconfig.agent.ts - You need safety checks before open-sourcing Deep Agents examples/templates.
- 你需要快速创建Deep Agent(支持Python或JavaScript)。
- 你需要子代理、基于文件系统的上下文、规划()或长期记忆模式。
write_todos - 你需要从旧版流程迁移的指导。
create_react_agent - 你需要通过仓库脚本搭建初始项目框架。
- 你需要静态验证/
agent.py/agent.js配置文件。agent.ts - 你需要在开源Deep Agents示例/模板前进行安全检查。
Tooling In This Skill
本技能包含的工具
- : scaffolds Python/JS projects with templates.
scripts/init_deep_agent_project.py - : static checks for Deep Agent config quality.
scripts/validate_deep_agent_config.py - : detailed API, middleware, backends, migration, troubleshooting.
references/deep-agents-reference.md - : minimal Python starter template.
assets/templates/deep-agent-simple/ - : richer Python example.
assets/examples/basic-deep-agent/
- :通过模板搭建Python/JS项目。
scripts/init_deep_agent_project.py - :对Deep Agent配置进行静态质量检查。
scripts/validate_deep_agent_config.py - :详细的API、中间件、后端、迁移和故障排查文档。
references/deep-agents-reference.md - :极简Python启动模板。
assets/templates/deep-agent-simple/ - :功能更丰富的Python示例。
assets/examples/basic-deep-agent/
Recommended Workflow
推荐工作流程
- Decide if Deep Agents is the right abstraction.
- Scaffold with (Python or JS).
init_deep_agent_project.py - Customize tools, prompt, backend, subagents, and persistence.
- Run .
validate_deep_agent_config.py - Use for advanced configuration.
references/deep-agents-reference.md - Run the generated project and verify traces/behavior.
- 判断Deep Agents是否为合适的抽象方案。
- 使用搭建项目(支持Python或JS)。
init_deep_agent_project.py - 自定义工具、提示词、后端、子代理和持久化设置。
- 运行进行验证。
validate_deep_agent_config.py - 参考进行高级配置。
references/deep-agents-reference.md - 运行生成的项目并验证追踪数据与行为。
Choose The Right Abstraction
选择合适的抽象方案
| Need | Deep Agents | LangChain | 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 | ⚠️ |
| 需求 | Deep Agents | LangChain | LangGraph |
|---|---|---|---|
| 内置规划/文件系统/子代理 | ✅ 最佳选择 | ⚠️ 需手动配置中间件 | ❌ 需手动设计图结构 |
| 复杂多步骤任务的快速实现路径 | ✅ | ⚠️ | ⚠️ |
| 完全自定义的图拓扑结构 | ❌ | ❌ | ✅ 最佳选择 |
| 轻量/简单Agent(1-3步任务) | ⚠️ 存在冗余 | ✅ 最佳选择 | ⚠️ |
Initialize A Project
初始化项目
Use repo-local scripts and prefer .
uv runbash
undefined使用仓库本地脚本,优先使用执行。
uv runbash
undefinedPython simple template
Python简单模板
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template simple --path skills/
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template simple --path skills/
Python with subagents
Python带代理模板
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template with-subagents --path skills/
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)
Python CLI配置模板(支持记忆/检查点开关)
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template cli-config --path skills/
uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language python --template cli-config --path skills/
JavaScript template
JavaScript模板
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)uv run skills/deepagents-setup-configuration/scripts/init_deep_agent_project.py my-agent --language javascript --template simple --path skills/
当前脚本支持的模板:
- `simple`
- `with-subagents`
- `cli-config`
生成的输出文件包括:
- `agent.py`或`agent.js`
- `tools/example_tools.py`或`tools/example_tools.js`
- `.env.example`
- `README.md`
- `.gitignore`
- `pyproject.toml`(Python)或`package.json`(JavaScript)Validate Agent Configuration
验证Agent配置
Run static validation before shipping examples/templates:
bash
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.tsValidator 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)), with warning that some static checks are skipped.createDeepAgent(config) - Validates HITL style: /
interrupt_onshould be mapping/object, and requires checkpointer.interruptOn
在发布示例/模板前运行静态验证:
bash
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验证器行为:
- 当缺少Agent调用或文件类型无效时抛出错误。
- 对风险/弱配置(缺少提示词、异常后端使用、已弃用模型)发出警告。
- 支持动态配置模式(、
create_deep_agent(**kwargs)),但会警告部分静态检查将被跳过。createDeepAgent(config) - 验证HITL风格:/
interrupt_on应为映射/对象,且需要检查点。interruptOn
Current Deep Agents Defaults (Verified)
当前Deep Agents默认配置(已验证)
Default middleware includes:
TodoListMiddlewareFilesystemMiddlewareSubAgentMiddlewareSummarizationMiddlewareAnthropicPromptCachingMiddlewarePatchToolCallsMiddleware
Conditionally added middleware:
- when
MemoryMiddlewareis setmemory - when
SkillsMiddlewareis setskills - when
HumanInTheLoopMiddleware/interrupt_onis setinterruptOn
默认中间件包括:
TodoListMiddlewareFilesystemMiddlewareSubAgentMiddlewareSummarizationMiddlewareAnthropicPromptCachingMiddlewarePatchToolCallsMiddleware
条件添加的中间件:
- 当设置时添加
memoryMemoryMiddleware - 当设置时添加
skillsSkillsMiddleware - 当设置/
interrupt_on时添加interruptOnHumanInTheLoopMiddleware
Core Configuration Patterns
核心配置模式
python
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:
- (default): thread-scoped, ephemeral.
StateBackend - : persistent files via LangGraph store (requires
StoreBackend).store= - : route prefixes (common
CompositeBackend->/memories/).StoreBackend - : direct disk access; use carefully, prefer
FilesystemBackendwithvirtual_mode=True.root_dir
python
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929", # 字符串或模型对象
tools=[...],
system_prompt="...",
subagents=[...], # 可选的委托专用子代理
middleware=[...], # 可选的自定义中间件
store=store, # StoreBackend模式所需
backend=backend_factory, # State/Store/Filesystem/Composite
checkpointer=checkpointer # HITL中断所需
)后端指导:
- (默认):线程作用域,临时存储。
StateBackend - :通过LangGraph store实现持久化文件(需要
StoreBackend参数)。store= - :路由前缀(常见
CompositeBackend->/memories/)。StoreBackend - :直接磁盘访问;谨慎使用,优先启用
FilesystemBackend并设置virtual_mode=True。root_dir
HITL And Persistence
HITL与持久化
If using human approval interrupts:
- Python: use
interrupt_on={...} - JavaScript: use
interruptOn={...} - Always provide a checkpointer (,
InMemorySaver, Sqlite/Postgres saver, etc.)MemorySaver
如果使用人工审核中断:
- Python:使用
interrupt_on={...} - JavaScript:使用
interruptOn={...} - 必须提供检查点(、
InMemorySaver、Sqlite/Postgres存储等)MemorySaver
Migration Guidance
迁移指导
- is deprecated in LangGraph v1.
langgraph.prebuilt.create_react_agent - For standard agents, prefer .
langchain.agents.create_agent - For harness capabilities (planning/filesystem/subagents), use /
deepagents.create_deep_agent.createDeepAgent
- 在LangGraph v1中已弃用。
langgraph.prebuilt.create_react_agent - 对于标准Agent,优先使用。
langchain.agents.create_agent - 对于框架功能(规划/文件系统/子代理),使用/
deepagents.create_deep_agent。createDeepAgent
Versioning Note
版本说明
- is currently a pre-1.0 package, so minor-version upgrades may include API changes.
deepagents - Re-validate generated templates and examples when bumping versions.
deepagents
- 目前是1.0前的预发布包,小版本升级可能包含API变更。
deepagents - 升级版本时,需重新验证生成的模板和示例。
deepagents
Open-Source Safety Checklist
开源安全检查清单
Before publishing this skill:
- Ensure no real secrets are committed (must stay placeholder-only).
.env.example - Remove generated artifacts like and
__pycache__/from skill folders.*.pyc - Avoid absolute local paths in code/examples.
- Keep provider credentials in environment variables only.
- Re-run validator on all shipped /
agent.pytemplates.agent.js
发布本技能前:
- 确保没有提交真实密钥(必须仅保留占位符)。
.env.example - 从技能文件夹中移除生成的产物如和
__pycache__/。*.pyc - 避免在代码/示例中使用绝对本地路径。
- 仅将服务商凭证存储在环境变量中。
- 对所有发布的/
agent.py模板重新运行验证器。agent.js
Troubleshooting Quick Hits
故障排查速览
- Model/tool-call errors: verify tool-calling model and provider credentials.
- Files not persisting: confirm route +
StoreBackendwiring.store= - HITL not interrupting: verify interrupt mapping/object and checkpointer.
- Too much overhead for simple tasks: use or plain LangGraph.
create_agent
- 模型/工具调用错误:验证支持工具调用的模型和服务商凭证。
- 文件未持久化:确认路由和
StoreBackend参数的关联配置。store= - HITL未触发中断:验证中断映射/对象和检查点配置。
- 简单任务存在过多冗余:使用或原生LangGraph。
create_agent
Resources
资源
- for detailed API and migration patterns.
references/deep-agents-reference.md - for minimal template files.
assets/templates/deep-agent-simple/ - for a fuller runnable example.
assets/examples/basic-deep-agent/ - Python docs: https://docs.langchain.com/oss/python/deepagents/overview
- JavaScript docs: https://docs.langchain.com/oss/javascript/deepagents/overview
- LangGraph v1 migration: https://docs.langchain.com/oss/python/migrate/langgraph-v1
- :详细的API和迁移模式文档。
references/deep-agents-reference.md - :极简模板文件。
assets/templates/deep-agent-simple/ - :完整可运行示例。
assets/examples/basic-deep-agent/ - Python文档:https://docs.langchain.com/oss/python/deepagents/overview
- JavaScript文档:https://docs.langchain.com/oss/javascript/deepagents/overview
- LangGraph v1迁移:https://docs.langchain.com/oss/python/migrate/langgraph-v1