agent-handbook 1.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. agent_handbook-1.6.0/CONTRIBUTING.md +99 -0
  2. agent_handbook-1.6.0/LICENSE +21 -0
  3. agent_handbook-1.6.0/MANIFEST.in +14 -0
  4. agent_handbook-1.6.0/PKG-INFO +220 -0
  5. agent_handbook-1.6.0/README.md +188 -0
  6. agent_handbook-1.6.0/build_backend.py +115 -0
  7. agent_handbook-1.6.0/chapters/00-quickstart.md +347 -0
  8. agent_handbook-1.6.0/chapters/01-fundamentals.md +181 -0
  9. agent_handbook-1.6.0/chapters/02-reaact-from-scratch.md +454 -0
  10. agent_handbook-1.6.0/chapters/03-langgraph.md +510 -0
  11. agent_handbook-1.6.0/chapters/04-crewai.md +527 -0
  12. agent_handbook-1.6.0/chapters/05-autogen.md +424 -0
  13. agent_handbook-1.6.0/chapters/06-llamaindex-rag.md +335 -0
  14. agent_handbook-1.6.0/chapters/07-dify.md +307 -0
  15. agent_handbook-1.6.0/chapters/08-openai-agents.md +209 -0
  16. agent_handbook-1.6.0/chapters/09-claude-agents.md +227 -0
  17. agent_handbook-1.6.0/chapters/10-mastra.md +134 -0
  18. agent_handbook-1.6.0/chapters/11-mcp.md +488 -0
  19. agent_handbook-1.6.0/chapters/12-ollama.md +194 -0
  20. agent_handbook-1.6.0/chapters/13-collaboration-patterns.md +208 -0
  21. agent_handbook-1.6.0/chapters/14-memory-state.md +213 -0
  22. agent_handbook-1.6.0/chapters/15-cost-optimization.md +162 -0
  23. agent_handbook-1.6.0/chapters/16-observability.md +240 -0
  24. agent_handbook-1.6.0/chapters/17-fullstack-project.md +443 -0
  25. agent_handbook-1.6.0/chapters/18-selection-guide.md +188 -0
  26. agent_handbook-1.6.0/chapters/19-agent-toolkit.md +145 -0
  27. agent_handbook-1.6.0/chapters/20-codex-cli.md +337 -0
  28. agent_handbook-1.6.0/chapters/21-deepseek-harness.md +597 -0
  29. agent_handbook-1.6.0/chapters/22-continue-editor.md +193 -0
  30. agent_handbook-1.6.0/chapters/23-aider-codestory.md +179 -0
  31. agent_handbook-1.6.0/chapters/24-trae-ide.md +172 -0
  32. agent_handbook-1.6.0/chapters/25-harness-engineering.md +290 -0
  33. agent_handbook-1.6.0/chapters/26-agent-skills.md +604 -0
  34. agent_handbook-1.6.0/chapters/27-context-engineering.md +308 -0
  35. agent_handbook-1.6.0/chapters/28-trending-2026.md +155 -0
  36. agent_handbook-1.6.0/chapters/29-agent-economy.md +133 -0
  37. agent_handbook-1.6.0/chapters/30-agent-evals.md +138 -0
  38. agent_handbook-1.6.0/chapters/99-glossary.md +215 -0
  39. agent_handbook-1.6.0/data/stars-history.csv +12 -0
  40. agent_handbook-1.6.0/data/stars.json +130 -0
  41. agent_handbook-1.6.0/llms.txt +107 -0
  42. agent_handbook-1.6.0/pyproject.toml +57 -0
  43. agent_handbook-1.6.0/setup.cfg +4 -0
  44. agent_handbook-1.6.0/src/agent_handbook/__init__.py +14 -0
  45. agent_handbook-1.6.0/src/agent_handbook/_paths.py +45 -0
  46. agent_handbook-1.6.0/src/agent_handbook/chapters/00-quickstart.md +347 -0
  47. agent_handbook-1.6.0/src/agent_handbook/chapters/01-fundamentals.md +181 -0
  48. agent_handbook-1.6.0/src/agent_handbook/chapters/02-reaact-from-scratch.md +454 -0
  49. agent_handbook-1.6.0/src/agent_handbook/chapters/03-langgraph.md +510 -0
  50. agent_handbook-1.6.0/src/agent_handbook/chapters/04-crewai.md +527 -0
  51. agent_handbook-1.6.0/src/agent_handbook/chapters/05-autogen.md +424 -0
  52. agent_handbook-1.6.0/src/agent_handbook/chapters/06-llamaindex-rag.md +335 -0
  53. agent_handbook-1.6.0/src/agent_handbook/chapters/07-dify.md +307 -0
  54. agent_handbook-1.6.0/src/agent_handbook/chapters/08-openai-agents.md +209 -0
  55. agent_handbook-1.6.0/src/agent_handbook/chapters/09-claude-agents.md +227 -0
  56. agent_handbook-1.6.0/src/agent_handbook/chapters/10-mastra.md +134 -0
  57. agent_handbook-1.6.0/src/agent_handbook/chapters/11-mcp.md +488 -0
  58. agent_handbook-1.6.0/src/agent_handbook/chapters/12-ollama.md +194 -0
  59. agent_handbook-1.6.0/src/agent_handbook/chapters/13-collaboration-patterns.md +208 -0
  60. agent_handbook-1.6.0/src/agent_handbook/chapters/14-memory-state.md +213 -0
  61. agent_handbook-1.6.0/src/agent_handbook/chapters/15-cost-optimization.md +162 -0
  62. agent_handbook-1.6.0/src/agent_handbook/chapters/16-observability.md +240 -0
  63. agent_handbook-1.6.0/src/agent_handbook/chapters/17-fullstack-project.md +443 -0
  64. agent_handbook-1.6.0/src/agent_handbook/chapters/18-selection-guide.md +188 -0
  65. agent_handbook-1.6.0/src/agent_handbook/chapters/19-agent-toolkit.md +145 -0
  66. agent_handbook-1.6.0/src/agent_handbook/chapters/20-codex-cli.md +337 -0
  67. agent_handbook-1.6.0/src/agent_handbook/chapters/21-deepseek-harness.md +597 -0
  68. agent_handbook-1.6.0/src/agent_handbook/chapters/22-continue-editor.md +193 -0
  69. agent_handbook-1.6.0/src/agent_handbook/chapters/23-aider-codestory.md +179 -0
  70. agent_handbook-1.6.0/src/agent_handbook/chapters/24-trae-ide.md +172 -0
  71. agent_handbook-1.6.0/src/agent_handbook/chapters/25-harness-engineering.md +290 -0
  72. agent_handbook-1.6.0/src/agent_handbook/chapters/26-agent-skills.md +604 -0
  73. agent_handbook-1.6.0/src/agent_handbook/chapters/27-context-engineering.md +308 -0
  74. agent_handbook-1.6.0/src/agent_handbook/chapters/28-trending-2026.md +155 -0
  75. agent_handbook-1.6.0/src/agent_handbook/chapters/29-agent-economy.md +133 -0
  76. agent_handbook-1.6.0/src/agent_handbook/chapters/30-agent-evals.md +138 -0
  77. agent_handbook-1.6.0/src/agent_handbook/chapters/99-glossary.md +215 -0
  78. agent_handbook-1.6.0/src/agent_handbook/cli.py +199 -0
  79. agent_handbook-1.6.0/src/agent_handbook/data/stars-history.csv +12 -0
  80. agent_handbook-1.6.0/src/agent_handbook/data/stars.json +130 -0
  81. agent_handbook-1.6.0/src/agent_handbook/doctor.py +218 -0
  82. agent_handbook-1.6.0/src/agent_handbook/scaffold.py +298 -0
  83. agent_handbook-1.6.0/src/agent_handbook/search.py +118 -0
  84. agent_handbook-1.6.0/src/agent_handbook.egg-info/PKG-INFO +220 -0
  85. agent_handbook-1.6.0/src/agent_handbook.egg-info/SOURCES.txt +87 -0
  86. agent_handbook-1.6.0/src/agent_handbook.egg-info/dependency_links.txt +1 -0
  87. agent_handbook-1.6.0/src/agent_handbook.egg-info/entry_points.txt +2 -0
  88. agent_handbook-1.6.0/src/agent_handbook.egg-info/requires.txt +5 -0
  89. agent_handbook-1.6.0/src/agent_handbook.egg-info/top_level.txt +1 -0
@@ -0,0 +1,99 @@
1
+ # 贡献指南 / Contributing Guide
2
+
3
+ 首先,感谢你愿意为 **AI Agent 实战手册** 贡献力量!🎉
4
+ 你的每一个 PR、Issue 或建议,都在帮助更多中文开发者进入 AI Agent 的世界。
5
+
6
+ > English version available at the bottom of this file.
7
+
8
+ ---
9
+
10
+ ## 🧭 项目结构速览
11
+
12
+ ```
13
+ ai-agent-handbook/
14
+ ├── chapters/ # 中文教程章节(01-18 + 00 快速上手 + 99 术语表)
15
+ ├── en/ # 英文版(chapters/ 为已翻译章节)
16
+ ├── docs/ # 参考文档(框架对比 / 工具调用 / 最佳实践)
17
+ ├── appendix/ # 附录(错误排查 / 学习资源)
18
+ ├── examples/ # 可运行示例代码(Python)
19
+ ├── scripts/ # 工具脚本(如文档站点暂存构建)
20
+ └── mkdocs.yml # 在线文档站点配置(GitHub Pages)
21
+ ```
22
+
23
+ ## 🚀 快速开始(本地开发)
24
+
25
+ ```bash
26
+ # 1. 克隆仓库
27
+ git clone https://github.com/Xwh630/ai-agent-handbook.git
28
+ cd ai-agent-handbook
29
+
30
+ # 2.(可选)本地预览在线文档站点
31
+ pip install mkdocs-material
32
+ python scripts/build_docs.py # 暂存文档内容到 site-content/
33
+ mkdocs serve # 打开 http://127.0.0.1:8000
34
+ ```
35
+
36
+ ## 📝 如何贡献
37
+
38
+ ### 1. 报告 Bug / 提出问题(Issue)
39
+
40
+ - 先搜索是否已有相同 Issue,避免重复。
41
+ - 使用模板,尽量包含:**复现步骤、期望行为、实际行为、环境信息**(Python 版本、框架版本、操作系统)。
42
+ - 中文或英文皆可。
43
+
44
+ ### 2. 提交代码(Pull Request)
45
+
46
+ ```bash
47
+ git checkout -b feat/your-feature # 或 fix/xxx, docs/xxx
48
+ # ... 做出你的改动 ...
49
+ git add .
50
+ git commit -m "✨ 描述你的改动"
51
+ git push origin feat/your-feature
52
+ ```
53
+
54
+ 然后在 GitHub 上创建 Pull Request(使用 PR 模板)。
55
+
56
+ ### 3. 我们欢迎的贡献类型
57
+
58
+ | 类型 | 示例 |
59
+ |------|------|
60
+ | 📖 新增章节 | 新的框架教程、新玩法实战 |
61
+ | ✏️ 内容修正 | 错别字、过时 API、失效链接 |
62
+ | 🌐 翻译 | 将中文章节翻译为英文(见下方翻译约定) |
63
+ | 💻 示例代码 | 新增 examples/ 下的可运行 demo |
64
+ | 🛠️ 基础设施 | 文档站点、CI、Docker 配置优化 |
65
+ | 💡 想法建议 | 新框架覆盖、路线图讨论 |
66
+
67
+ ## 🌐 翻译约定(English Translation)
68
+
69
+ - 英文章节放在 `en/chapters/`,文件名与中文保持一致。
70
+ - 翻译时请保持:**代码与命令不翻译、术语首次出现保留英文原词**。
71
+ - 每翻译完一章,更新 `en/TRANSLATION_STATUS.md` 的状态表。
72
+ - 中文章节末尾的"英文版"链接指向 `../en/chapters/同名文件`。
73
+
74
+ ## ✅ 提交前检查清单
75
+
76
+ - [ ] 文档改动:本地 `mkdocs build` 无新警告(先运行 `python scripts/build_docs.py`)
77
+ - [ ] 代码改动:`examples/` 下示例可通过 `python 文件.py` 运行
78
+ - [ ] 链接:尽量使用相对路径链接,不用绝对 URL 指向本仓库内部文件
79
+ - [ ] 提交信息:使用约定式提交(`feat:` / `fix:` / `docs:` / `chore:` 等)
80
+
81
+ ## 🤝 行为准则
82
+
83
+ - 友善、尊重、建设性。对事不对人。
84
+ - 新手友好是这本手册的第一原则——写内容时请假设读者是零基础。
85
+ - 争议内容(如框架选型观点)请标注个人倾向,避免绝对化表述。
86
+
87
+ ---
88
+
89
+ ## English Version
90
+
91
+ Thank you for contributing to the **AI Agent Practical Handbook**! ❤️
92
+
93
+ - **Report bugs / ask questions**: open an Issue using the templates (Chinese or English).
94
+ - **Submit changes**: fork the repo, create a branch, open a Pull Request.
95
+ - **Translations**: place English chapters under `en/chapters/` with matching filenames, and update `en/TRANSLATION_STATUS.md`.
96
+ - **Before submitting**: run `python scripts/build_docs.py && mkdocs build` for docs changes; make sure example scripts run.
97
+ - **Commit style**: conventional commits (`feat:`, `fix:`, `docs:`, `chore:`).
98
+
99
+ All contributions, big or small, are deeply appreciated. Star the repo if you find it helpful! ⭐
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Agent Handbook Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ # sdist 必须自带构建后端与数据源,否则从 sdist 安装会退回空壳 CLI
2
+ include build_backend.py
3
+ include pyproject.toml
4
+ include README.md
5
+ include LICENSE
6
+ include CONTRIBUTING.md
7
+ include llms.txt
8
+ recursive-include chapters *.md
9
+ recursive-include data *.json *.csv
10
+ recursive-include src *.py
11
+ prune dist
12
+ prune site
13
+ global-exclude __pycache__
14
+ global-exclude *.py[cod]
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-handbook
3
+ Version: 1.6.0
4
+ Summary: AI Agent 实战手册命令行工具:一行命令给任何 Agent 项目做 Harness 五支柱体检 + 31 章全文检索 + 项目脚手架
5
+ Author-email: Xwh630 <hi@xwh630.dev>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Xwh630/ai-agent-handbook
8
+ Project-URL: Documentation, https://xwh630.github.io/ai-agent-handbook/
9
+ Project-URL: Repository, https://github.com/Xwh630/ai-agent-handbook
10
+ Project-URL: Issues, https://github.com/Xwh630/ai-agent-handbook/issues
11
+ Project-URL: Changelog, https://github.com/Xwh630/ai-agent-handbook/releases
12
+ Keywords: ai,agent,llm,harness,doctor,cli,chinese,handbook
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: build; extra == "dev"
30
+ Requires-Dist: twine; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ <div align="center">
34
+
35
+ <img src="assets/banner.svg" alt="AI Agent 实战手册" width="760"/>
36
+
37
+ # AI Agent 实战手册
38
+
39
+ **31 章中文教程 + 一个能给你项目打分的命令行工具。**
40
+ 不是教你"会用"某个框架,而是让你看清一个 Agent 项目缺哪根柱子。
41
+
42
+ [![Stars](https://img.shields.io/github/stars/Xwh630/ai-agent-handbook?style=flat-square&color=E24B4A)](https://github.com/Xwh630/ai-agent-handbook)
43
+ [![Release](https://img.shields.io/github/v/release/Xwh630/ai-agent-handbook?style=flat-square&color=1D9E75)](https://github.com/Xwh630/ai-agent-handbook/releases)
44
+ [![Last Commit](https://img.shields.io/github/last-commit/Xwh630/ai-agent-handbook?style=flat-square&color=378ADD)](https://github.com/Xwh630/ai-agent-handbook/commits/main)
45
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](LICENSE)
46
+
47
+ </div>
48
+
49
+ ---
50
+
51
+ ## 30 秒:给你的 Agent 项目做个体检
52
+
53
+ ```bash
54
+ uvx agent-handbook doctor .
55
+ ```
56
+
57
+ `uvx` 零安装;也可以用 `pipx run agent-handbook doctor .` 或 `pip install agent-handbook`。
58
+
59
+ > 💡 PyPI 上架中;当前可直接从源码安装:`pip install "git+https://github.com/Xwh630/ai-agent-handbook.git"`,装好后同样 `handbook doctor .`。
60
+
61
+ <img src="assets/shots/doctor-shot.svg" alt="handbook doctor 终端输出:五支柱体检报告,总分 3/10,评级 D" width="880"/>
62
+
63
+ 大多数「Agent 跑不稳」不是模型不行,而是**第 25 章那五根柱子少了几根**。
64
+ `doctor` 静态扫描你的代码,告诉你缺哪根、该读手册的哪一节——把方法论变成可核对的清单。
65
+
66
+ | 命令 | 干什么 |
67
+ |------|--------|
68
+ | `handbook doctor .` | 五支柱体检,0–10 分 + 补齐建议 |
69
+ | `handbook doctor . --md` | 输出 Markdown 表格,直接贴进 issue / README |
70
+ | `handbook search 上下文压缩` | 31 章全文检索,给出章节 + 行号 + 片段 |
71
+ | `handbook new my-agent` | 生成自带五支柱的 Agent 骨架(生成即满分) |
72
+ | `handbook stars` / `handbook list` / `handbook open 25` | 热度表 / 章节清单 / 章节定位 |
73
+
74
+ 零依赖、纯标准库、离线可用(章节数据随包安装)。
75
+
76
+ ### 放进 CI:分数掉了就让 PR 变红
77
+
78
+ ```yaml
79
+ - uses: Xwh630/ai-agent-handbook@main
80
+ with:
81
+ min-score: 6 # 低于 6 分本步骤失败(默认 0 = 只报告不拦)
82
+ ```
83
+
84
+ 它会把 `--md` 报告贴进 PR 评论,并在 Job Summary 里留一份,评审时能直接看到这次改动动了哪根柱子。
85
+
86
+ ---
87
+
88
+ ## 这本手册解决什么
89
+
90
+ | 你现在的处境 | 手册给的答案 |
91
+ |---|---|
92
+ | "Agent 能跑 demo,一上生产就崩" | 第 25 章:任务边界 / 上下文管理 / 状态持久化 / 失败恢复 / 权限体系 |
93
+ | "token 费用莫名爆炸" | 第 27 章:一次轮次的 token 构成解剖、压缩三板斧 |
94
+ | "团队经验带不进 Agent" | 第 26 章:SKILL.md 六字段规范与渐进式披露 |
95
+ | "不知道选哪个框架" | 第 18 章选型决策树 + 第 28 章 2026 顶流全景 |
96
+ | "完全没接触过" | 第 0 章:10 分钟跑通第一个 Agent |
97
+
98
+ **三条阅读路径**
99
+
100
+ - 🌱 零基础:第 0 章 → 第 1 章 → 第 2 章 → 第 7 章(Dify)
101
+ - 💻 会编程:第 2 章 → 框架三选一 → 第 25 章
102
+ - 🏗️ 要上生产:第 25 章 → 第 27 章 → 第 26 章 → 第 15 章
103
+
104
+ ---
105
+
106
+ ## 目录
107
+
108
+ | 编号 | 章节 | 一句话 |
109
+ |------|------|--------|
110
+ | 00 | [新手快速入门](chapters/00-quickstart.md) | 10 分钟跑通第一个 Agent |
111
+ | 01 | [AI Agent 基础概念](chapters/01-fundamentals.md) | Agent 本质、核心组件、ReAct 模式 |
112
+ | 02 | [从零手写 ReAct Agent](chapters/02-reaact-from-scratch.md) | 完整实现一个最小可用 Agent |
113
+ | 03 | [LangGraph 图编排](chapters/03-langgraph.md) | 复杂工作流、状态机、检查点 |
114
+ | 04 | [CrewAI 多智能体](chapters/04-crewai.md) | 角色化团队、任务分配 |
115
+ | 05 | [AutoGen / MAF](chapters/05-autogen.md) | 对话驱动协作、迭代求解 |
116
+ | 06 | [LlamaIndex RAG](chapters/06-llamaindex-rag.md) | 文档检索、向量数据库 |
117
+ | 07 | [Dify 低代码](chapters/07-dify.md) | 可视化拖拽构建应用 |
118
+ | 08 | [OpenAI Agents SDK](chapters/08-openai-agents.md) | 轻量级多 Agent |
119
+ | 09 | [Claude Agent SDK](chapters/09-claude-agents.md) | Anthropic 官方工具 |
120
+ | 10 | [Mastra TypeScript](chapters/10-mastra.md) | TS 优先的 Agent 框架 |
121
+ | 11 | [MCP 协议](chapters/11-mcp.md) | 标准化工具连接(含 2026 无状态核心) |
122
+ | 12 | [Ollama 本地部署](chapters/12-ollama.md) | 隐私保护、离线场景 |
123
+ | 13 | [多 Agent 协作模式](chapters/13-collaboration-patterns.md) | 6 种协作模式与决策树 |
124
+ | 14 | [记忆系统与状态管理](chapters/14-memory-state.md) | Mem0、向量记忆、持久化 |
125
+ | 15 | [Token 成本优化](chapters/15-cost-optimization.md) | 生产环境成本控制 |
126
+ | 16 | [调试与可观测性](chapters/16-observability.md) | LangSmith、日志、追踪 |
127
+ | 17 | [全栈实战:研究报告系统](chapters/17-fullstack-project.md) | 整合所有技术的完整项目 |
128
+ | 18 | [选型决策树](chapters/18-selection-guide.md) | 如何选择合适的框架 |
129
+ | 19 | [Agent 通用工具箱](chapters/19-agent-toolkit.md) | 工具注册中心 / 审批网关 / 成本追踪等六件套 |
130
+ | 20 | [Codex CLI](chapters/20-codex-cli.md) | MCP 集成、四种审批模式、沙箱隔离 |
131
+ | 21 | [DeepSeek Harness](chapters/21-deepseek-harness.md) | 四种模式、SWE-bench、500+ 插件 |
132
+ | 22 | [Continue 编辑器](chapters/22-continue-editor.md) | VSCode / JetBrains 插件 |
133
+ | 23 | [Aider 代码助手](chapters/23-aider-codestory.md) | 多模型、Git 集成、会话恢复 |
134
+ | 24 | [Trae IDE](chapters/24-trae-ide.md) | AI 原生 IDE 工作流 |
135
+ | **25** | [**Harness Engineering**](chapters/25-harness-engineering.md) | **五支柱:2026 年 Agent 上生产的分水岭** |
136
+ | **26** | [**Agent Skills 编写实战**](chapters/26-agent-skills.md) | **SKILL.md 六字段规范 + 渐进式披露** |
137
+ | **27** | [**上下文工程**](chapters/27-context-engineering.md) | **Context Rot 机理 + 压缩三板斧** |
138
+ | 28 | [2026 热门项目全景](chapters/28-trending-2026.md) | 六大顶流串联地图 |
139
+ | 29 | [Agent 经济与商业化](chapters/29-agent-economy.md) | x402 / AP2 / Agent Identity |
140
+ | 30 | [Agent 评测体系](chapters/30-agent-evals.md) | EDD、三层评测金字塔 |
141
+ | 99 | [中英对照术语表](chapters/99-glossary.md) | 130+ 术语通俗解释 |
142
+
143
+ 配套:[11 个可运行示例](examples/) · [Agent Skill 包](skills/agent-handbook/SKILL.md)(装进 Agent 即可查阅全手册)· [PDF 全本](https://github.com/Xwh630/ai-agent-handbook/releases/latest) · [在线站点](https://xwh630.github.io/ai-agent-handbook/)
144
+
145
+ ---
146
+
147
+ ## 📡 Agent Radar 周刊
148
+
149
+ 每周一期,追踪 Agent 圈的新项目、框架版本、协议与玩法。**这是唯一一个每周都会更新的栏目**——想跟进度就 Watch 它。
150
+
151
+ | 期数 | 日期 | 亮点 |
152
+ |------|------|------|
153
+ | [第 6 期](radar/2026-W48.md) 🆕 | 2026-11-29 | Skills over MCP 公测、Personal Agent 升温、企业 AI 从信息走向行动(11 月回归特辑) |
154
+ | [第 5 期](radar/2026-W44.md) 🆕 | 2026-10-30 | 评测成为主战场、Agent 间协议互认、Harness 从概念走向榜单 |
155
+ | [第 4 期](radar/2026-W43.md) | 2026-10-23 | 终端 Agent 三国杀、上下文压缩工程化、开源评测集升温 |
156
+ | [第 3 期](radar/2026-W42.md) | 2026-10-13 | 上下文变成产品:claude-mem、context-mode、OptMem 三条路线 |
157
+ | [第 2 期](radar/2026-W41.md) | 2026-10-09 | Skills 时代开启、MCP 无状态化、上下文工程崛起 |
158
+ | [第 1 期](radar/2026-W40.md) | 2026-10-02 | Harness 元年、Skills 生态爆发、Computer Use 走向生产 |
159
+
160
+ > [进入栏目 →](radar/README.md) · 有料要爆料?[开个 Issue](https://github.com/Xwh630/ai-agent-handbook/issues/new?title=Radar投稿:)
161
+
162
+ ---
163
+
164
+ ## 动手跑起来
165
+
166
+ ```bash
167
+ git clone https://github.com/Xwh630/ai-agent-handbook.git
168
+ cd ai-agent-handbook
169
+ pip install -r requirements.txt
170
+ cp .env.example .env # 填 DeepSeek / 智谱 / OpenAI 任一 Key
171
+
172
+ cd examples/01-react-agent && python main.py
173
+ ```
174
+
175
+ 不想装 Python?`docker compose up -d && docker compose run dev bash`。
176
+
177
+ ---
178
+
179
+ ## 想参与
180
+
181
+ - **你的项目用了这本手册?** 提 PR 进 [`projects/`](projects/README.md),会被收进下一期 Radar 的「社区精选」固定位。
182
+ - **发现问题 / 想加章节?** 直接开 [Issue](https://github.com/Xwh630/ai-agent-handbook/issues),或来 [Discussions](https://github.com/Xwh630/ai-agent-handbook/discussions) 聊。
183
+ - **翻译**:英文版进度见 [TRANSLATION_STATUS](en/TRANSLATION_STATUS.md),目前 4/31 章,欢迎认领。
184
+ - 详细规范见 [CONTRIBUTING.md](CONTRIBUTING.md)。
185
+
186
+ ---
187
+
188
+ ## 支持这个项目
189
+
190
+ 这是一个**在校学生用课余时间维护**的项目——写代码、查资料、跟 CI 打架,都在放学后和周末。
191
+
192
+ 如果这份手册帮你少踩了一个坑:
193
+
194
+ - ⭐ **点个 Star**:它决定我下个周末是继续写第 32 章,还是去写作业
195
+ - 👁️ **Watch → Releases only**:每期 Radar 和每个版本都会通知你
196
+ - 手册核心**永久免费开源(MIT)**
197
+
198
+ > 📌 最新发布 **v1.6.0**(2026-11-29)· [更新日志](https://github.com/Xwh630/ai-agent-handbook/releases) · [路线图](ROADMAP.md)
199
+
200
+ ---
201
+
202
+ ## 许可与引用
203
+
204
+ MIT License,详见 [LICENSE](LICENSE)。用于课程、文章或项目时欢迎引用:
205
+
206
+ ```bibtex
207
+ @misc{ai_agent_handbook2026,
208
+ title = {AI Agent 实战手册 (AI Agent Handbook)},
209
+ author = {Xwh630},
210
+ year = {2026},
211
+ url = {https://github.com/Xwh630/ai-agent-handbook},
212
+ note = {31 章中文教程 + 11 个可运行示例 + agent-handbook CLI}
213
+ }
214
+ ```
215
+
216
+ <div align="center">
217
+
218
+ [报告问题](https://github.com/Xwh630/ai-agent-handbook/issues) · [功能建议](https://github.com/Xwh630/ai-agent-handbook/discussions) · [在线文档](https://xwh630.github.io/ai-agent-handbook/)
219
+
220
+ </div>
@@ -0,0 +1,188 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/banner.svg" alt="AI Agent 实战手册" width="760"/>
4
+
5
+ # AI Agent 实战手册
6
+
7
+ **31 章中文教程 + 一个能给你项目打分的命令行工具。**
8
+ 不是教你"会用"某个框架,而是让你看清一个 Agent 项目缺哪根柱子。
9
+
10
+ [![Stars](https://img.shields.io/github/stars/Xwh630/ai-agent-handbook?style=flat-square&color=E24B4A)](https://github.com/Xwh630/ai-agent-handbook)
11
+ [![Release](https://img.shields.io/github/v/release/Xwh630/ai-agent-handbook?style=flat-square&color=1D9E75)](https://github.com/Xwh630/ai-agent-handbook/releases)
12
+ [![Last Commit](https://img.shields.io/github/last-commit/Xwh630/ai-agent-handbook?style=flat-square&color=378ADD)](https://github.com/Xwh630/ai-agent-handbook/commits/main)
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](LICENSE)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 30 秒:给你的 Agent 项目做个体检
20
+
21
+ ```bash
22
+ uvx agent-handbook doctor .
23
+ ```
24
+
25
+ `uvx` 零安装;也可以用 `pipx run agent-handbook doctor .` 或 `pip install agent-handbook`。
26
+
27
+ > 💡 PyPI 上架中;当前可直接从源码安装:`pip install "git+https://github.com/Xwh630/ai-agent-handbook.git"`,装好后同样 `handbook doctor .`。
28
+
29
+ <img src="assets/shots/doctor-shot.svg" alt="handbook doctor 终端输出:五支柱体检报告,总分 3/10,评级 D" width="880"/>
30
+
31
+ 大多数「Agent 跑不稳」不是模型不行,而是**第 25 章那五根柱子少了几根**。
32
+ `doctor` 静态扫描你的代码,告诉你缺哪根、该读手册的哪一节——把方法论变成可核对的清单。
33
+
34
+ | 命令 | 干什么 |
35
+ |------|--------|
36
+ | `handbook doctor .` | 五支柱体检,0–10 分 + 补齐建议 |
37
+ | `handbook doctor . --md` | 输出 Markdown 表格,直接贴进 issue / README |
38
+ | `handbook search 上下文压缩` | 31 章全文检索,给出章节 + 行号 + 片段 |
39
+ | `handbook new my-agent` | 生成自带五支柱的 Agent 骨架(生成即满分) |
40
+ | `handbook stars` / `handbook list` / `handbook open 25` | 热度表 / 章节清单 / 章节定位 |
41
+
42
+ 零依赖、纯标准库、离线可用(章节数据随包安装)。
43
+
44
+ ### 放进 CI:分数掉了就让 PR 变红
45
+
46
+ ```yaml
47
+ - uses: Xwh630/ai-agent-handbook@main
48
+ with:
49
+ min-score: 6 # 低于 6 分本步骤失败(默认 0 = 只报告不拦)
50
+ ```
51
+
52
+ 它会把 `--md` 报告贴进 PR 评论,并在 Job Summary 里留一份,评审时能直接看到这次改动动了哪根柱子。
53
+
54
+ ---
55
+
56
+ ## 这本手册解决什么
57
+
58
+ | 你现在的处境 | 手册给的答案 |
59
+ |---|---|
60
+ | "Agent 能跑 demo,一上生产就崩" | 第 25 章:任务边界 / 上下文管理 / 状态持久化 / 失败恢复 / 权限体系 |
61
+ | "token 费用莫名爆炸" | 第 27 章:一次轮次的 token 构成解剖、压缩三板斧 |
62
+ | "团队经验带不进 Agent" | 第 26 章:SKILL.md 六字段规范与渐进式披露 |
63
+ | "不知道选哪个框架" | 第 18 章选型决策树 + 第 28 章 2026 顶流全景 |
64
+ | "完全没接触过" | 第 0 章:10 分钟跑通第一个 Agent |
65
+
66
+ **三条阅读路径**
67
+
68
+ - 🌱 零基础:第 0 章 → 第 1 章 → 第 2 章 → 第 7 章(Dify)
69
+ - 💻 会编程:第 2 章 → 框架三选一 → 第 25 章
70
+ - 🏗️ 要上生产:第 25 章 → 第 27 章 → 第 26 章 → 第 15 章
71
+
72
+ ---
73
+
74
+ ## 目录
75
+
76
+ | 编号 | 章节 | 一句话 |
77
+ |------|------|--------|
78
+ | 00 | [新手快速入门](chapters/00-quickstart.md) | 10 分钟跑通第一个 Agent |
79
+ | 01 | [AI Agent 基础概念](chapters/01-fundamentals.md) | Agent 本质、核心组件、ReAct 模式 |
80
+ | 02 | [从零手写 ReAct Agent](chapters/02-reaact-from-scratch.md) | 完整实现一个最小可用 Agent |
81
+ | 03 | [LangGraph 图编排](chapters/03-langgraph.md) | 复杂工作流、状态机、检查点 |
82
+ | 04 | [CrewAI 多智能体](chapters/04-crewai.md) | 角色化团队、任务分配 |
83
+ | 05 | [AutoGen / MAF](chapters/05-autogen.md) | 对话驱动协作、迭代求解 |
84
+ | 06 | [LlamaIndex RAG](chapters/06-llamaindex-rag.md) | 文档检索、向量数据库 |
85
+ | 07 | [Dify 低代码](chapters/07-dify.md) | 可视化拖拽构建应用 |
86
+ | 08 | [OpenAI Agents SDK](chapters/08-openai-agents.md) | 轻量级多 Agent |
87
+ | 09 | [Claude Agent SDK](chapters/09-claude-agents.md) | Anthropic 官方工具 |
88
+ | 10 | [Mastra TypeScript](chapters/10-mastra.md) | TS 优先的 Agent 框架 |
89
+ | 11 | [MCP 协议](chapters/11-mcp.md) | 标准化工具连接(含 2026 无状态核心) |
90
+ | 12 | [Ollama 本地部署](chapters/12-ollama.md) | 隐私保护、离线场景 |
91
+ | 13 | [多 Agent 协作模式](chapters/13-collaboration-patterns.md) | 6 种协作模式与决策树 |
92
+ | 14 | [记忆系统与状态管理](chapters/14-memory-state.md) | Mem0、向量记忆、持久化 |
93
+ | 15 | [Token 成本优化](chapters/15-cost-optimization.md) | 生产环境成本控制 |
94
+ | 16 | [调试与可观测性](chapters/16-observability.md) | LangSmith、日志、追踪 |
95
+ | 17 | [全栈实战:研究报告系统](chapters/17-fullstack-project.md) | 整合所有技术的完整项目 |
96
+ | 18 | [选型决策树](chapters/18-selection-guide.md) | 如何选择合适的框架 |
97
+ | 19 | [Agent 通用工具箱](chapters/19-agent-toolkit.md) | 工具注册中心 / 审批网关 / 成本追踪等六件套 |
98
+ | 20 | [Codex CLI](chapters/20-codex-cli.md) | MCP 集成、四种审批模式、沙箱隔离 |
99
+ | 21 | [DeepSeek Harness](chapters/21-deepseek-harness.md) | 四种模式、SWE-bench、500+ 插件 |
100
+ | 22 | [Continue 编辑器](chapters/22-continue-editor.md) | VSCode / JetBrains 插件 |
101
+ | 23 | [Aider 代码助手](chapters/23-aider-codestory.md) | 多模型、Git 集成、会话恢复 |
102
+ | 24 | [Trae IDE](chapters/24-trae-ide.md) | AI 原生 IDE 工作流 |
103
+ | **25** | [**Harness Engineering**](chapters/25-harness-engineering.md) | **五支柱:2026 年 Agent 上生产的分水岭** |
104
+ | **26** | [**Agent Skills 编写实战**](chapters/26-agent-skills.md) | **SKILL.md 六字段规范 + 渐进式披露** |
105
+ | **27** | [**上下文工程**](chapters/27-context-engineering.md) | **Context Rot 机理 + 压缩三板斧** |
106
+ | 28 | [2026 热门项目全景](chapters/28-trending-2026.md) | 六大顶流串联地图 |
107
+ | 29 | [Agent 经济与商业化](chapters/29-agent-economy.md) | x402 / AP2 / Agent Identity |
108
+ | 30 | [Agent 评测体系](chapters/30-agent-evals.md) | EDD、三层评测金字塔 |
109
+ | 99 | [中英对照术语表](chapters/99-glossary.md) | 130+ 术语通俗解释 |
110
+
111
+ 配套:[11 个可运行示例](examples/) · [Agent Skill 包](skills/agent-handbook/SKILL.md)(装进 Agent 即可查阅全手册)· [PDF 全本](https://github.com/Xwh630/ai-agent-handbook/releases/latest) · [在线站点](https://xwh630.github.io/ai-agent-handbook/)
112
+
113
+ ---
114
+
115
+ ## 📡 Agent Radar 周刊
116
+
117
+ 每周一期,追踪 Agent 圈的新项目、框架版本、协议与玩法。**这是唯一一个每周都会更新的栏目**——想跟进度就 Watch 它。
118
+
119
+ | 期数 | 日期 | 亮点 |
120
+ |------|------|------|
121
+ | [第 6 期](radar/2026-W48.md) 🆕 | 2026-11-29 | Skills over MCP 公测、Personal Agent 升温、企业 AI 从信息走向行动(11 月回归特辑) |
122
+ | [第 5 期](radar/2026-W44.md) 🆕 | 2026-10-30 | 评测成为主战场、Agent 间协议互认、Harness 从概念走向榜单 |
123
+ | [第 4 期](radar/2026-W43.md) | 2026-10-23 | 终端 Agent 三国杀、上下文压缩工程化、开源评测集升温 |
124
+ | [第 3 期](radar/2026-W42.md) | 2026-10-13 | 上下文变成产品:claude-mem、context-mode、OptMem 三条路线 |
125
+ | [第 2 期](radar/2026-W41.md) | 2026-10-09 | Skills 时代开启、MCP 无状态化、上下文工程崛起 |
126
+ | [第 1 期](radar/2026-W40.md) | 2026-10-02 | Harness 元年、Skills 生态爆发、Computer Use 走向生产 |
127
+
128
+ > [进入栏目 →](radar/README.md) · 有料要爆料?[开个 Issue](https://github.com/Xwh630/ai-agent-handbook/issues/new?title=Radar投稿:)
129
+
130
+ ---
131
+
132
+ ## 动手跑起来
133
+
134
+ ```bash
135
+ git clone https://github.com/Xwh630/ai-agent-handbook.git
136
+ cd ai-agent-handbook
137
+ pip install -r requirements.txt
138
+ cp .env.example .env # 填 DeepSeek / 智谱 / OpenAI 任一 Key
139
+
140
+ cd examples/01-react-agent && python main.py
141
+ ```
142
+
143
+ 不想装 Python?`docker compose up -d && docker compose run dev bash`。
144
+
145
+ ---
146
+
147
+ ## 想参与
148
+
149
+ - **你的项目用了这本手册?** 提 PR 进 [`projects/`](projects/README.md),会被收进下一期 Radar 的「社区精选」固定位。
150
+ - **发现问题 / 想加章节?** 直接开 [Issue](https://github.com/Xwh630/ai-agent-handbook/issues),或来 [Discussions](https://github.com/Xwh630/ai-agent-handbook/discussions) 聊。
151
+ - **翻译**:英文版进度见 [TRANSLATION_STATUS](en/TRANSLATION_STATUS.md),目前 4/31 章,欢迎认领。
152
+ - 详细规范见 [CONTRIBUTING.md](CONTRIBUTING.md)。
153
+
154
+ ---
155
+
156
+ ## 支持这个项目
157
+
158
+ 这是一个**在校学生用课余时间维护**的项目——写代码、查资料、跟 CI 打架,都在放学后和周末。
159
+
160
+ 如果这份手册帮你少踩了一个坑:
161
+
162
+ - ⭐ **点个 Star**:它决定我下个周末是继续写第 32 章,还是去写作业
163
+ - 👁️ **Watch → Releases only**:每期 Radar 和每个版本都会通知你
164
+ - 手册核心**永久免费开源(MIT)**
165
+
166
+ > 📌 最新发布 **v1.6.0**(2026-11-29)· [更新日志](https://github.com/Xwh630/ai-agent-handbook/releases) · [路线图](ROADMAP.md)
167
+
168
+ ---
169
+
170
+ ## 许可与引用
171
+
172
+ MIT License,详见 [LICENSE](LICENSE)。用于课程、文章或项目时欢迎引用:
173
+
174
+ ```bibtex
175
+ @misc{ai_agent_handbook2026,
176
+ title = {AI Agent 实战手册 (AI Agent Handbook)},
177
+ author = {Xwh630},
178
+ year = {2026},
179
+ url = {https://github.com/Xwh630/ai-agent-handbook},
180
+ note = {31 章中文教程 + 11 个可运行示例 + agent-handbook CLI}
181
+ }
182
+ ```
183
+
184
+ <div align="center">
185
+
186
+ [报告问题](https://github.com/Xwh630/ai-agent-handbook/issues) · [功能建议](https://github.com/Xwh630/ai-agent-handbook/discussions) · [在线文档](https://xwh630.github.io/ai-agent-handbook/)
187
+
188
+ </div>
@@ -0,0 +1,115 @@
1
+ """PEP 517 构建后端:在构建前把章节数据同步进包目录。
2
+
3
+ 背景
4
+ ----
5
+ ``chapters/`` 与 ``data/`` 是单一数据源,位于仓库根,不在 ``src/`` 下,
6
+ 因此不能直接作为包数据发布。过去的做法是打包前手动跑一次
7
+ ``scripts/build_cli.py``——但这带来两个后果:
8
+
9
+ 1. ``pip install git+https://github.com/Xwh630/ai-agent-handbook.git``
10
+ 装出来的是一个**没有章节数据的空壳 CLI**(``handbook list`` 直接报错);
11
+ 2. 任何忘记预同步的构建都会静默产出残缺包。
12
+
13
+ 本文件是一个 in-tree 构建后端(``backend-path = ["."]``),在每个构建入口
14
+ 被调用时先把 ``chapters/*.md`` 与 ``data/stars.*`` 复制进
15
+ ``src/agent_handbook/``,再转交给 setuptools。这样无论从 git 安装、从
16
+ sdist 安装还是发 PyPI,拿到的包都自带完整数据,且无需任何手动前置步骤。
17
+
18
+ 只在构建时运行,对仓库内开发(直接 ``python -m agent_handbook.cli``)无影响。
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import shutil
24
+ from pathlib import Path
25
+
26
+ from setuptools import build_meta as _setuptools_backend
27
+
28
+ ROOT = Path(__file__).resolve().parent
29
+ PKG = ROOT / "src" / "agent_handbook"
30
+
31
+ #: 需要随包发布、但源文件在仓库根的数据文件
32
+ _DATA_FILES = ("stars.json", "stars-history.csv")
33
+
34
+
35
+ def _sync_package_data() -> int:
36
+ """把 chapters/ 与 data/ 的最新内容复制进包目录,返回复制的文件数。"""
37
+ copied = 0
38
+
39
+ dst_chapters = PKG / "chapters"
40
+ if dst_chapters.exists():
41
+ shutil.rmtree(dst_chapters)
42
+ dst_chapters.mkdir(parents=True, exist_ok=True)
43
+ for md in sorted((ROOT / "chapters").glob("*.md")):
44
+ shutil.copy2(md, dst_chapters / md.name)
45
+ copied += 1
46
+
47
+ dst_data = PKG / "data"
48
+ if dst_data.exists():
49
+ shutil.rmtree(dst_data)
50
+ dst_data.mkdir(parents=True, exist_ok=True)
51
+ for name in _DATA_FILES:
52
+ src = ROOT / "data" / name
53
+ if src.exists():
54
+ shutil.copy2(src, dst_data / name)
55
+ copied += 1
56
+
57
+ return copied
58
+
59
+
60
+ def _prepare() -> None:
61
+ # 同步失败不该让构建莫名其妙地成功,直接抛出来
62
+ count = _sync_package_data()
63
+ if count == 0:
64
+ raise RuntimeError(
65
+ "构建后端没有同步到任何数据文件;请确认 chapters/ 与 data/ 存在。"
66
+ )
67
+
68
+
69
+ # --- PEP 517 必需入口:转发给 setuptools -----------------------------------
70
+
71
+ def get_requires_for_build_wheel(config_settings=None):
72
+ return _setuptools_backend.get_requires_for_build_wheel(config_settings)
73
+
74
+
75
+ def get_requires_for_build_sdist(config_settings=None):
76
+ return _setuptools_backend.get_requires_for_build_sdist(config_settings)
77
+
78
+
79
+ def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
80
+ _prepare()
81
+ return _setuptools_backend.prepare_metadata_for_build_wheel(
82
+ metadata_directory, config_settings
83
+ )
84
+
85
+
86
+ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
87
+ _prepare()
88
+ return _setuptools_backend.build_wheel(
89
+ wheel_directory, config_settings, metadata_directory
90
+ )
91
+
92
+
93
+ def build_sdist(sdist_directory, config_settings=None):
94
+ _prepare()
95
+ return _setuptools_backend.build_sdist(sdist_directory, config_settings)
96
+
97
+
98
+ def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
99
+ _prepare()
100
+ return _setuptools_backend.build_editable(
101
+ wheel_directory, config_settings, metadata_directory
102
+ )
103
+
104
+
105
+ # --- PEP 660 可选入口 -------------------------------------------------------
106
+
107
+ def get_requires_for_build_editable(config_settings=None):
108
+ return _setuptools_backend.get_requires_for_build_editable(config_settings)
109
+
110
+
111
+ def prepare_metadata_for_build_editable(metadata_directory, config_settings=None):
112
+ _prepare()
113
+ return _setuptools_backend.prepare_metadata_for_build_editable(
114
+ metadata_directory, config_settings
115
+ )