> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 框架、运行时与工具集

> 了解 LangChain、LangGraph 和 Deep Agents 之间的区别以及何时使用它们

LangChain 维护着多个开源包，以帮助您构建代理。它们在代理开发栈中各有不同的用途。理解[代理框架](#代理框架（如-langchain）)、[代理运行时](#代理运行时（如-langgraph）)和[代理工具集](#代理工具集（如-deep-agents-sdk）)之间的区别，有助于您为需求选择合适的工具。

<table className="products-page">
  <thead>
    <tr>
      <th />

      <th>框架</th>
      <th>运行时</th>
      <th>工具集</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>增值点</td>
      <td class="tdlist"><ul><li>抽象</li><li>集成</li></ul></td>
      <td class="tdlist"><ul><li>持久执行</li><li>流式处理</li><li>人在环中</li><li>持久化</li></ul></td>
      <td class="tdlist"><ul><li>预定义工具</li><li>提示词</li><li>子代理</li></ul></td>
    </tr>

    <tr>
      <td>使用场景</td>
      <td class="tdlist"><ul><li>快速入门</li><li>标准化团队构建方式</li></ul></td>
      <td class="tdlist"><ul><li>底层控制</li><li>长时间运行、有状态的工作流和代理</li></ul></td>
      <td class="tdlist"><ul><li>更自主的代理</li><li>处理复杂、非确定性任务的代理</li></ul></td>
    </tr>

    <tr>
      <td>选项</td>
      <td class="tdlist"><ul><li>LangChain</li><li>Vercel 的 AI SDK</li><li>CrewAI</li><li>OpenAI Agents SDK</li><li>Google ADK</li><li>LlamaIndex</li></ul></td>
      <td class="tdlist"><ul><li>LangGraph</li><li>Temporal</li><li>Inngest</li></ul></td>
      <td class="tdlist"><ul><li>Deep Agents SDK</li><li>Claude Agent SDK</li><li>Manus</li></ul></td>
    </tr>
  </tbody>
</table>

## 代理框架（如 LangChain）

代理框架提供抽象，使得使用大语言模型构建应用时更容易上手。

[LangChain](/oss/python/langchain/overview) 是一个代理框架，提供了诸如结构化内容块、代理循环和中间件等抽象。

LangChain 的抽象设计旨在易于上手，同时为高级用例提供所需的灵活性。

虽然 LangChain 构建在 [LangGraph](/oss/python/langgraph/overview) 之上，但您无需了解 LangGraph 即可使用 LangChain。

其他代理框架的例子包括 [Vercel 的 AI SDK](https://ai-sdk.dev/docs/introduction)、[CrewAI](https://www.crewai.com/)、[OpenAI Agents SDK](https://openai.github.io/openai-agents-python/)、[Google ADK](https://google.github.io/adk-docs/)、[LlamaIndex](https://www.llamaindex.ai/) 等等。

### 何时使用 LangChain

在以下情况下使用 LangChain：

* 您想快速构建代理和自主应用程序。
* 您需要模型、工具和代理循环的标准抽象。
* 您想要一个易于使用且仍提供灵活性的框架。
* 您正在构建无需复杂编排需求的直接代理应用程序。

## 代理运行时（如 LangGraph）

代理运行时提供在生产环境中运行代理的工具支持。
支持的工具可能包括：

* **持久执行**：代理在故障中得以持久化，可以长时间运行，并从断点处恢复。
* **流式处理**：支持流式工作流和响应。
* **人在环中**：通过检查和修改代理状态来纳入人类监督。
* **持久化**：线程级和跨线程的持久化，用于状态管理。
* **底层控制**：无需高级抽象即可直接控制代理编排。

[LangGraph](/oss/python/langgraph/overview) 是一个用于构建、管理和部署长时间运行、有状态代理的底层编排框架和运行时。

代理框架通常处于更高层级，并运行在代理运行时之上。
例如，LangChain 1.0 构建在 LangGraph 之上。

其他代理运行时的例子包括 [Temporal](https://temporal.io/)、[Inngest](https://www.inngest.com/) 以及其他持久执行引擎。

### 何时使用 LangGraph

在以下情况下使用 LangGraph：

* 您需要对代理编排进行细粒度的底层控制。
* 您需要为长时间运行、有状态的代理提供持久执行。
* 您正在构建结合确定性步骤和代理步骤的复杂工作流。
* 您需要用于代理部署的生产就绪基础设施。

## 代理工具集（如 Deep Agents SDK）

代理工具集是具有主见、功能齐全的框架，内置工具和能力，用于构建复杂、长时间运行的代理。
支持的工具可能包括：

* **规划能力**：使用待办事项列表跟踪多个任务。
* **任务委派**：委派工作并通过子代理保持上下文清晰。
* **文件系统**：对不同可插拔存储后端上的文件进行读写访问。
* **令牌管理**：对话历史摘要和大型工具结果淘汰。

[Deep Agents SDK](/oss/python/deepagents/overview) 构建在 LangGraph 之上，并添加了规划能力、用于上下文管理的文件系统、生成子代理的能力等。
Deep Agents 专为需要规划和分解的复杂多步骤任务而设计。

示例任务包括处理状态中的搜索结果、脚本和其他工件。

其他代理工具集的例子包括 [Claude Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview)、[Manus](https://manus.im/) 以及其他编码 CLI。

### 何时使用 Deep Agents SDK

在以下情况下使用 [Deep Agents SDK](/oss/python/deepagents/overview)：

* 您正在构建长时间运行的代理。
* 您正在构建需要处理复杂多步骤任务的代理。
* 您想使用预定义工具，例如文件系统操作、bash 执行和自动化上下文工程。
* 您想使用预定义提示词和子代理。

## 功能比较

虽然您可以使用 LangChain、LangGraph 和 Deep Agents 完成类似的任务，但您集成它们的层级不同：

| 功能   | LangChain                                             | LangGraph                                                      | Deep Agents                                                              |
| ---- | ----------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------ |
| 短期记忆 | [短期记忆](/oss/python/langchain/short-term-memory)       | [短期记忆](/oss/python/langgraph/add-memory#add-short-term-memory) | [`StateBackend`](/oss/python/deepagents/backends#statebackend-ephemeral) |
| 长期记忆 | [长期记忆](/oss/python/langchain/long-term-memory)        | [长期记忆](/oss/python/langgraph/add-memory#add-long-term-memory)  | [长期记忆](/oss/python/deepagents/memory)                                    |
| 技能   | [多代理技能](/oss/python/langchain/multi-agent/skills)     | -                                                              | [技能](/oss/python/deepagents/skills)                                      |
| 子代理  | [多代理子代理](/oss/python/langchain/multi-agent/subagents) | [子图](/oss/python/langgraph/use-subgraphs)                      | [子代理](/oss/python/deepagents/subagents)                                  |
| 人在环中 | [人在环中中间件](/oss/python/langchain/human-in-the-loop)    | [中断](/oss/python/langgraph/interrupts)                         | [`interrupt_on` 参数](/oss/python/deepagents/harness#human-in-the-loop)    |
| 流式处理 | [代理流式处理](/oss/python/langchain/streaming/overview)    | [流式处理](/oss/python/langgraph/streaming)                        | [流式处理](/oss/python/deepagents/streaming/overview)                        |

## 了解更多

* [LangChain 概览](/oss/python/langchain/overview)
* [LangGraph 概览](/oss/python/langgraph/overview)
* [Deep Agents 概览](/oss/python/deepagents/overview)

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档](/use-these-docs)通过 MCP 连接到 Claude、VSCode 等，以获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/concepts/products.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
