Skip to content
Back to search

dive-into-langgraph

LangGraph 1.0 Tutorial

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/luochang212--dive-into-langgraph/badge.svg)](/listings/luochang212--dive-into-langgraph)

HTML

<a href="/listings/luochang212--dive-into-langgraph"><img src="/api/listings/luochang212--dive-into-langgraph/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 168 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <div align="center">
  2. <img src="./img/social-preview.webp" width="100%">
  3. <h1>Dive into LangGraph</h1>
  4. </div>
  5. <div align="center">
  6. <img src="https://img.shields.io/github/stars/luochang212/dive-into-langgraph?style=flat&logo=github" alt="GitHub stars"/>
  7. <img src="https://img.shields.io/github/forks/luochang212/dive-into-langgraph?style=flat&logo=github" alt="GitHub forks"/>
  8. <img src="https://img.shields.io/badge/language-Chinese-brightgreen?style=flat" alt="Language"/>
  9. <a href="https://github.com/luochang212/dive-into-langgraph/actions/workflows/ci.yml"><img src="https://github.com/luochang212/dive-into-langgraph/actions/workflows/ci.yml/badge.svg?branch=main" alt="ci"/></a>
  10. <a href="https://github.com/luochang212/dive-into-langgraph/actions/workflows/deploy-book.yml"><img src="https://github.com/luochang212/dive-into-langgraph/actions/workflows/deploy-book.yml/badge.svg?branch=main" alt="deploy-book"/></a>
  11. <a href="https://zread.ai/luochang212/dive-into-langgraph"><img src="https://img.shields.io/badge/%E2%80%8B-zread-00b0aa?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuOT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JaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00IDEyTDEyIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K&logoColor=ffffff" alt="zread"/></a>
  12. </div>
  13. <div align="center">
  14. 中文 | [English](./docs/README-en.md)
  15. </div>
  16. <div align="center">
  17. <p><a href="https://luochang212.github.io/dive-into-langgraph/">📚 在线阅读地址</a></p>
  18. <h3>📖《LangGraph 1.0 完全指南》</h3>
  19. <p><em>从零开始,动手实现强大的智能体</em></p>
  20. </div>
  21. ---
  22. ## 📢 News
  23. ### ✨ 2026-03-02 更新
  24. 本教程已转为 Agent Skill。现在无需使用人脑学习本教程,只需要为你的 [Claude Code](https://github.com/anthropics/claude-code) 安装本 Skill,即可写出高质量的 LangChain 和 LangGraph 代码。详见:[SKILL.md](skills/dive-into-langgraph/SKILL.md)
  25. 使用 npx 安装本 Skill ([dive-into-langgraph](https://skills.sh/luochang212/dive-into-langgraph/dive-into-langgraph)):
  26. ```
  27. npx skills add luochang212/dive-into-langgraph
  28. ```
  29. ## 一、项目介绍
  30. > 2025 年 10 月中旬,LangGraph 发布 1.0 版本。开发团队承诺这是一个稳定版本,预计未来接口不会大改,因此现在正是学习它的好时机。
  31. 这是一个开源电子书项目,旨在帮助 Agent 开发者快速掌握 LangGraph 框架。[LangGraph](https://github.com/langchain-ai/langgraph) 是由 LangChain 团队开发的开源智能体框架。它功能强大,你要的记忆、MCP、护栏、状态管理、多智能体它全都有。LangGraph 通常与 [LangChain](https://github.com/langchain-ai/langchain) 一起使用:LangChain 提供基础组件和工具,LangGraph 负责工作流和状态管理。因此,两个库都需要学习。为了让大家快速入门,本教程将两个库的主要功能提取出来,分成 14 个章节进行介绍。
  32. ## 二、安装依赖
  33. ```bash
  34. uv sync
  35. ```
  36. <details>
  37. <summary>依赖包列表</summary>
  38. `pyproject.toml` 声明的主要依赖如下,精确版本以 `uv.lock` 为准:
  39. ```text
  40. pydantic
  41. python-dotenv
  42. rank-bm25
  43. langchain[mcp,openai]
  44. langchain-text-splitters
  45. langchain-tavily
  46. langgraph
  47. langgraph-cli[inmem]
  48. langgraph-checkpoint-sqlite
  49. langgraph-checkpoint-redis
  50. langmem
  51. ipynbname
  52. fastmcp
  53. bs4
  54. requests
  55. scikit-learn
  56. supervisor
  57. jieba
  58. ddgs
  59. deepagents
  60. ```
  61. </details>
  62. ### 代码质量与 Git Hook
  63. 首次克隆后安装仓库的 pre-commit Hook:
  64. ```bash
  65. uv run pre-commit install
  66. ```
  67. Hook 会在每次提交前检查全仓 Ruff 格式和 lint,但不会自动改写文件。手动执行同一套 CI 检查:
  68. ```bash
  69. uv run pre-commit run --all-files
  70. ```
  71. ## 三、章节目录
  72. 本教程的内容速览:
  73. | 序号 | 章节 | 主要内容 |
  74. | -- | -- | -- |
  75. | 1 | [快速入门](./1.quickstart.ipynb) | 创建你的第一个 ReAct Agent |
  76. | 2 | [状态图](./2.stategraph.ipynb) | 使用 StateGraph 创建工作流 |
  77. | 3 | [中间件](./3.middleware.ipynb) | 使用自定义中间件实现四个功能:预算控制、消息截断、敏感词过滤、PII 检测 |
  78. | 4 | [人机交互](./4.human_in_the_loop.ipynb) | 使用内置的 HITL 中间件实现人机交互 |
  79. | 5 | [记忆](./5.memory.ipynb) | 创建短期记忆、长期记忆 |
  80. | 6 | [上下文工程](./6.context.ipynb) | 使用 State、Store、Runtime 管理上下文 |
  81. | 7 | [MCP Server](./7.mcp_server.ipynb) | 创建 MCP Server 并接入 LangGraph |
  82. | 8 | [监督者模式](./8.supervisor.ipynb) | 使用官方推荐的 subagents-as-tools 模式实现监督者 |
  83. | 9 | [并行](./9.parallelization.ipynb) | 如何实现并发:节点并发、`@task` 装饰器、Map-reduce、Sub-graphs |
  84. | 10 | [RAG](./10.rag.ipynb) | 三种方式实现 RAG:向量检索、关键词检索、混合检索 |
  85. | 11 | [网络搜索](./11.web_search.ipynb) | 实现联网搜索:DashScope、Tavily、DDGS 和 Exa MCP |
  86. | 12 | [Deep Agents](./12.deep_agents.ipynb) | 简单介绍 Deep Agents |
  87. | 13 | [Gradio APP](./13.gradio_app.ipynb) | 基于 Gradio 开发流式对话智能体应用 |
  88. | 14 | [附录:调试页面](./14.langgraph_cli.ipynb) | 介绍 langgraph-cli 提供的调试页面 |
  89. > \[!NOTE\]
  90. >
  91. > **承诺**:本教程完全基于 LangGraph v1.0 编写,不含任何 v0.6 的历史残留。
  92. ## 四、调试页面
  93. `langgraph-cli` 提供了一个可快速启动的调试页面。
  94. ```bash
  95. langgraph dev
  96. ```
  97. 详见:[附录](https://luochang212.github.io/dive-into-langgraph/langgraph-cli/)
  98. ## 五、实战章节
  99. [第 13 章](https://luochang212.github.io/dive-into-langgraph/gradio-app/) 开源了一个基于 Gradio + LangChain 实现的智能体应用,效果如下。你可以为这个应用添加更多功能,定制专属于你的智能体。
  100. ![gradio_app](./app/images/gradio_app.webp)
  101. 详见:[/app](./app/)
  102. ## 六、延伸阅读
  103. **官方文档:**
  104. - [LangChain](https://docs.langchain.com/oss/python/langchain/overview)
  105. - [LangGraph](https://docs.langchain.com/oss/python/langgraph/overview)
  106. - [Deep Agents](https://docs.langchain.com/oss/python/deepagents/overview)
  107. - [LangMem](https://langchain-ai.github.io/langmem/)
  108. **官方教程:**
  109. - [langgraph-101](https://github.com/langchain-ai/langgraph-101)
  110. - [langchain-academy](https://github.com/langchain-ai/langchain-academy)
  111. ## 七、如何贡献
  112. 我们欢迎任何形式的贡献!
  113. - 🐛 报告 Bug - 发现问题请提交 Issue
  114. - 💡 功能建议 - 有好想法就告诉我们
  115. - 📝 内容完善 - 帮助改进教程内容
  116. - 🔧 代码优化 - 提交 Pull Request
  117. ## 八、Star History
  118. [![Star History Chart](https://api.star-history.com/svg?repos=luochang212/dive-into-langgraph&type=date&legend=top-left)](https://www.star-history.com/#luochang212/dive-into-langgraph&type=date&legend=top-left)
  119. ## 九、开源协议
  120. 本作品采用 [知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-sa/4.0/) 进行许可。

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.