Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

bojieli/ai-agent-book

Learning Resources

A free, open-source book with source text, PDF/EPUB downloads, and 109 hands-on AI Agent experiments for developers.

58,681
6,867
Python
Apache-2.0
1 year old

What it is

A freely available Chinese book, 深入理解 AI Agent: 设计原理与工程实践, written by Bojie Li, released as a repository: the full manuscript, SVG figures, chapter-level lab code, and PDF/EPUB builds. The book is organized around one formula, Agent = LLM + context + tools, and moves from fundamentals through context engineering, memory and RAG, tools and MCP, coding agents, interaction modalities, evaluation, post-training, continuous evolution, and multi-agent collaboration across 10 chapters Chapter overview.

The primary audience is developers who can read and modify moderately complex Python, have used LLM products and an AI coding assistant, and know the command line, Git, JSON, and REST APIs. Math and ML background are only required for the post-training chapter. Community translations exist in 14 other languages, marked as possibly lagging the Chinese original.

Getting the book

No compilation is needed. Download the Chinese PDF or EPUB, or read online with language switching, collapsible chapters, highlights, and notes. Fixed versions live in Releases; the latest links follow the main branch. Other languages have their own PDF/EPUB pairs, for example English PDF and Japanese PDF. To rebuild from source, install pandoc, xelatex, the ElegantBook class and required fonts, then run cd book && bash build_pdf.sh; chapters are book/chapter1.md through book/chapter10.md build notes.

Running the labs

Lab code requires Python 3.11–3.13 and is installed per chapter from the repository root. With uv:

uv sync --locked --extra ch1

Without uv, use pip against the extra:

python -m pip install -e ".[ch1]"

Replace ch1 with ch2–ch10. Experiments that call a model need API credentials: copy .env.example to .env and add at least one provider key, or follow the experiment's own README where it requires a local .env or exported variables. Then run from the root, for example:

uv run python chapter1/context/main.py

Read the target experiment's README before setup: extras such as vllm or unsloth must be added to the same command, and some chapters need browsers, CUDA, FFmpeg, Ollama, or Playwright; parts of chapter 8 require Python 3.12+ lab instructions. Chapters 6, 7, 8, and 10 map to 22 external repositories that are not bundled and must be cloned at pinned commits with the provided script.

Constraints and status

API access is your own cost; the README lists several providers, including a sponsor with a reader discount. The book notes that lab code was generated by coding agents and is not line-by-line reviewed by the author; some labs are marked as reproduction or design rather than runnable. Per-experiment execution status lives in the repository's experiment-status file, and a checkout or successful install is explicitly not a claim that an experiment has been completed. The project is Apache-2.0, with possible per-subproject licenses.

HotRepo's take

The repository accumulated stars quickly in the July 2026 daily records: 1,734 on July 20, 4,434 on July 21, and 4,624 on July 22, reaching roughly 39,000 by mid-August. On November 18, 2026 it appeared at rank 16 on the Python daily list with 171 stars gained and about 58,600 total stars. Those are separate snapshots, not a sustained trend line, but they show a book repository collecting attention at a scale unusual for long-form technical writing. What backs that attention in the repository itself is the complete manuscript plus 109 mapped experiments with pinned external dependencies; the caveat is that the README separates source presence from actually executed labs, so readers should check per-chapter status before treating any experiment as verified.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

You might also like

  1. bojieli/ai-infra-bookAn open book that derives LLM inference and training system design from hardware constraints and model architecture.Python7,796
  2. aa1143/NamiAgentA hands-on course that builds a working local AI agent from a 100-line loop to tools, memory, MCP, and a web UI.Python113
  3. virgiliojr94/book-to-skillConvert technical books, docs folders and other prose sources into on-demand agent skills for Claude Code and compatible hosts.Python38,206
  4. didilili/mianstackAn open-source Chinese interview question bank with Markdown answers, real interview reports, and company-specific study indexes.JavaScript115
  5. EbookFoundation/free-programming-booksA multilingual index of free programming books, courses, cheat sheets, podcasts, and interactive tutorials for learners and contributors.Python401,179