Skip to content

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 ​

ChapterTopicDescription
01ConceptsWhat is LangChain? What can it do?
02Environment SetupInstall Node.js, create a project, and configure an API key
03Calling ModelsCall a large model with ChatOpenAI (parameters in detail)
04Message TypesHumanMessage and SystemMessage in detail
05StreamingImplement a typewriter effect

Intermediate ​

ChapterTopicDescription
[06](./06-Prompt 模板.md)Prompt TemplatesGenerate prompts dynamically
07Output ParsersGet structured data (withStructuredOutput / Zod)
[08](./08-链 (Chain).md)ChainsCombine multiple steps
[09](./09-记忆 (Memory).md)MemoryImplement multi-turn conversations
[10](./10-工具 (Tools).md)ToolsCall external APIs and functions
[11](./11-Zod 使用说明.md)Zod GuideA complete guide to the Zod validation library

Advanced ​

ChapterTopicDescription
12AgentsDecide on their own, use tools, and complete tasks
13RAGHave the AI look things up before answering
14Vector StoresA database you search by meaning

📚 LangGraph (15-28) ​

Basics ​

ChapterTopicDescription
[15](./15-LangGraph 简介.md)Introduction to LangGraphWhy graph orchestration? A tour of the core concepts
16Environment Setup and Your First GraphBuild and run your first graph
17State in DetailAnnotation, reducers, and MessagesAnnotation
18Nodes and EdgesNode functions, Command, fan-out and fan-in
19Conditional Edges and RoutingaddConditionalEdges and dynamic dispatch with Send
[20](./20-构建 ReAct Agent.md)Building a ReAct AgentBuild it by hand, plus the createReactAgent preset

Intermediate ​

ChapterTopicDescription
21Memory and PersistenceCheckpointer, thread_id, and getState
22Human-in-the-loopPause with interrupt and resume with Command
23SubgraphsA graph inside a graph: reuse and divide-and-conquer
[24](./24-多 Agent 系统.md)Multi-Agent SystemsSupervisor and createSupervisor
25StreamingstreamMode, a messages typewriter, and writer progress
[26](./26-长期记忆与跨线程 Store.md)Long-term Memory and the Cross-thread StoreInMemoryStore and user profiles across sessions
[27](./27-Functional API.md)Functional APIentrypoint, task, and workflows without drawing a graph
28CapstoneA 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 ​

  1. Learn in order: Build a foundation with LangChain first (models, messages, chains, and tools), then learn orchestration in LangGraph
  2. Understand the split: LangChain's createAgent is enough for a simple tool loop; move to LangGraph when you need loops, branches, parallelism, or human approval
  3. Practice by doing: Every chapter has runnable sample code. Getting it to run matters more than only understanding it

🔗 Official Resources ​

Based on LangChain.js v1.x and LangGraph.js v1.x