Find a file
luochang212 4ec7a63c8a update
2026-02-14 20:18:28 +08:00
.github/workflows update 2025-12-11 09:35:45 +08:00
app update 2026-02-14 20:18:28 +08:00
book update /app 2026-01-15 03:15:12 +08:00
docs update 2026-02-14 20:18:28 +08:00
img update 2026-01-16 01:31:31 +08:00
mcp_server update 2025-12-01 00:41:04 +08:00
tests update 2026-01-08 05:07:24 +08:00
.env.example update 2026-01-09 00:42:26 +08:00
.gitignore update ollama + thinking + remove_html 2026-01-10 02:32:29 +08:00
1.quickstart.ipynb update 2026-02-07 19:10:58 +08:00
2.stategraph.ipynb update tutorial 2026-01-08 05:06:08 +08:00
3.middleware.ipynb update 2026-02-04 22:34:23 +08:00
4.human_in_the_loop.ipynb update /app 2025-12-24 02:42:10 +08:00
5.memory.ipynb update 2025-12-22 23:08:13 +08:00
6.context.ipynb update 2026-02-04 22:34:23 +08:00
7.mcp_server.ipynb update 2026-02-07 19:10:58 +08:00
8.supervisor.ipynb update tutorial 2026-01-08 05:06:08 +08:00
9.parallelization.ipynb update /app 2025-12-24 02:42:10 +08:00
10.rag.ipynb update tutorial 2026-01-08 05:06:08 +08:00
11.web_search.ipynb update tutorial 2026-01-08 05:06:08 +08:00
12.deep_agents.ipynb update /app 2025-12-24 02:42:10 +08:00
13.gradio_app.ipynb update 2026-02-07 19:14:14 +08:00
14.langgraph_cli.ipynb update 2026-01-11 21:44:09 +08:00
langgraph.json update 2025-11-10 01:45:29 +08:00
LICENSE Add LICENSE file with CC BY-NC-SA 4.0 2025-12-05 00:56:01 +08:00
myst.yml update 2026-01-11 21:44:09 +08:00
README.md update /app 2026-01-15 03:15:12 +08:00
requirements.txt update 2026-02-07 18:41:52 +08:00
simple_agent.py update 2026-01-08 05:04:34 +08:00

Dive into LangGraph

GitHub stars GitHub forks Language GitHub Project deploy-book

中文 | English

📚 在线阅读地址

📖《LangGraph 1.0 完全指南》

从零开始,动手实现强大的智能体


一、项目介绍

2025 年 10 月中旬LangGraph 发布 1.0 版本。开发团队承诺这是一个稳定版本,预计未来接口不会大改,因此现在正是学习它的好时机。

这是一个开源电子书项目,旨在帮助 Agent 开发者快速掌握 LangGraph 框架。LangGraph 是由 LangChain 团队开发的开源智能体框架。它功能强大你要的记忆、MCP、护栏、状态管理、多智能体它全都有。LangGraph 通常与 LangChain 一起使用LangChain 提供基础组件和工具LangGraph 负责工作流和状态管理。因此,两个库都需要学习。为了让大家快速入门,本教程将两个库的主要功能提取出来,分成 14 个章节进行介绍。

二、安装依赖

pip install -r requirements.txt
依赖包列表

以下为 requirements.txt 中的依赖包清单:

pydantic
python-dotenv
langchain[openai]
langchain-community
langchain-mcp-adapters
langchain-text-splitters
langgraph
langgraph-cli[inmem]
langgraph-supervisor
langgraph-checkpoint-sqlite
langgraph-checkpoint-redis
langmem
ipynbname
fastmcp
bs4
scikit-learn
supervisor
jieba
dashscope
tavily-python
ddgs

三、章节目录

本教程的内容速览:

序号 章节 主要内容
1 快速入门 创建你的第一个 ReAct Agent
2 状态图 使用 StateGraph 创建工作流
3 中间件 使用自定义中间件实现四个功能预算控制、消息截断、敏感词过滤、PII 检测
4 人机交互 使用内置的 HITL 中间件实现人机交互
5 记忆 创建短期记忆、长期记忆
6 上下文工程 使用 State、Store、Runtime 管理上下文
7 MCP Server 创建 MCP Server 并接入 LangGraph
8 监督者模式 两种方法实现监督者模式tool-calling、langgraph-supervisor
9 并行 如何实现并发:节点并发、@task 装饰器、Map-reduce、Sub-graphs
10 RAG 三种方式实现 RAG向量检索、关键词检索、混合检索
11 网络搜索 实现联网搜索DashScope、Tavily 和 DDGS
12 Deep Agents 简单介绍 Deep Agents
13 Gradio APP 基于 Gradio 开发流式对话智能体应用
14 附录:调试页面 介绍 langgraph-cli 提供的调试页面
!NOTE

承诺:本教程完全基于 LangGraph v1.0 编写,不含任何 v0.6 的历史残留。

四、调试页面

langgraph-cli 提供了一个可快速启动的调试页面。

langgraph dev

详见:附录

五、实战章节

第 13 章 开源了一个基于 Gradio + LangChain 实现的智能体应用,效果如下。你可以为这个应用添加更多功能,定制专属于你的智能体。

gradio_app

详见:/app

六、延伸阅读

官方文档:

官方教程:

七、如何贡献

我们欢迎任何形式的贡献!

  • 🐛 报告 Bug - 发现问题请提交 Issue
  • 💡 功能建议 - 有好想法就告诉我们
  • 📝 内容完善 - 帮助改进教程内容
  • 🔧 代码优化 - 提交 Pull Request

八、开源协议

本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。