Glean 拾遗
日刊 /2026-07-26 / AI Agent 工程实践全覆盖:从原理到生产的开源书

AI Agent 工程实践全覆盖:从原理到生产的开源书

原文 github.com 收录 2026-07-26 06:00 阅读 15 min
AI 解读

《深入理解 AI Agent:设计原理与工程实践》是一本全面覆盖 AI Agent 技术的开源书籍,由李博杰撰写。围绕核心公式“Agent = LLM + 上下文 + 工具”,以 10 章从基础知识、上下文工程、用户记忆、工具使用、Coding Agent、评估、模型后训练、持续进化、多模态到多 Agent 协作,层层递进。书中包含 92 个配套实验(70+ 可独立运行),覆盖 MCP、RAG、强化学习等前沿实践。适合对 AI Agent 感兴趣的工程师、研究者以及希望构建生产级 Agent 系统的开发者。

原文 15 分钟
原文 github.com ↗
§ 1

AI Agent Book is an open-source, comprehensive guide to building AI agents from principles to production. Authored by Bojie Li, it spans 10 chapters with 92 hands-on experiments (70+ runnable standalone). The book is available in 7 languages (Chinese, English, Traditional Chinese, Russian, Tamil, Vietnamese, Japanese) as free PDF/EPUB downloads or as an online readable site. The entire corpus—text, figures, and code—is hosted on GitHub under the Apache 2.0 license.

《深入理解 AI Agent:设计原理与工程实践》是一本开源、覆盖 AI Agent 从原理到生产的系统教程。作者李博杰,全书10章,配套92个动手实验(其中70+可独立运行)。书籍支持7种语言(中文、英文、正体中文、俄语、泰米尔语、越南语、日语),提供免费的 PDF/EPUB 下载和在线阅读。全书正文、配图与代码全部托管在 GitHub,采用 Apache 2.0 许可。

§ 2

While LLMs have advanced rapidly, building production-grade AI agents requires more than just calling an API. Developers face fragmented knowledge around context management, tool integration, memory, evaluation, and multi-agent coordination. This book bridges that gap by offering a structured, end-to-end curriculum: from core concepts and context engineering to model post-training and multi-agent societies. Each chapter builds on the previous, culminating in a full-stack understanding of agent development.

虽然大语言模型发展迅猛,但构建生产级的 AI Agent 远不止调用 API 那么简单。开发者面临上下文管理、工具集成、记忆、评估、多智能体协作等碎片化的知识点。本书提供了一条结构化的端到端学习路径:从核心概念和上下文工程,到模型后训练和多智能体协作,每章层层递进,最终形成对 Agent 开发的全栈理解。

§ 3

The book is organized around the formula Agent = LLM + Context + Tools. Chapters 1–4 lay foundational capabilities: context engineering (KV Cache, prompt engineering, skills, compression), user memory and knowledge bases (RAG, knowledge graphs), and tools (MCP protocol, event-driven agents, active tool discovery). Chapter 5 dives into coding agents. Chapters 6–7 cover evaluation (benchmarks, statistical significance) and model post-training (SFT vs RL, tool-use internalization). Chapter 8 addresses continuous improvement from runtime traces. Chapter 9 extends to multimodal and real-time interaction (voice, GUI, robotics). Chapter 10 explores multi-agent collaboration and emergent “agent societies.” Each chapter includes a digest of the core idea and a link to its companion code directory.

全书围绕 Agent = LLM + 上下文 + 工具 这一核心公式展开。第1–4章构建基础能力:上下文工程(KV Cache、提示工程、技能、压缩)、用户记忆与知识库(RAG、知识图谱)、工具(MCP 协议、事件驱动 Agent、主动工具发现)。第5章深入编码 Agent。第6–7章涵盖评估(基准、统计显著性)和模型后训练(SFT 与 RL、工具使用内化)。第8章讨论从运行轨迹持续改进。第9章扩展到多模态与实时交互(语音、GUI、机器人)。第10章探索多智能体协作与涌现的“Agent 社会”。每章都提炼了核心理念并附有配套代码目录链接。

§ 4

To bridge theory and practice, the book provides 92 experiments distributed across chapters (4 in Ch1, 9 in Ch2, 13 in Ch3, etc.). Over 70 of them are self-contained and can be run independently with minimal setup. The experiments range from simple context injection demos to full training loops (e.g., training a mini LLM from scratch in Ch7) and multi-agent coordination (e.g., Stanford AI Town in Ch10). Each experiment resides in a dedicated chapterN/ folder with its own README, ensuring reproducibility. Some advanced experiments rely on external repositories (19 in total), which are listed with clone commands in the appendix.

为了衔接理论与实践,全书配备了92个实验(第1章4个、第2章9个、第3章13个等),其中70+可以独立运行,设置简单。实验覆盖从简单的上下文注入演示到完整的训练流程(如第7章从零训练迷你LLM)和多智能体协调(如第10章的斯坦福AI小镇)。每个实验都位于对应的chapterN/目录下,自带README说明,确保可复现。部分高级实验依赖外部仓库(共19个),附录中提供了一键克隆脚本。

§ 5

Getting started is straightforward. Download the PDF or EPUB for offline reading, or visit the online site (bojieli.github.io/ai-agent-book) for instant browsing with multi-language toggle, search, and direct links to experiments. To run the code, clone the main repository, then follow each chapter's instructions. Most experiments require API keys from providers like Kimi, DeepSeek, or OpenRouter (recommended in the README). For chapters 6, 7, 9, and 10, you may need to clone additional external repositories using the provided one-liner scripts. The repo includes a build_pdf.sh script for those who want to compile the book from source.

上手非常简单:下载 PDF 或 EPUB 离线阅读,或访问在线站点(bojieli.github.io/ai-agent-book)浏览,支持多语言切换、搜索和直达实验。要运行代码,克隆本仓库,然后按各章 README 操作。大多数实验需要 API Key(推荐来自 Kimi、DeepSeek、OpenRouter 等平台)。第6、7、9、10章可能需要额外克隆19个外部仓库,附录中提供了一键脚本。仓库还包括 build_pdf.sh 脚本供想要从源码编译书籍的用户使用。

§ 6

The book has been translated into 6 additional languages by community volunteers (English, Traditional Chinese, Russian, Tamil, Vietnamese, Japanese). Translations are kept in corresponding book-*/ directories and may lag behind the Chinese original. Contributions are warmly welcomed—whether for errata, clearer explanations, new experiments, figure improvements, or new translations. The project also has a sponsor, Krill AI, which offers a discount code for readers. A star history chart shows the repository's growing popularity, updated daily via GitHub Actions.

本书已被社区志愿者翻译为6种其他语言(英文、正体中文、俄语、泰米尔语、越南语、日语)。翻译版本存放于对应的 book-*/ 目录,可能滞后于中文原版。非常欢迎社区贡献——无论是勘误、更清晰的表述、新实验、配图改进还是新语言翻译。项目赞助商 Krill AI 为读者提供优惠码。Star 历史图展示了仓库日益增长的人气,通过 GitHub Actions 每日更新。

§ 7

This book is ideal for engineers and researchers who already have basic knowledge of LLMs and want to dive deep into building production-grade agents. The experiments assume familiarity with Python and basic ML concepts. Limitations: some experiments require custom hardware (e.g., XLeRobot robotic arm for Ch9) or external repositories (19 in total) that must be cloned separately. The English and other translations may not be as up-to-date as the Chinese original. The book is a tutorial, not a reference; it focuses on building understanding rather than providing a one-size-fits-all solution.

本书适合已有LLM基础知识、希望深入构建生产级Agent的工程师和研究员。实验需要Python和基本机器学习概念的基础。已知限制:部分实验需要特定硬件(如第9章的 XLeRobot 机械臂)或必须额外克隆19个外部仓库。英文等翻译版本可能滞后于中文原版。本书是教程而非参考书,重在构建理解而非提供通用解决方案。

打开原文 ↗