Appearance
Agent 设计指北
几个概念
- Agentic AI:1. 理解目标/任务 2. 拆解步骤 3. 调用工具执行动作 5. 观察结果并调整。我理解的几个关键点:将任务拆解为多个TODO、根据反馈进行调整、复盘
Agent 应用的架构地图
RAG
理解向量数据库

- Hybrid Search
- pgvector
- Celery Workers 异步任务:文档解析 / 记忆提取 / 定时任务

Agent 模式清单

- MCP 和 Tool 的区别:对 LLM 来说没有区别,都是 bind_tools();对工程架构来说,区别在于工具是本地函数,还是从 MCP Server 加载进来的外部能力
LangGraph 代码对比
1. 核心区别只有一行
py
# 原生 Tool
tools = [add]
# MCP Tool
tools = await client.get_tools()2. 原生 LangChain Tool
工具直接定义在当前项目中,再绑定给 LLM。
py
from langchain.chat_models import init_chat_model
from langchain.tools import tool
@tool
def add(a: int, b: int) -> int:
"""计算两个整数之和。"""
return a + b
llm = init_chat_model("openai:gpt-5.4")
tools = [add]
llm_with_tools = llm.bind_tools(tools)
response = llm_with_tools.invoke("计算 18 + 24")
print(response.tool_calls)3. MCP Tool
工具由外部 MCP Server 提供。LLM 使用方式不变,只是 tools 的来源发生变化。
py
import asyncio
from langchain.chat_models import init_chat_model
from langchain_mcp_adapters.client import MultiServerMCPClient
async def main():
client = MultiServerMCPClient(
{
"math": {
"transport": "stdio",
"command": "python",
"args": ["/absolute/path/to/math_server.py"],
}
}
)
tools = await client.get_tools()
llm = init_chat_model("openai:gpt-5.4")
llm_with_tools = llm.bind_tools(tools)
response = await llm_with_tools.ainvoke("计算 18 + 24")
print(response.tool_calls)
asyncio.run(main())MCP Server 的最小写法:
py
# math_server.py
from fastmcp import FastMCP
mcp = FastMCP("Math")
@mcp.tool()
def add(a: int, b: int) -> int:
"""计算两个整数之和。"""
return a + b
if __name__ == "__main__":
mcp.run(transport="stdio")| 对比项 | 原生 LangChain Tool | MCP Tool |
|---|---|---|
| 工具定义位置 | 当前项目内部 | 外部 MCP Server |
| 工具定义方式 | @tool | @mcp.tool() |
| LLM 绑定方式 | llm.bind_tools([add]) | llm.bind_tools(await client.get_tools()) |
| LLM 看到的内容 | Tool Schema | Tool Schema |
| LLM 使用体验 | 无区别 | 无区别 |
| 实际调用方式 | 通常是本地函数调用 | 通过 stdio 或 HTTP 调用外部服务 |
| 是否需要额外服务 | 不需要 | 需要 MCP Server |
| 适合场景 | 当前项目内部的小工具 | 多项目复用、跨进程、跨语言、独立部署 |
- Skill = Prompt + Tool + Workflow 技能和工作流密切相关!
美图 Agent 中台技术分享

大模型上下文的智能区间
结论:80K-100K

HuggingFace Agent Course
- https://huggingface.co/learn/agents-course/zh-CN/unit0/introduction
- https://huggingface.co/learn/agents-course/unit0/introduction
- https://github.com/huggingface/agents-course
Claude Code 源代码泄露
TODO