Repolode
bojieli

bojieli/ai-agent-book

A free, open-source Chinese-language book on AI Agent design principles and engineering practice, with 109 companion experiments and downloadable PDF/EPUB.

Stars
54,919
Forks
6,280
Open issues
35
Last commit
12 days ago

What is it?

This repository holds the full text, illustrations, and companion code for the book "Deep Understanding of AI Agents: Design Principles and Engineering Practice". The book's core formula is Agent = LLM + context + tools, and it walks through ten chapters from fundamentals to production, covering context engineering, user memory and RAG, tool use via MCP, coding agents, interaction with voice and computer use, evaluation, model post-training, continual improvement, and multi-agent collaboration.

The repository includes the Chinese source in Markdown, SVG figures, and build scripts for PDF and EPUB output. Community translations into more than a dozen languages are provided, and an online reader is published on GitHub Pages. Each chapter has its own set of runnable experiments organized as Python projects installable with uv or pip, and the appendix lists external repositories pinned to specific commits for reproducing some of the experiments.

The book states a low prerequisite bar for most chapters: intermediate Python, prior use of LLM chat products, and basic command-line and Git knowledge. Only the post-training chapter assumes meaningful math and machine learning background.

Key features

  • 01Ten chapters covering context engineering, memory and RAG, MCP tools, coding agents, and multi-agent systems.
  • 02109 companion experiments organized by chapter, each runnable as a Python project.
  • 03Downloadable PDF and EPUB builds, plus an online reader.
  • 04Chinese source in Markdown with SVG figures and build scripts for reproducing the book.
  • 05Community translations into more than a dozen languages.

Use cases

  • Developers who want a structured, principles-first understanding of building AI agents.
  • Engineers building a coding agent who want to follow the book's chapter-by-chapter experiments.
  • Teams setting up evaluation sets and iterating on agent failures, guided by the evaluation chapter.
  • Readers who prefer working through code while reading a Chinese-language technical book.

Quick start

  1. 1

    Install dependencies for chapter 1 with uv (Python 3.11–3.13)

    uv sync --locked --extra ch1
  2. 2

    Copy .env.example to .env and add at least one model provider API key

  3. 3

    Run a chapter 1 experiment from the repository root

    uv run python chapter1/context/main.py

Things to know

  • Most experiments call LLM providers, so you need your own API key, which may be paid.
  • Some experiments need extra system dependencies such as browsers, CUDA, FFmpeg or Ollama, and some chapter 8 components require Python 3.12+.
  • The companion experiments include external repositories that must be cloned manually into their folders.

Topics

FAQ

What is ai-agent-book?
A free, open-source Chinese-language book on AI Agent design principles and engineering practice, with 109 companion experiments and downloadable PDF/EPUB. This repository holds the full text, illustrations, and companion code for the book "Deep Understanding of AI Agents: Design Principles and Engineering Practice". The book's core formula is Agent = LLM + context + tools, and it walks through ten chapters from fundamentals to production, covering context engineering, user memory and RAG, tool use via MCP, coding agents, interaction with voice and computer use, evaluation, model post-training, continual improvement, and multi-agent collaboration.
Is ai-agent-book free to use? What license does it have?
ai-agent-book is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is ai-agent-book still maintained?
Actively maintained. The last commit to ai-agent-book was on Oct 8, 2026.
What can I use ai-agent-book for?
Developers who want a structured, principles-first understanding of building AI agents. Engineers building a coding agent who want to follow the book's chapter-by-chapter experiments. Teams setting up evaluation sets and iterating on agent failures, guided by the evaluation chapter. Readers who prefer working through code while reading a Chinese-language technical book.
How do I install ai-agent-book?
Install dependencies for chapter 1 with uv (Python 3.11–3.13): uv sync --locked --extra ch1 Copy .env.example to .env and add at least one model provider API key Run a chapter 1 experiment from the repository root: uv run python chapter1/context/main.py
Where can I get ai-agent-book?
The source code and installation instructions are on GitHub: https://github.com/bojieli/ai-agent-book

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects