{"id":47842407,"url":"https://github.com/luochang212/dive-into-langgraph","last_synced_at":"2026-04-03T21:01:17.317Z","repository":{"id":323366418,"uuid":"1088165333","full_name":"luochang212/dive-into-langgraph","owner":"luochang212","description":"LangGraph 1.0 Tutorial","archived":false,"fork":false,"pushed_at":"2026-03-01T18:28:31.000Z","size":16511,"stargazers_count":322,"open_issues_count":1,"forks_count":40,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-01T19:36:27.937Z","etag":null,"topics":["agent","e-book","guide","handbook","langchain","langgraph"],"latest_commit_sha":null,"homepage":"http://www.luochang.ink/dive-into-langgraph/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luochang212.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-02T12:55:20.000Z","updated_at":"2026-03-01T18:28:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/luochang212/dive-into-langgraph","commit_stats":null,"previous_names":["luochang212/langgraph-tutorial","luochang212/dive-into-langgraph"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luochang212/dive-into-langgraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochang212%2Fdive-into-langgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochang212%2Fdive-into-langgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochang212%2Fdive-into-langgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochang212%2Fdive-into-langgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luochang212","download_url":"https://codeload.github.com/luochang212/dive-into-langgraph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luochang212%2Fdive-into-langgraph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31377113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","e-book","guide","handbook","langchain","langgraph"],"created_at":"2026-04-03T21:01:12.387Z","updated_at":"2026-04-03T21:01:17.304Z","avatar_url":"https://github.com/luochang212.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./img/social-preview.webp\" width=\"100%\"\u003e\n  \u003ch1\u003eDive into LangGraph\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/luochang212/dive-into-langgraph?style=flat\u0026logo=github\" alt=\"GitHub stars\"/\u003e\n  \u003cimg src=\"https://img.shields.io/github/forks/luochang212/dive-into-langgraph?style=flat\u0026logo=github\" alt=\"GitHub forks\"/\u003e\n  \u003cimg src=\"https://img.shields.io/badge/language-Chinese-brightgreen?style=flat\" alt=\"Language\"/\u003e\n  \u003ca href=\"https://github.com/luochang212/dive-into-langgraph\"\u003e\u003cimg src=\"https://img.shields.io/badge/GitHub-Project-blue?style=flat\u0026logo=github\" alt=\"GitHub Project\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/luochang212/dive-into-langgraph/actions/workflows/deploy-book.yml\"\u003e\u003cimg src=\"https://github.com/luochang212/dive-into-langgraph/actions/workflows/deploy-book.yml/badge.svg?branch=main\" alt=\"deploy-book\"/\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n中文 | [English](./docs/README-en.md)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cp\u003e\u003ca href=\"https://luochang212.github.io/dive-into-langgraph/\"\u003e📚 在线阅读地址\u003c/a\u003e\u003c/p\u003e\n  \u003ch3\u003e📖《LangGraph 1.0 完全指南》\u003c/h3\u003e\n  \u003cp\u003e\u003cem\u003e从零开始，动手实现强大的智能体\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## 📢 News\n\n### ✨ 2026-03-02 更新\n\n本教程已转为 Agent Skill。现在无需使用人脑学习本教程，只需要为你的 [Claude Code](https://github.com/anthropics/claude-code) 安装本 Skill，即可写出高质量的 LangChain 和 LangGraph 代码。详见：[SKILL.md](skills/dive-into-langgraph/SKILL.md)\n\n使用 npx 安装本 Skill ([dive-into-langgraph](https://skills.sh/luochang212/dive-into-langgraph/dive-into-langgraph))：\n\n```\nnpx skills add luochang212/dive-into-langgraph\n```\n\n## 一、项目介绍\n\n\u003e 2025 年 10 月中旬，LangGraph 发布 1.0 版本。开发团队承诺这是一个稳定版本，预计未来接口不会大改，因此现在正是学习它的好时机。\n\n这是一个开源电子书项目，旨在帮助 Agent 开发者快速掌握 LangGraph 框架。[LangGraph](https://github.com/langchain-ai/langgraph) 是由 LangChain 团队开发的开源智能体框架。它功能强大，你要的记忆、MCP、护栏、状态管理、多智能体它全都有。LangGraph 通常与 [LangChain](https://github.com/langchain-ai/langchain) 一起使用：LangChain 提供基础组件和工具，LangGraph 负责工作流和状态管理。因此，两个库都需要学习。为了让大家快速入门，本教程将两个库的主要功能提取出来，分成 14 个章节进行介绍。\n\n## 二、安装依赖\n\n```bash\npip install -r requirements.txt\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e依赖包列表\u003c/summary\u003e\n\n  以下为 `requirements.txt` 中的依赖包清单：\n\n  ```text\n  pydantic\n  python-dotenv\n  langchain[openai]\n  langchain-community\n  langchain-mcp-adapters\n  langchain-text-splitters\n  langgraph\n  langgraph-cli[inmem]\n  langgraph-supervisor\n  langgraph-checkpoint-sqlite\n  langgraph-checkpoint-redis\n  langmem\n  ipynbname\n  fastmcp\n  bs4\n  scikit-learn\n  supervisor\n  jieba\n  dashscope\n  tavily-python\n  ddgs\n  ```\n\u003c/details\u003e\n\n## 三、章节目录\n\n本教程的内容速览：\n\n| 序号 | 章节 | 主要内容 |\n| -- | -- | -- |\n| 1 | [快速入门](./1.quickstart.ipynb) | 创建你的第一个 ReAct Agent |\n| 2 | [状态图](./2.stategraph.ipynb) | 使用 StateGraph 创建工作流 |\n| 3 | [中间件](./3.middleware.ipynb) | 使用自定义中间件实现四个功能：预算控制、消息截断、敏感词过滤、PII 检测 |\n| 4 | [人机交互](./4.human_in_the_loop.ipynb) | 使用内置的 HITL 中间件实现人机交互 |\n| 5 | [记忆](./5.memory.ipynb) | 创建短期记忆、长期记忆 |\n| 6 | [上下文工程](./6.context.ipynb) | 使用 State、Store、Runtime 管理上下文 |\n| 7 | [MCP Server](./7.mcp_server.ipynb) | 创建 MCP Server 并接入 LangGraph |\n| 8 | [监督者模式](./8.supervisor.ipynb) | 两种方法实现监督者模式：tool-calling、langgraph-supervisor |\n| 9 | [并行](./9.parallelization.ipynb) | 如何实现并发：节点并发、`@task` 装饰器、Map-reduce、Sub-graphs |\n| 10 | [RAG](./10.rag.ipynb) | 三种方式实现 RAG：向量检索、关键词检索、混合检索 |\n| 11 | [网络搜索](./11.web_search.ipynb) | 实现联网搜索：DashScope、Tavily 和 DDGS |\n| 12 | [Deep Agents](./12.deep_agents.ipynb) | 简单介绍 Deep Agents |\n| 13 | [Gradio APP](./13.gradio_app.ipynb) | 基于 Gradio 开发流式对话智能体应用 |\n| 14 | [附录：调试页面](./14.langgraph_cli.ipynb) | 介绍 langgraph-cli 提供的调试页面 |\n\n\u003e \\[!NOTE\\]\n\u003e \n\u003e **承诺**：本教程完全基于 LangGraph v1.0 编写，不含任何 v0.6 的历史残留。\n\n## 四、调试页面\n\n`langgraph-cli` 提供了一个可快速启动的调试页面。\n\n```bash\nlanggraph dev\n```\n\n详见：[附录](https://luochang212.github.io/dive-into-langgraph/langgraph-cli/)\n\n## 五、实战章节\n\n[第 13 章](https://luochang212.github.io/dive-into-langgraph/gradio-app/) 开源了一个基于 Gradio + LangChain 实现的智能体应用，效果如下。你可以为这个应用添加更多功能，定制专属于你的智能体。\n\n![gradio_app](./app/images/gradio_app.webp)\n\n详见：[/app](./app/)\n\n## 六、延伸阅读\n\n**官方文档：**\n\n- [LangChain](https://docs.langchain.com/oss/python/langchain/overview)\n- [LangGraph](https://docs.langchain.com/oss/python/langgraph/overview)\n- [Deep Agents](https://docs.langchain.com/oss/python/deepagents/overview)\n- [LangMem](https://langchain-ai.github.io/langmem/)\n\n**官方教程：**\n\n- [langgraph-101](https://github.com/langchain-ai/langgraph-101)\n- [langchain-academy](https://github.com/langchain-ai/langchain-academy)\n\n## 七、如何贡献\n\n我们欢迎任何形式的贡献！\n\n- 🐛 报告 Bug - 发现问题请提交 Issue\n- 💡 功能建议 - 有好想法就告诉我们\n- 📝 内容完善 - 帮助改进教程内容\n- 🔧 代码优化 - 提交 Pull Request\n\n## 八、Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=luochang212/dive-into-langgraph\u0026type=date\u0026legend=top-left)](https://www.star-history.com/#luochang212/dive-into-langgraph\u0026type=date\u0026legend=top-left)\n\n## 九、开源协议\n\n本作品采用 [知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-sa/4.0/) 进行许可。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluochang212%2Fdive-into-langgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluochang212%2Fdive-into-langgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluochang212%2Fdive-into-langgraph/lists"}