framework-selection by langchain-ai/langchain-skills
npx skills add https://github.com/langchain-ai/langchain-skills --skill framework-selection┌─────────────────────────────────────────┐ │ Deep Agents │ ← 最高层级:开箱即用 │ (planning, memory, skills, files) │ ├─────────────────────────────────────────┤ │ LangGraph │ ← 编排层:图、循环、状态 │ (nodes, edges, state, persistence) │ ├─────────────────────────────────────────┤ │ LangChain │ ← 基础层:模型、工具、链 │ (models, tools, prompts, RAG) │ └─────────────────────────────────────────┘
选择更高层级并不会切断你对底层的使用——你可以在 Deep Agents 中使用 LangGraph 图,也可以在两者中使用 LangChain 原语。
此技能应在选择其他技能或编写智能体代码之前,加载到任何项目的顶部。 你选择的框架决定了接下来应该调用哪些其他技能。
按顺序回答以下问题:
| 问题 | 是 → | 否 → |
|---|---|---|
| 任务是否需要将工作分解为子任务、跨长会话管理文件、持久化内存或按需加载技能? | Deep Agents | ↓ |
| 任务是否需要复杂的控制流——循环、动态分支、并行工作器、人在回路或自定义状态? | LangGraph | ↓ |
| 这是一个单一用途的智能体,接收输入、运行工具并返回结果吗? | LangChain (create_agent) | ↓ |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 这是一个纯粹的模型调用、链或检索管道,没有智能体循环吗? | LangChain (LCEL / chain) | — |
最适合:
不适用于:
接下来应调用的技能: langchain-models, langchain-rag, langchain-middleware
最适合:
不适用于:
接下来应调用的技能: langgraph-fundamentals, langgraph-human-in-the-loop, langgraph-persistence
最适合:
不适用于:
中间件 — 内置且可扩展:
Deep Agents 开箱即用,内置了一个中间件层——你只需配置它,而无需实现它。以下中间件已预置;你也可以在其基础上添加自己的中间件:
| 中间件 | 提供功能 | 是否始终启用? |
|---|---|---|
TodoListMiddleware | write_todos 工具——智能体规划并跟踪多步骤任务 | ✓ |
FilesystemMiddleware | ls, read_file, write_file, edit_file, glob, grep 工具 | ✓ |
SubAgentMiddleware | task 工具——将工作委托给命名的子智能体 | ✓ |
SkillsMiddleware | 从技能目录按需加载 SKILL.md 文件 | 可选 |
MemoryMiddleware | 通过 Store 实例实现跨会话的长期记忆 | 可选 |
HumanInTheLoopMiddleware | 在敏感工具调用前中断并请求人工批准 | 可选 |
接下来应调用的技能: deep-agents-core, deep-agents-memory, deep-agents-orchestration
| 场景 | 推荐模式 |
|---|---|
| 主智能体需要规划+内存,但某个子任务需要精确的图控制 | Deep Agents 编排器 → LangGraph 子智能体 |
| 专门的管道(例如 RAG、反思循环)被更广泛的智能体调用 | 将 LangGraph 图包装为工具或子智能体 |
| 高层级协调但特定领域使用低层级图 | Deep Agents + LangGraph 编译图作为子智能体 |
一个已编译的 LangGraph 图可以在 Deep Agents 中注册为子智能体。这意味着你可以构建一个严格控制的 LangGraph 工作流(例如,检索-验证循环),并将其作为命名的子智能体交给 Deep Agents 的 task 工具——Deep Agents 编排器会委托给它,而无需关心其内部的图结构。
LangChain 的工具、链和检索器可以自由地在 LangGraph 节点和 Deep Agents 工具内部使用——它们是各个层级共享的构建块。
| LangChain | LangGraph | Deep Agents
---|---|---|---
控制流 | 固定(工具循环) | 自定义(图) | 托管(中间件)
中间件层 | 仅回调 | ✗ 无 | ✓ 显式,可配置
规划 | ✗ | 手动 | ✓ TodoListMiddleware
文件管理 | ✗ | 手动 | ✓ FilesystemMiddleware
持久化内存 | ✗ | 使用检查点 | ✓ MemoryMiddleware
子智能体委托 | ✗ | 手动 | ✓ SubAgentMiddleware
按需技能 | ✗ | ✗ | ✓ SkillsMiddleware
人在回路 | ✗ | 手动中断 | ✓ HumanInTheLoopMiddleware
自定义图边 | ✗ | ✓ 完全控制 | 有限
设置复杂度 | 低 | 中 | 低
灵活性 | 中 | 高 | 中
中间件是 LangChain(回调)和 Deep Agents(显式中间件层)特有的概念。LangGraph 没有中间件——你将行为直接连接到节点和边。
每周安装量
2.2K
代码仓库
GitHub 星标
423
首次出现
2026年3月4日
安全审计
安装于
claude-code1.9K
codex1.7K
cursor1.7K
github-copilot1.7K
opencode1.7K
gemini-cli1.7K
┌─────────────────────────────────────────┐ │ Deep Agents │ ← highest level: batteries included │ (planning, memory, skills, files) │ ├─────────────────────────────────────────┤ │ LangGraph │ ← orchestration: graphs, loops, state │ (nodes, edges, state, persistence) │ ├─────────────────────────────────────────┤ │ LangChain │ ← foundation: models, tools, chains │ (models, tools, prompts, RAG) │ └─────────────────────────────────────────┘
Picking a higher layer does not cut you off from lower layers — you can use LangGraph graphs inside Deep Agents, and LangChain primitives inside both.
This skill should be loaded at the top of any project before selecting other skills or writing agent code. The framework you choose dictates which other skills to invoke next.
Answer these questions in order:
| Question | Yes → | No → |
|---|---|---|
| Does the task require breaking work into sub-tasks, managing files across a long session, persistent memory, or loading on-demand skills? | Deep Agents | ↓ |
| Does the task require complex control flow — loops, dynamic branching, parallel workers, human-in-the-loop, or custom state? | LangGraph | ↓ |
| Is this a single-purpose agent that takes input, runs tools, and returns a result? | LangChain (create_agent) | ↓ |
| Is this a pure model call, chain, or retrieval pipeline with no agent loop? | LangChain (LCEL / chain) | — |
Best for:
Not ideal when:
Skills to invoke next: langchain-models, langchain-rag, langchain-middleware
Best for:
Not ideal when:
Skills to invoke next: langgraph-fundamentals, langgraph-human-in-the-loop, langgraph-persistence
Best for:
Not ideal when:
Middleware — built-in and extensible:
Deep Agents ships with a built-in middleware layer out of the box — you configure it, you don't implement it. The following come pre-wired; you can also add your own on top:
| Middleware | What it provides | Always on? |
|---|---|---|
TodoListMiddleware | write_todos tool — agent plans and tracks multi-step tasks | ✓ |
FilesystemMiddleware | ls, read_file, write_file, edit_file, glob, grep tools |
Skills to invoke next: deep-agents-core, deep-agents-memory, deep-agents-orchestration
| Scenario | Recommended pattern |
|---|---|
| Main agent needs planning + memory, but one subtask requires precise graph control | Deep Agents orchestrator → LangGraph subagent |
| Specialized pipeline (e.g. RAG, reflection loop) is called by a broader agent | LangGraph graph wrapped as a tool or subagent |
| High-level coordination but low-level graph for a specific domain | Deep Agents + LangGraph compiled graph as a subagent |
A LangGraph compiled graph can be registered as a subagent inside Deep Agents. This means you can build a tightly-controlled LangGraph workflow (e.g. a retrieval-and-verify loop) and hand it off to the Deep Agents task tool as a named subagent — the Deep Agents orchestrator delegates to it without caring about its internal graph structure.
LangChain tools, chains, and retrievers can be used freely inside both LangGraph nodes and Deep Agents tools — they are the shared building blocks at every level.
| LangChain | LangGraph | Deep Agents
---|---|---|---
Control flow | Fixed (tool loop) | Custom (graph) | Managed (middleware)
Middleware layer | Callbacks only | ✗ None | ✓ Explicit, configurable
Planning | ✗ | Manual | ✓ TodoListMiddleware
File management | ✗ | Manual | ✓ FilesystemMiddleware
Persistent memory | ✗ | With checkpointer | ✓ MemoryMiddleware
Subagent delegation | ✗ | Manual | ✓ SubAgentMiddleware
On-demand skills | ✗ | ✗ | ✓ SkillsMiddleware
Human-in-the-loop | ✗ | Manual interrupt | ✓ HumanInTheLoopMiddleware
Custom graph edges | ✗ | ✓ Full control | Limited
Setup complexity | Low | Medium | Low
Flexibility | Medium | High | Medium
Middleware is a concept specific to LangChain (callbacks) and Deep Agents (explicit middleware layer). LangGraph has no middleware — you wire behavior directly into nodes and edges.
Weekly Installs
2.2K
Repository
GitHub Stars
423
First Seen
Mar 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code1.9K
codex1.7K
cursor1.7K
github-copilot1.7K
opencode1.7K
gemini-cli1.7K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
| ✓ |
SubAgentMiddleware | task tool — delegate work to named subagents | ✓ |
SkillsMiddleware | Load SKILL.md files on demand from a skills directory | Opt-in |
MemoryMiddleware | Long-term memory across sessions via a Store instance | Opt-in |
HumanInTheLoopMiddleware | Interrupt and request human approval before sensitive tool calls | Opt-in |