LangChain & LangGraph Getting Started Tutorial
🗺️ This tutorial is split into two parts: LangChain (chapters 01-14) teaches you to call large models, assemble chains, and build Agents; LangGraph (chapters 15-28) teaches you to build stateful, pausable, collaborative Agent systems with graph orchestration. The two are the golden pair of one ecosystem—LangChain provides the building blocks, and LangGraph provides the blueprint.
📚 LangChain (01-14)
Basics
| Chapter | Topic | Description |
|---|---|---|
| 01 | Concepts | What is LangChain? What can it do? |
| 02 | Environment Setup | Install Node.js, create a project, and configure an API key |
| 03 | Calling Models | Call a large model with ChatOpenAI (parameters in detail) |
| 04 | Message Types | HumanMessage and SystemMessage in detail |
| 05 | Streaming | Implement a typewriter effect |
Intermediate
| Chapter | Topic | Description |
|---|---|---|
| [06](./06-Prompt 模板.md) | Prompt Templates | Generate prompts dynamically |
| 07 | Output Parsers | Get structured data (withStructuredOutput / Zod) |
| [08](./08-链 (Chain).md) | Chains | Combine multiple steps |
| [09](./09-记忆 (Memory).md) | Memory | Implement multi-turn conversations |
| [10](./10-工具 (Tools).md) | Tools | Call external APIs and functions |
| [11](./11-Zod 使用说明.md) | Zod Guide | A complete guide to the Zod validation library |
Advanced
| Chapter | Topic | Description |
|---|---|---|
| 12 | Agents | Decide on their own, use tools, and complete tasks |
| 13 | RAG | Have the AI look things up before answering |
| 14 | Vector Stores | A database you search by meaning |
📚 LangGraph (15-28)
Basics
| Chapter | Topic | Description |
|---|---|---|
| [15](./15-LangGraph 简介.md) | Introduction to LangGraph | Why graph orchestration? A tour of the core concepts |
| 16 | Environment Setup and Your First Graph | Build and run your first graph |
| 17 | State in Detail | Annotation, reducers, and MessagesAnnotation |
| 18 | Nodes and Edges | Node functions, Command, fan-out and fan-in |
| 19 | Conditional Edges and Routing | addConditionalEdges and dynamic dispatch with Send |
| [20](./20-构建 ReAct Agent.md) | Building a ReAct Agent | Build it by hand, plus the createReactAgent preset |
Intermediate
| Chapter | Topic | Description |
|---|---|---|
| 21 | Memory and Persistence | Checkpointer, thread_id, and getState |
| 22 | Human-in-the-loop | Pause with interrupt and resume with Command |
| 23 | Subgraphs | A graph inside a graph: reuse and divide-and-conquer |
| [24](./24-多 Agent 系统.md) | Multi-Agent Systems | Supervisor and createSupervisor |
| 25 | Streaming | streamMode, a messages typewriter, and writer progress |
| [26](./26-长期记忆与跨线程 Store.md) | Long-term Memory and the Cross-thread Store | InMemoryStore and user profiles across sessions |
| [27](./27-Functional API.md) | Functional API | entrypoint, task, and workflows without drawing a graph |
| 28 | Capstone | A smart travel concierge: putting everything you learned to work |
🚀 Quick Start
bash
# 1. Install dependencies (LangChain)
npm install @langchain/core @langchain/openai zod
# 2. Extra install for LangGraph
npm install @langchain/langgraph
# 3. Set the API key (ModelScope as an example)
export MODELSCOPE_API_KEY="your API key"
# 4. Run the sample code
node 03-模型调用.js📦 Core Dependencies
json
{
"@langchain/core": "^1.x",
"@langchain/openai": "^1.x",
"langchain": "^1.x", // Agents (chapter 12)
"@langchain/langgraph": "^1.x", // LangGraph (chapters 15-28)
"@langchain/classic": "^1.x", // Classic components such as MemoryVectorStore (chapters 13-14)
"zod": "^4.x"
}💡 Study Tips
- Learn in order: Build a foundation with LangChain first (models, messages, chains, and tools), then learn orchestration in LangGraph
- Understand the split: LangChain's
createAgentis enough for a simple tool loop; move to LangGraph when you need loops, branches, parallelism, or human approval - Practice by doing: Every chapter has runnable sample code. Getting it to run matters more than only understanding it