What Topics Are Covered in the AI Agent Book? A Complete Chapter-by-Chapter Breakdown
The AI Agent Book covers ten core chapters spanning from foundational concepts (Agent = LLM + Context + Tools) to advanced topics like multimodal interaction and multi-agent collaboration, plus an afterword on future trajectories.
The open-source technical guide by Bojie Li, hosted in the bojieli/ai-agent-book repository, provides a comprehensive roadmap for building production-grade AI agents. The book progresses from architectural fundamentals to cutting-edge research topics, with practical code examples and implementation patterns throughout.
Core Architecture and Foundations
The first two chapters establish the theoretical bedrock of modern agent systems, defining what distinguishes an agent from a simple chat interface.
The Agent Formula and ReAct Loop (Chapter 1)
According to book/chapter1.md, the book introduces the canonical decomposition: Agent = LLM + Context + Tools. This three-component view frames the LLM as the "brain," context as the "eyes," and tools as the "hands" of the system. The chapter dissects the ReAct (Reasoning and Acting) loop, demonstrating how agents interleave thought processes with tool invocations.
The repository includes a concrete trajectory example showing this pattern:
# book/chapter1/chapter1.md (excerpt)
trajectory = [
{"role": "user", "content": "Calculate total revenue in multiple currencies"},
{"role": "assistant", "reasoning": "Convert each amount to USD", "tool_calls": [
{"name": "convert_currency", "args": {"amount": 2100000, "from": "EUR", "to": "USD"}},
{"name": "convert_currency", "args": {"amount": 1800000, "from": "GBP", "to": "USD"}}
]},
{"role": "tool", "content": "EUR→USD: 2,282,608.7"},
{"role": "tool", "content": "GBP→USD: 2,278,481.0"},
{"role": "assistant", "reasoning": "Sum the converted values", "tool_calls": [
{"name": "code_interpreter", "args": {"code": "total = 2500000 + 2282608.7 + 2278481.0"}}
]},
{"role": "tool", "content": "Total: $9,602,895.73"},
{"role": "assistant", "content": "FINAL ANSWER: Total revenue is $9.6 M"}
]
This loop feeds the full trajectory (static prefix plus dynamic history) back to the LLM, enabling step-wise reasoning and tool usage.
Context Engineering (Chapter 2)
Chapter 2 focuses on context window management, covering prompt engineering techniques, retrieval-augmented generation (RAG), and strategies for compressing large amounts of information into limited token budgets. The chapter addresses how to build effective context structures that maximize model performance without exceeding constraints.
Memory, Knowledge, and Tools
Chapters 3 and 4 transition from theory to data persistence and external capability integration.
User Memory and RAG Systems (Chapter 3)
Detailed in book/chapter3.md, this section covers persistent user memory across sessions, including vector-based retrieval systems, structured indexes, and knowledge-graph construction. The content explores how agents maintain state and accumulate user-specific knowledge over time.
Tool Definition and the MCP Protocol (Chapter 4)
The book classifies tools into five categories: perception, execution, collaboration, event-trigger, and communication. A significant portion of book/chapter4.md dedicates coverage to the Model-Context-Protocol (MCP), a specification for standardizing tool definitions.
The repository provides this MCP-style tool definition example:
# book/chapter4/perception-tools/TOOL_REFERENCE.md
tools = [
{
"name": "get_weather",
"description": "Retrieve current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
]
This JSON schema is injected into the LLM's context, allowing the model to decide when and how to invoke capabilities.
Specialized Agent Types and Evaluation
The middle chapters address domain-specific implementations and quality assurance.
Coding Agents and Sandboxed Execution (Chapter 5)
Chapter 5 treats code as "a tool that creates new tools," covering sandboxed code execution environments and production-grade coding agents. The material addresses security boundaries and how agents can generate, execute, and debug code safely.
Evaluation Metrics and Benchmarking (Chapter 6)
book/chapter6.md establishes frameworks for designing evaluation environments, selecting appropriate metrics, ensuring statistical significance, and creating reproducible benchmarks. This chapter provides the methodology for validating agent performance before deployment.
Training and Continuous Improvement
Chapters 7 and 8 move beyond prompt engineering into model-level customization and runtime adaptation.
Post-Training and Fine-Tuning (Chapter 7)
This chapter covers supervised fine-tuning (SFT) and reinforcement learning (RL) specifically for agent behaviors. The focus is on internalizing tool-calling strategies and complex reasoning patterns directly into the model weights rather than relying solely on in-context learning.
Evolution and Knowledge Updates (Chapter 8)
Detailed in book/chapter8.md, this section explores continuous agent evolution—how systems can update themselves from runtime experience. Topics include converting accumulated knowledge into new instructions and parameter updates without catastrophic forgetting.
Advanced Interaction and Multi-Agent Systems
The final chapters address sophisticated deployment scenarios and distributed architectures.
Multimodal and Real-Time Agents (Chapter 9)
Chapter 9 expands beyond text to voice agents, computer-use agents, and robot control systems. The content covers handling real-time sensory streams and the unique challenges of processing multimodal inputs with low latency.
Multi-Agent Collaboration (Chapter 10)
book/chapter10.md presents architectures for cooperating agents, analyzing failure modes in distributed systems and the societal implications of large-scale agent ecosystems. This chapter addresses coordination protocols and emergent behaviors in multi-agent environments.
Future Perspectives
The Afterword in book/afterword.md provides forward-looking analysis on whether foundation models will eventually subsume the surrounding "harness" code, and discusses the long-term trajectory of AI agent development.
Summary
- The book defines agents through the formula Agent = LLM + Context + Tools, implemented via the ReAct loop pattern found in
book/chapter1.md. - Context engineering (Chapter 2) and memory systems (Chapter 3) provide the infrastructure for stateful interactions.
- The MCP Protocol (Chapter 4) standardizes tool integration across different agent implementations.
- Coding agents (Chapter 5) and evaluation frameworks (Chapter 6) bridge development and production.
- Post-training techniques (Chapter 7) and continuous evolution (Chapter 8) enable long-term improvement.
- Multimodal interaction (Chapter 9) and multi-agent collaboration (Chapter 10) represent the frontier of agent capabilities.
Frequently Asked Questions
What is the core formula for AI agents described in the book?
The book defines an agent as Agent = LLM + Context + Tools, where the LLM serves as the reasoning brain, context provides situational awareness (the "eyes"), and tools enable environmental interaction (the "hands"). This decomposition appears in book/chapter1.md and serves as the foundational architecture throughout the text.
Does the book cover practical implementation or just theory?
The repository balances conceptual frameworks with concrete code. Practical examples include MCP tool definitions in book/chapter4/perception-tools/TOOL_REFERENCE.md and ReAct loop implementations in book/chapter1.md. Each chapter includes engineering patterns for production deployment, not just abstract algorithms.
What is the MCP Protocol mentioned in Chapter 4?
The Model-Context-Protocol (MCP) is a specification for defining tool schemas that LLMs can consume. As shown in the book's examples, it uses JSON Schema to describe function signatures, enabling models to understand available capabilities and generate appropriate call signatures during the ReAct loop.
How does the book address agent evaluation?
Chapter 6 dedicates coverage to designing evaluation environments and establishing statistical significance in benchmarks. The material covers metric selection, reproducible testing protocols, and validation strategies necessary before deploying agents to production environments.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →