AI Agent 学习笔记
AI Agent 学习笔记
什么是 AI Agent
利用 LLM 能力,结合 Tools,Memory,Planning ,自动执行复杂任务。
Agent 和 LLM 区别
LLM 只负责内容生成,Agent 可以执行任务
什么是 ReAct 模式
ReAct = reason + action
执行流程:
- Thought(思考)
- Action(调用工具)
- Observation(观察结果)
- Loop(循环)
Function Calling 是什么
LLM 输出结构化参数,调用Tools
Agent 为什么需要 Memory
减少幻觉
短期记忆:对话上下文
长期记忆:向量数据库(RAG)
Agent 核心架构
1
2
3
4
5
6
7
8
9
10
11
User Input
↓
Planner(规划)
↓
LLM(决策)
↓
Tool Executor(执行)
↓
Memory(更新)
↓
Loop
如何降低 Agent 幻觉
- RAG,回答引入原文档
- Tool Calling
- 结构化 json schema输出
- 调参数,换模型
- 设计 prompt,增加约束条件
设计一个 Agent 系统
接入层:
- API/Chat UI
Core 层:
- Planner
- Executor
- Memory
Tools 层:
- 外部 api
- Db
存储层:
- 向量数据库
可观测性:
- trace
- log
Agent 如何评估
- benchmark
- 测试用例
- 在线用户反馈
- 模型评估模型
多agent 如何编排
1 、中心化编排
1
2
3
Orchestrator Agent
/ | \
Agent A Agent B Agent C
2 、工作流/DAG 编排
主流框架:LangGraph
1
Start → Agent A → Agent B → Agent C → End
This post is licensed under CC BY 4.0 by the author.
