Chapter 13–16 · Project Integration
最后四章的意义,不是再学四个 Demo,而是看前面所有能力怎样组合成一个真实 Agent 产品
Travel Agent 教你分层架构,Deep Research 教你长任务与信息合成,Cyber Town 教你独立 Agent 的状态与记忆边界,毕业设计则要求你把这些能力变成一个真正可运行、可评测、可迭代的项目。
Travel产品分层
Agent 只是系统的一层
Deep Research长任务编排
Plan / Search / Notes / Report
Cyber Town多 Agent 状态
Memory / Role / Context
Final Project可运行、可评测
Build → Eval → Iterate
1. 第 13 章:Travel Agent —— 学“产品分层”
真正要拿走的不是旅游业务,而是:Agent 只是一个产品架构层,不应该承担所有逻辑。
业务逻辑
确定性操作、数据格式、参数校验尽量由普通代码完成。
外部服务
地图、天气、搜索等独立封装,不直接散落在 Agent Prompt 里。
Agent 是产品的一层,不是整个产品
2. 第 14 章:Deep Research —— 学“长任务 Agent”
这是综合项目里最值得重点理解的一章,因为它把 Planning、Search、Notes、Context Engineering 和最终综合全部串起来。
Plan → Retrieve → Process → Persist → Synthesize
Deep Research 的三个关键角色
🔎
Executor / Search
逐个搜索、过滤、总结,并记录来源。
📝
Report Writer
基于中间 Notes 分层综合,而不是直接吞全部原始网页。
最重要:长任务 Agent 必须“写下来”。Notes、状态文件、结构化摘要可以让 Agent 在多个步骤之间稳定继续,而不是完全依赖聊天历史。
3. 第 15 章:Cyber Town —— 学“多 Agent 的边界”
Cyber Town 的价值不在游戏本身,而在于理解不同 Agent 为什么应该有独立 Role、State、Memory 和 Context。
Agent Boundary ≈ Responsibility + State + Context + Memory Boundary
不要为了高级而过早 Multi-Agent。如果单 Agent + Tools 已经足够,拆成多个 Agent 只会增加协调复杂度。职责确实独立时再拆。
4. 三类项目真正共同的规律
分层
UI、API、Agent、Service、Tool 各司其职。
结构化
状态、任务、结果尽量结构化,不靠自由文本硬撑。
持久化
长任务要有 Notes、State、Checkpoint。
评测
项目不是“能跑 Demo”,而是要有 Eval Dataset 和指标。
LLM 负责判断;Code 负责确定性操作;Runtime 负责执行;Eval 负责证明效果
5. 最终项目:科研论文代码复现 Agent
这个项目最适合把整套 Hello-Agents 的知识真正串起来。
Agent = Planner + Tool Use + State + Notes + Evaluator + Replan
6. MVP:第一版只做一个非常具体的任务
不要第一版就做自动找论文、自动找 repo、Multi-Agent、MCP、RL、复杂 UI。先把最小闭环跑通。
输入
paper.pdf
+
github_repository_url
输出
environment.md
experiment_plan.md
failures.md
results.md
reproduction_report.md
MVP 必须完成的 6 件事
从论文中提取实验环境、数据集、模型、关键指标。
读取 repo README / requirements / scripts。
创建或检查运行环境。
运行 baseline,并捕获错误。
根据错误进行有限次修复与重试。
得到指标后与论文结果对比并生成报告。
不要把 MVP 做成“万能科研 Agent”。范围越窄,越容易真正评测,也越容易做出第一个稳定版本。
7. 项目的核心控制循环
while not finished:
action = agent.decide(
goal=goal,
state=state,
context=context_builder.build(state)
)
result = runtime.execute(action)
state.update(result)
evaluator_result = evaluator.check(state)
if evaluator_result.need_replan:
state.plan = planner.replan(state)
if evaluator_result.success:
finished = True
Plan → Act → Observe → Update State → Evaluate → Replan / Finish
Evaluator
判断是否成功、是否需要重试或重规划。
8. 推荐目录结构
research-reproduction-agent/
├── README.md
├── pyproject.toml
├── .env.example
│
├── src/
│ ├── agent.py
│ ├── state.py
│ ├── planner.py
│ ├── context.py
│ ├── prompts.py
│ │
│ ├── tools/
│ │ ├── paper.py
│ │ ├── repository.py
│ │ ├── shell.py
│ │ ├── files.py
│ │ └── notes.py
│ │
│ ├── services/
│ │ ├── environment.py
│ │ ├── executor.py
│ │ └── evaluator.py
│ │
│ └── memory/
│ └── store.py
│
├── workspace/
│ ├── paper_notes.md
│ ├── environment.md
│ ├── failures.md
│ └── results.md
│
├── eval/
│ ├── tasks.json
│ └── fixtures/
│
└── tests/
结构原则:Agent 决策、工具执行、业务服务、状态、记忆、评测分开。不要把所有逻辑写进一个 agent.py。
9. 升级路线:一步一步加,不要一次全上
10. Hello-Agents 全书统一总图
Agent System = Model + Tools + Runtime + State + Context + Evaluation
你已经学会的“控制层”
ReAct、Planning、Reflection、Agent Loop。
你已经学会的“系统层”
State、Memory、RAG、MCP、Runtime、Framework。
你已经学会的“工程层”
Eval、Cost、Robustness、项目分层、迭代路线。
真正的“学完”标准:不是把 16 章看完,而是你能自己画出系统、写出最小 Agent Loop、解释每个模块为什么存在,并在真实项目里逐步加能力。