项目概览
| 属性 | 内容 |
|---|---|
| 名称 | deepagents |
| 组织 | langchain-ai |
| 定位 | "The batteries-included agent harness"(开箱即用的智能体框架) |
| 核心基础 | LangChain + LangGraph |
| 许可证 | MIT License |
| 开源状态 | 100% 开源 |
核心功能特性
1. 内置工具集(Batteries Included)
| 类别 | 工具 | 说明 |
|---|---|---|
| 规划 | write_todos |
任务分解与进度跟踪 |
| 文件系统 | read_file, write_file, edit_file, ls, glob, grep |
读写上下文文件 |
| Shell 访问 | execute |
运行命令(带沙箱隔离) |
| 子智能体 | task |
委派工作,隔离上下文窗口 |
2. 智能默认配置
- 预设提示词(Prompts):教导模型有效使用工具
- 上下文管理:自动摘要(对话过长时)、大输出自动保存到文件
快速开始
bash
# 安装
pip install deepagents
# 或
uv add deepagents
python
from deepagents import create_deep_agent
agent = create_deep_agent()
result = agent.invoke({
"messages": [{"role": "user", "content": "Research LangGraph and write a summary"}]
})
自定义配置示例
python
from langchain.chat_models import init_chat_model
agent = create_deep_agent(
model=init_chat_model("openai:gpt-4o"),
tools=[my_custom_tool],
system_prompt="You are a research assistant.",
)
- MCP 支持 :通过
langchain-mcp-adapters实现 - 返回的是已编译的 LangGraph 图,支持流式传输、Studio、检查点等所有 LangGraph 特性
Deep Agents CLI
| 特性 | 说明 |
|---|---|
| 安装方式 | `curl -LsSf https://raw.githubusercontent.com/langchain-ai/deepagents/main/libs/cli/scripts/install.sh |
| 核心功能 | Web 搜索、远程沙箱、持久化记忆、人工介入审批等 |
| 详细文档 | libs/cli/README |
项目统计数据(截至 2026-03-16)
| 指标 | 数值 |
|---|---|
| ⭐ Stars | 12.4k |
| 🍴 Forks | 2k |
| 👁️ Watchers | 80 |
| 📝 Issues | 101 |
| 🔀 Pull Requests | 76 |
| 🏷️ Releases | 70(最新:deepagents==0.4.11,2026-03-14) |
| 👥 Contributors | 91 |
| 🌿 Branches | 444 |
| 🏷️ Tags | 72 |
| 💻 主要语言 | Python 99.5% |
项目结构
deepagents/
├── .github/ # GitHub 配置
├── .vscode/ # IDE 设置(2026-02-03 添加)
├── examples/ # 示例代码
├── libs/ # 核心库代码
├── .gitignore
├── .markdownlint.json # Markdown 格式配置
├── .mcp.json # MCP 配置(2026-03-11 添加参考文档)
├── .pre-commit-config.yaml # 预提交钩子
├── .release-please-manifest.json
├── AGENTS.md # 智能体相关文档
├── LICENSE # MIT 许可证
├── Makefile
├── README.md
├── action.yml # GitHub Action(2026-03-10 新增:支持 skills、memory、安全加固)
├── pr-labeler-consolidation.md
└── release-please-config.json
近期重要提交(2026-03-16):
perf(cli): add textual-speedups for Rust-based layout primitives--- 性能优化ci(infra): add pre-commit hooks for lockfile, extras sync, and version...--- CI 基础设施
设计理念与优势(FAQ)
| 优势 | 说明 |
|---|---|
| 100% 开源 | MIT 许可,完全可扩展 |
| 提供商无关 | 支持任何支持工具调用的 LLM(前沿模型 + 开源模型) |
| 基于 LangGraph | 生产级运行时,支持流式、持久化、检查点 |
| 开箱即用 | 规划、文件访问、子智能体、上下文管理即开即用 |
| 秒级启动 | uv add deepagents 即可运行 |
| 分钟级定制 | 按需添加工具、更换模型、调整提示词 |
安全模型
"Trust the LLM" 模型
- 智能体可以执行其工具允许的任何操作
- 在工具/沙箱层面强制执行边界,而非期望模型自我约束
- 详细安全政策见
security policy
相关资源
| 类型 | 链接 |
|---|---|
| 官方文档 | https://docs.langchain.com/oss/python/deepagents/overview |
| API 参考 | https://reference.langchain.com/python/deepagents/ |
| 社区论坛 | https://forum.langchain.com |
| JS/TS 版本 | deepagents.js |
| 开发工具 | LangSmith |
| 聊天问答 | Chat LangChain |
灵感来源
"This project was primarily inspired by Claude Code, and initially was largely an attempt to see what made Claude Code general purpose, and make it even more so."
关键洞察
-
架构定位 :不是"又一个智能体框架",而是有主见的、生产就绪的 harness( harness = 马具/框架,意为即插即用的基础架构)
-
与 LangGraph 的关系 :
create_deep_agent()返回的是已编译的 LangGraph 图,意味着:- 可无缝使用 LangGraph 生态的所有工具
- 支持可视化(Studio)、持久化、流式等高级特性
-
CLI 与 SDK 的双轨策略:
- SDK(
deepagents包):开发者集成 - CLI:终端用户直接使用,功能更丰富(搜索、沙箱、记忆等)
- SDK(
-
近期发展方向(从提交历史推断):
- 性能优化(Rust-based layout primitives)
- 基础设施完善(pre-commit hooks、IDE 配置)
- GitHub Action 集成(支持 CI/CD 场景的智能体)
- MCP(Model Context Protocol)生态整合