Bojie Li's AI Agent Book: Open-Source Textbook, 10 Chapters, and Runnable Code
Is bojieli/ai-agent-book free? English PDF? What to run first? explainx.ai maps 李博杰's 6.7k-star Apache 2.0 textbook — Agent = LLM + Context + Tools — vs MCP, skills, loop engineering, and coding-agent guides.
July 2026:bojieli/ai-agent-book crossed ~6.7k GitHub stars and 618 forks roughly one week after the repo went public on July 13 — per the maintainer's star-history chart in assets/. Author 李博杰 (Bojie Li / bojieli) open-sourced 《深入理解 AI Agent:设计原理与工程实践》 — English subtitle "AI Agents in Depth" — as a full textbook: 10 chapters, Apache 2.0 license, Chinese PDF v1.1, community English/Tamil/Vietnamese PDFs, and chapter-matched runnable code.
If you landed from GitHub Trending or a Chinese AI thread, you probably want answers before you clone 294 commits of Python: Is it free?English version?What runs today without a GPU cluster?How does this relate to MCP, agent skills, and loop engineering?
This post is that map — question-first, honest about Chinese-first lag and external-repo dependencies, with copy-paste paths for the demos worth running this week.
Compiled PDFs: Chinese original book/深入理解-AI-Agent-李博杰-v1.1.pdf; English book-en/AI-Agents-in-Depth-Bojie-Li-v1.1.pdf; Tamil and Vietnamese community builds
Companion code:chapter1/ … chapter10/ with projects labeled ✅ runnable, 📖 reproduction guide (external clone), or 🚧 design doc only
July 2026 repo activity worth noting: Chapter 5 was reorganized — security consolidated, new failure & error recovery section; Tamil/Vietnamese READMEs landed; star-history matplotlib chart added to assets/ with daily GitHub Actions refresh.
What people are asking after they star the repo
"Do I need to read Chinese?"
Chinese is the authoritative language for the PDF and fastest-updated prose. English readers should use:
README.en.md for repo navigation
book-en/AI-Agents-in-Depth-Bojie-Li-v1.1.pdf for chapter text
Code READMEs — mostly English for runnable paths
Expect lag: Community translations trail the Chinese book/ commits. If you're citing the new ch5 failure-recovery material from July 2026, verify it exists in book-en/ before assuming parity.
"Which projects run today vs need external clones?"
The repo labels every project. EXPERIMENT_TRIAGE.md is the honest index. Rule of thumb:
Icon
Meaning
Your action
✅
Runnable in-repo
cd chapterN/project && follow README; set API key
📖
Reproduction guide
git clone external benchmark/training repo per appendix
🚧
Design doc only
Read architecture; code pending
Not ✅ without extra work: Chapter 6 benchmarks (Terminal-Bench, SWE-bench, GAIA, OSWorld), most chapter 7 training frameworks, chapter 9 browser-use / claude-quickstarts, chapter 10 use-computer-while-calling (moved to TalkAct upstream).
Appendix clone commands live at the bottom of the README — save them as a script when you need eval or training depth, not on day one.
agent-with-event-trigger — FastAPI event-driven agent loading all three MCP servers
Chapter 2's agent-skills-ppt implements progressive disclosure — thin skill catalog at startup, full pptx skill loaded on demand — the same pattern explainx.ai documents in What are agent skills?. If you've installed skills via npx skills or the /skills registry, this demo shows the mechanism in plain Python.
Chapter 5's coding-agent is a pedagogical counterpart to product harnesses like OpenCode and Claude Code: 17 pure-Python tools, pure-Python grep (no ripgrep binary), multi-provider (Anthropic, OpenAI, OpenRouter), persistent shell, lint detection, streaming. It teaches how a coding agent is built — not which subscription to buy.
What to run first — copy-paste paths
1. Clone and orient
bash
git clone https://github.com/bojieli/ai-agent-book.git
cd ai-agent-book
# Read labels before investing timecat EXPERIMENT_TRIAGE.md
2. Chapter 1 — model-as-agent search
bash
cd chapter1/web-search-agent
# Follow README: set MOONSHOT_API_KEY or provider of choice
python main.py # or entrypoint named in README
Why first: Smallest loop that shows LLM + tools without MCP boilerplate. Pairs with chapter1/context for ablation — toggle context components and watch behavior shift (SiliconFlow Qwen, Doubao, Kimi supported).
cd chapter5/coding-agent
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY / OpenRouter
python -m coding_agent # verify exact module in README
17 tools, Mac-friendly (no CLI ripgrep dependency). July 2026: security section consolidated; failure & error recovery added — read book/chapter5.md or PDF before hardening your own harness.
Also worth it in ch5:
adaptive-log-parser — self-healing: failed parse → codegen new parser → hot reload
log-diagnosis — trace replay + regression test generation
erp-agent — NL2SQL artifact pattern (LLM writes SQL, DB returns rows — no token-heavy data through the model)
6. Chapter 8 & 10 — when you want "wow" demos
bash
cd chapter8/self-evolving-tools
# Alita-style: discover libraries from the web, sandbox-test, register toolscd ../../chapter10/voice-werewolf
# Multi-agent private contexts + deterministic judge auditcd ../parallel-web-research
# Parallel search agents + cascade cancel when one hits
API keys — what the README recommends
You need at least one LLM provider for most ✅ demos. The maintainer suggests:
One key for Claude, GPT, Gemini without separate billing setups
Cost sanity check: Run chapter6/model-benchmark (TTFT, p50/p95 latency) and chapter6/agent-cost-analysis (per-step token/cost tracing on a refund workflow) before picking a default provider for long agent sessions.
Bottom line: explainx.ai answers "how do I configure X today?" The book answers "how would I build X from first principles?" They're complementary — not substitutes.
Honest limitations (read before you commit a weekend)
Chinese-first, translations lag — English PDF is community-maintained; newest security/failure-recovery prose may be Chinese-only briefly.
Chapter 6/7/9/10 heavy lifters need external clones — SWE-bench, verl, browser-use, TalkAct, robot sims — not in-repo.
API costs add up — ablation sweeps and multi-agent games burn tokens; use ch6 cost tools first.
Not a hosted course — no LMS, no certificates; you self-navigate EXPERIMENT_TRIAGE.md.
Product harnesses move faster than PDFs — Claude Code /loop, Cursor subagents, OpenCode Zen may outpace book examples; cross-check explainx.ai for current CLI flags.
Single open issue, nine open PRs (as of user share) — active but young; pin commits when reproducing paper numbers.
Who should read this book?
Strong fit:
Engineers building custom agents who want theory + runnable reference implementations
Teams standardizing on MCP who want three worked server types before writing their own
Readers of Chinese AI engineering discourse who want the 李博杰 curriculum in one repo
Skip or defer if:
You only need Claude Code / Cursor setup — start with explainx.ai harness guides instead
You have no API budget and won't run local models — many loops need inference
You want certification or video lectures — this is text + code
Summary
bojieli/ai-agent-book is the most complete open-source AI agent textbook shipped in July 2026: Apache 2.0, ~6.7k stars, Agent = LLM + Context + Tools, and harness engineering as the moat. Read the Chinese or community English PDF, then run chapter1/web-search-agent → chapter2/kv-cache → chapter4/perception-tools → chapter5/coding-agent before touching external benchmark clones.
Pair it with explainx.ai's live coverage of MCP, agent skills, loop engineering, and OpenCode for the full picture — book for depth, explainx.ai for deployment reality.
Repository stats, star counts, chapter labels, and translation status are accurate as of July 20, 2026. Verify ✅/📖/🚧 labels in EXPERIMENT_TRIAGE.md before planning a reproduction — the maintainer adds runnable demos frequently.