LangChain LangGraph
Module 1 Module 2 Module 3
Module 2 · 工具、状态与多 Agent
1 2.1 MCP
2 2.1 Travel Agent
3 2.2 Runtime Context
4 2.2 State
5 2.3 Multi Agent
6 2.4 Wedding Planners
7 Bonus: RAG
8 Bonus: SQL
SUM Module Summary
HomeLangChainModule 2 · 工具、状态与多 AgentModule Summary
LANGCHAIN MODULE 2 · SUMMARY

工具、上下文、状态与多 Agent
Tools, Context, State and Multi-Agent Workflows

从 MCP 和远程工具开始,继续学习 runtime context、Agent state、多 Agent 委托、RAG 和 SQL。

8lessons
5integrations
2bonus
进入 Module 2 首页
Learning Map
1
MCP
MCP
把本地或远程 server 暴露的 tools、resources、prompts 接入 Agent。
2
Context
Context
把调用方提供的用户偏好、角色或权限作为 runtime context 注入。
3
State
State
用 AgentState、Command 和 checkpointer 保存跨轮工作记忆。
4
Delegation
Delegation
把子 Agent 包装成工具,让主 Agent 做路由和协调。
5
Data
Data
用 RAG 和 SQL 让 Agent 查询文档和结构化数据库。
Lesson Summary
1

2.1a MCP

点击进入讲解页

连接本地和第三方 MCP server,读取 tools/resources/prompts。

  • MCP
  • MultiServerMCPClient
  • tools
2

2.1b Travel Agent

点击进入讲解页

用远程 Kiwi MCP 工具构建航班查询旅行 Agent。

  • remote MCP
  • SSE
  • travel tools
3

2.2a Runtime Context

点击进入讲解页

通过 context_schema 和 ToolRuntime 读取运行时用户偏好。

  • context_schema
  • ToolRuntime
  • preferences
4

2.2b State

点击进入讲解页

扩展 AgentState,用 Command(update=...) 读写跨轮状态。

  • AgentState
  • Command
  • checkpointer
5

2.3 Multi Agent

点击进入讲解页

把子 Agent 包装成工具,由主 Agent 选择和调用。

  • subagent
  • delegation
  • routing
6

2.4 Wedding Planners

点击进入讲解页

协调航班、场地、歌单三个专家 Agent 完成婚礼策划。

  • coordinator
  • state
  • specialists
7

Bonus RAG

点击进入讲解页

加载 PDF、切分、embedding、向量检索,再包装成 Agent 工具。

  • PDF
  • vector store
  • retrieval
8

Bonus SQL

点击进入讲解页

封装 SQLDatabase,让 Agent 查询 Chinook SQLite 数据库。

  • SQLDatabase
  • query tool
  • trace
Completion Criteria