LangGraph Tutorial · Course Guide
本课程共 14 章,基于 2026-09-17 核验的 Python 官方文档编写,是原创教学整理而非官方文档的完整镜像。
LangGraph provides explicit state and execution control; Deep Agents adds filesystem tools, context management, and delegation on top of it. Learn the mechanisms here, then combine them into production services in Agent Engineering in Production.
Prerequisites: Python functions, type annotations, virtual environments. Python 3.11+ recommended. Pure-graph examples do not call a model; model examples need your own tool-calling model service (any OpenAI-compatible endpoint) and may incur cost. All credentials in the code come from environment variables.
环境与版本边界
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U langgraph
python -m pip freeze > requirements.lock.txtLangGraph v2 streaming requires 1.1+; current docs also recommend the event stream introduced in 1.2. Deep Agents docs describe 0.7 behavior: planning must be enabled explicitly. Do not mix the website doc version with your installed version; check with python -m pip show langgraph deepagents before running and keep the lock file.
章节路线
- Run a graph without a model
- State, reducers, and concurrent updates
- Conditional routing and bounded loops
- Messages and the tool-calling loop
- Checkpoints, threads, and cross-thread memory
- Human approval, interrupts, and resume
- Streaming and frontend event contracts
- Subgraphs and explicit boundaries
- Functional API and task replay
- Fault tolerance, retries, and idempotency
- Test transitions and regression boundaries
- Capstone: evidence-grounded local QA
- Capstone 2: multi-agent ticket routing
- Capstone 3: fault tolerance, approval, and resume