AgenticRAGMCPFine-Tuning

AI Agents in Depth: Design Principles and Engineering Practice

by Bojie Li

IntermediateBookFree10 chapters; ~25-40 hours to read, plus optional runnable experiments (some need a GPU)

A free, open-source 10-chapter textbook on building AI agents, from context engineering and memory to evals, post-training and multi-agent systems, with runnable Python experiments.

Start LearningAdded Sep 29, 2026 · Updated Sep 29, 2026

Overview

AI Agents in Depth: Design Principles and Engineering Practice is an open-source book by Bojie Li, a USTC and Microsoft Research Asia joint-PhD alumnus who was among Huawei's first 'Genius Youth' hires. It is published under Apache 2.0 on GitHub (bojieli/ai-agent-book, about 51.6k stars and 5.8k forks when checked on 2026-09-29) and can be read online, or downloaded as PDF or EPUB, in 15 community-translated languages. Chinese is the original, and English is a full edition. The book is built around the formula 'Agent = LLM + Context + Tools' and has ten chapters: (1) agent fundamentals; (2) context engineering, covering KV-cache-aware prompt design, skill injection and context compression; (3) user memory and knowledge bases, including RAG, structured indexing and knowledge graphs; (4) tools, covering MCP, perception/execution/collaboration tool types, async tools and tool discovery; (5) coding agents and code generation; (6) interaction, which expands observation and action spaces to voice, computer use and robotics; (7) evaluating agents, with benchmarks, metrics and statistical rigor; (8) model post-training, from SFT to RL; (9) continual evolution of agents from their execution trajectories; and (10) multi-agent collaboration. More than 90 companion experiments come with it. They are Python 3.11+ projects managed with uv, calling OpenAI, Claude, Kimi, DeepSeek, Qwen and GLM APIs and referencing real benchmarks such as SWE-bench, GAIA and OSWorld. They are pinned to exact upstream commits so they stay reproducible. The repository is still actively maintained: version 2.0 substantially reorganised the earlier 1.x text, and the site rebuilds on every push.

At a Glance

Topic
Agentic
Level
Intermediate
Format
Book
Cost
Free
Duration
10 chapters; ~25-40 hours to read, plus optional runnable experiments (some need a GPU)
Provider
Bojie Li
Hands-on
Yes — code/exercises
Certificate
None

What You’ll Learn

  • ✓Reason about any agent design through the Agent = LLM + Context + Tools framing
  • ✓Engineer context with KV-cache-aware prompts, skill injection and context compression techniques
  • ✓Build cross-session user memory and knowledge bases using RAG, structured indexes and knowledge graphs
  • ✓Design and integrate tools over MCP, including async tools and tool discovery
  • ✓Build coding agents that treat code generation as a way to create new tools
  • ✓Evaluate agents rigorously with real benchmarks like SWE-bench, GAIA and OSWorld plus sound statistics
  • ✓Understand how SFT and reinforcement learning post-training internalise agent capabilities into the model
  • ✓Structure multi-agent collaboration and agents that improve continually from their own execution trajectories

Highlights

  • •Fully open source under Apache 2.0, with Markdown source, auto-built PDF and EPUB, and online reading in 15 languages
  • •More than 90 runnable companion experiments pinned to exact upstream commits for reproducibility
  • •Gives context engineering and agent evaluation full chapters of their own, where most agent tutorials only mention them
  • •Among the most-starred agent books on GitHub (~51.6k stars as of 2026-09-29), and still maintained, with a v2.0 reorganisation
  • •Covers the whole stack: tools, memory, evals, post-training and multi-agent systems in one coherent text

Who It’s For

Best For

  • ✓Engineers moving from single LLM API calls to designing complete agent systems
  • ✓AI engineers who want a structured, book-length reference instead of scattered blog posts
  • ✓Teams building coding, browser or computer-use agents that need a shared vocabulary for context, memory and evals
  • ✓Practitioners curious how post-training and RL internalise agent skills into models

Prerequisites

  • •Intermediate Python and comfort running uv/pip projects with API keys in .env files
  • •Hands-on familiarity with LLM APIs or tools such as Claude or ChatGPT
  • •A CUDA GPU for the post-training experiments; the rest of the book does not need one

FAQ

What is AI Agents in Depth: Design Principles and Engineering Practice?

AI Agents in Depth is a free, Apache-2.0 open-source book by Bojie Li for engineers who already call LLM APIs and now need to design complete agent systems. It builds everything from one formula, Agent = LLM + Context + Tools, and pairs each chapter with runnable Python experiments. By the end you can build and evaluate a production-style agent with memory, MCP tools and a coding loop.

Is AI Agents in Depth: Design Principles and Engineering Practice free?

AI Agents in Depth: Design Principles and Engineering Practice is free to access.

What level is AI Agents in Depth: Design Principles and Engineering Practice for?

AI Agents in Depth: Design Principles and Engineering Practice is aimed at a intermediate audience. Recommended background: Intermediate Python and comfort running uv/pip projects with API keys in .env files, Hands-on familiarity with LLM APIs or tools such as Claude or ChatGPT, A CUDA GPU for the post-training experiments; the rest of the book does not need one.

How long does AI Agents in Depth: Design Principles and Engineering Practice take?

Expect roughly 10 chapters; ~25-40 hours to read, plus optional runnable experiments (some need a GPU). Most learners work through it at their own pace.

What will I learn from AI Agents in Depth: Design Principles and Engineering Practice?

You'll learn: Reason about any agent design through the Agent = LLM + Context + Tools framing; Engineer context with KV-cache-aware prompts, skill injection and context compression techniques; Build cross-session user memory and knowledge bases using RAG, structured indexes and knowledge graphs; Design and integrate tools over MCP, including async tools and tool discovery; Build coding agents that treat code generation as a way to create new tools; Evaluate agents rigorously with real benchmarks like SWE-bench, GAIA and OSWorld plus sound statistics; Understand how SFT and reinforcement learning post-training internalise agent capabilities into the model; Structure multi-agent collaboration and agents that improve continually from their own execution trajectories.

Topics

ai agentscontext engineeringagent memorymcpagent evaluationopen-source book

Sources

This page was written from 4 sources, 3 on domains other than bojieli.github.io.

  1. 1.bojieli.github.io — envendor
  2. 2.github.com — ai agent book
  3. 3.github.com — README.md
  4. 4.home.wonlab.top — 188 ai agent book