# Where to Find the Table of Contents for the AI Agent Book

> Find the AI Agent book table of contents. It's defined in the nav section of mkdocs.yml in the bojieli/ai-agent-book repository and appears as the site navigation sidebar.

- Repository: [Bojie Li/ai-agent-book](https://github.com/bojieli/ai-agent-book)
- Tags: getting-started
- Published: 2026-07-27

---

**The complete table of contents for the AI Agent book is defined in the `nav:` section of [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) in the bojieli/ai-agent-book repository, which MkDocs renders as the left-hand navigation sidebar on the live site.**

The bojieli/ai-agent-book repository hosts a comprehensive Chinese-language guide to AI Agent development. Whether you're looking to browse specific chapters or understand the full scope of the material, locating the table of contents for the AI Agent book is essential for efficient navigation. The canonical structure is maintained in the project's MkDocs configuration file, ensuring consistency between the source repository and the published website.

## Primary Location: The mkdocs.yml Configuration File

The definitive table of contents for the AI Agent book resides in [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) at the repository root. This YAML file contains a `nav:` (navigation) key that enumerates every chapter, subsection, and supplementary page in order.

According to the source code, the navigation structure follows this pattern:

```yaml
nav:
  - 首页: index.md
  - 引言: book/introduction.md
  - 第1章 Agent基础知识:
      - book/chapter1/index.md
      - 配套实验: chapter1/README.md
  - 第2章 上下文工程:
      - book/chapter2/index.md
      - 配套实验: chapter2/README.md
  …
  - 第10章 多Agent协作:
      - book/chapter10/index.md
      - 配套实验: chapter10/README.md
  - 后记: book/afterword.md
  - 思考题参考答案: book/思考题参考答案.md

```

Each top-level entry represents a chapter or major section, with nested items indicating the main content file and accompanying experiment documentation.

## Viewing the Table of Contents

You can access the table of contents through three primary methods depending on your workflow.

### Direct File Access on GitHub

Navigate to the raw configuration file at `https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml`. The `nav:` block begins approximately at the start of the file and lists all ten chapters plus supplementary materials.

### Live Website Navigation

When the site is built via [`scripts/build_site.sh`](https://github.com/bojieli/ai-agent-book/blob/main/scripts/build_site.sh), MkDocs transforms the `nav:` definition into an interactive left-hand sidebar. Browse the live deployment and expand chapter headings to reveal subsections and experiment links.

### README Chapter Overview

The [`index.md`](https://github.com/bojieli/ai-agent-book/blob/main/index.md) file (rendered as the repository README) contains a visual "章节速览" (chapter preview) section that mirrors the [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) ordering. While convenient for quick reference, this is a secondary representation; the YAML configuration remains the authoritative source.

## Extracting the Table of Contents Programmatically

For tooling or automated documentation generation, you can parse [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) directly using Python.

Load the navigation structure:

```python
import yaml
import pathlib

# Path to the mkdocs configuration (relative to project root)

config_path = pathlib.Path("mkdocs.yml")

# Load the YAML content

with config_path.open(encoding="utf-8") as f:
    config = yaml.safe_load(f)

# Extract the navigation (TOC)

toc = config.get("nav", [])
for entry in toc:
    # Each entry is a dict with a single key: the displayed title

    title, target = next(iter(entry.items()))
    print(f"→ {title}: {target}")

```

Render the TOC as HTML:

```python
from html import escape

def render_html(toc):
    html = "<ul>\n"
    for item in toc:
        title, target = next(iter(item.items()))
        html += f'  <li><a href="{escape(str(target))}">{escape(title)}</a></li>\n'
    html += "</ul>"
    return html

# Usage

html_toc = render_html(toc)
print(html_toc)

```

These snippets read the same structure that generates the website's navigation sidebar.

## Summary

- The **canonical table of contents** for the AI Agent book is defined in the `nav:` section of [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) in the bojieli/ai-agent-book repository.
- The **live website sidebar** is generated from this configuration when [`scripts/build_site.sh`](https://github.com/bojieli/ai-agent-book/blob/main/scripts/build_site.sh) executes the MkDocs build process.
- **Alternative access** is available through the GitHub file browser or the visual overview in [`index.md`](https://github.com/bojieli/ai-agent-book/blob/main/index.md).
- **Programmatic extraction** is possible using standard YAML parsing libraries in Python or other languages.

## Frequently Asked Questions

### Where is the table of contents for the AI Agent book stored?

The table of contents is stored in [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) at the repository root. This file contains a `nav:` key that lists all chapters from the introduction through Chapter 10, plus supplementary materials like the afterword and exercise solutions.

### How does the repository convert the table of contents into a website sidebar?

The [`scripts/build_site.sh`](https://github.com/bojieli/ai-agent-book/blob/main/scripts/build_site.sh) script invokes MkDocs, which reads the `nav:` definition from [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) and renders it as the left-hand navigation sidebar on the static site. This ensures the website structure always matches the YAML configuration.

### Can I access the table of contents without opening the website?

Yes. You can view the raw [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) file directly in the GitHub repository browser, or clone the repository and open the file locally. The YAML structure is human-readable and lists every chapter title in both Chinese and its corresponding file path.

### Is the table of contents duplicated in the README?

The [`index.md`](https://github.com/bojieli/ai-agent-book/blob/main/index.md) file includes a "章节速览" (chapter preview) section that mirrors the chapter ordering, but this is a secondary visual aid. The [`mkdocs.yml`](https://github.com/bojieli/ai-agent-book/blob/main/mkdocs.yml) `nav:` block remains the single source of truth for the complete table of contents structure.