Skip to content

Agent API 参考文档

本文档描述 Agent 阅读模式的 API 结构。所有端点均为静态文件,通过 HTTP GET 访问,无需认证。


基础信息

Base URL: https://{host}/claude-code-book/agent-api/
Protocol: HTTP GET
Response: JSON / Markdown
Auth:     无需认证

端点一览

#端点说明
1GET /agent-api/manifest.json全书索引
2GET /agent-api/chapters/{id}.json单章结构化 JSON
3GET /agent-api/chapters/{id}.md单章原始 Markdown
4GET /agent-api/skills/index.json技能书索引
5GET /agent-api/skills/{id}.md技能书内容

1. Manifest — 全书索引

GET /agent-api/manifest.json

顶层字段:

字段类型示例值说明
titlestring"Agent 开发:从原理到生产级实践"书名
versionstring"1.0.0"内容版本
build_timestring"2026-04-01T09:26:13.062Z"构建时间
total_chaptersnumber52总章数(含附录)
total_word_countnumber224429总字数
volumesVolume[]12 卷列表
skillsSkillRef[]7 本技能书列表
dependency_graphobject{"ch01":[],"ch02":["ch01"],...}48 章依赖关系图
agent_instructionsobjectAgent 接入指引

Volume 结构:

字段类型说明
idstring卷 ID,如 "vol1"
titlestring卷名,如 "认知篇"
chaptersChapterRef[]该卷下的章节列表

ChapterRef 结构:

字段类型说明
idstring章节 ID,如 "ch01" / "appendixA"
titlestring章节标题
filestringJSON 文件名,如 "ch01.json"
markdownstringMarkdown 文件名,如 "ch01.md"
word_countnumber字数
key_conceptsstring[]前 5 个核心概念
dependenciesstring[]前置章节 ID
difficultystring"beginner" / "intermediate" / "advanced"

SkillRef 结构:

字段类型说明
idstring技能书 ID,如 "rag-agent"
titlestring技能书名称
descriptionstring一句话描述
difficultystring难度级别
chaptersstring[]涉及章节 ID

2. Chapter JSON — 单章结构化内容

GET /agent-api/chapters/{id}.json

参数: id = ch01 ~ ch48appendixA ~ appendixD

顶层字段:

字段类型说明
metadataChapterMeta章节元数据
overviewstring章节概述文本
sectionsSection[]按二级标题拆分的内容段
code_blocksCodeBlock[]全部代码块(独立索引)
tablesTable[]全部表格
key_takeawaysstring[]章节要点摘要
common_pitfallsstring[]常见陷阱
related_chaptersstring[]关联章节 ID

ChapterMeta 结构:

字段类型说明
idstring章节 ID
titlestring章节标题
volumestring所属卷 ID
volume_titlestring所属卷名称
word_countnumber字数
difficultystring难度级别
prerequisitesstring[]前置章节 ID
key_conceptsstring[]核心概念列表(最多 15 个)
learning_objectivesstring[]学习目标
estimated_tokensnumber预估消耗 token 数
source_filestring源文件路径,如 "vol1/ch01_什么是AI_Agent.md"

Section 结构:

字段类型说明
idstring节编号,如 "1.1"
titlestring节标题
levelnumber标题级别(2 = ##)
contentstring该节正文(不含子节)
subsectionsSubsection[]子节列表

Subsection 结构:

字段类型说明
idstring子节编号,如 "1.1.1"
titlestring子节标题
contentstring子节正文

CodeBlock 结构:

字段类型说明
idstring代码块 ID,如 "code-1"
languagestring语言,如 "python" / "typescript" / "text"
descriptionstring代码说明(从上文推断)
codestring代码内容
section_refstring所在章节编号
runnableboolean是否可直接运行(python/ts/js 为 true)
dependenciesstring[]运行依赖(自动从 import 提取)

Table 结构:

字段类型说明
headersstring[]表头列名
datastring[][]行数据

3. Chapter Markdown — 原始内容

GET /agent-api/chapters/{id}.md

返回章节原始 Markdown 文本。适合需要完整排版格式的场景。


4. Skills Index — 技能书索引

GET /agent-api/skills/index.json

结构:

字段类型说明
versionstring版本号
skillsSkillEntry[]技能书列表
install_instructionsobject安装指引

SkillEntry 结构:

字段类型说明
idstring技能书 ID
titlestring名称
descriptionstring一句话描述
difficultystring难度级别
chaptersstring[]涉及章节
filestring文件名,如 "rag-agent.md"

5. Skill Content — 技能书内容

GET /agent-api/skills/{id}.md

返回 SKILL.md 格式的技能书。包含以下结构化区域:

区域说明
YAML frontmattertitle, description, difficulty, source
学习目标编号列表
前置知识引用的章节 ID 和标题
依赖清单[Dependency Inventory] 运行环境要求
核心知识点从章节 key_takeaways 提取
代码示例从章节 code_blocks 提取(标注来源)
验证步骤[Self-Verification] 检查清单
常见错误[Error Handling] 错误处理指引

有效章节 ID 列表

ch01 ch02 ch03 ch04 ch05 ch06 ch07 ch08 ch09 ch10
ch11 ch12 ch13 ch14 ch15 ch16 ch17 ch18 ch19 ch20
ch21 ch22 ch23 ch24 ch25 ch26 ch27 ch28 ch29 ch30
ch31 ch32 ch33 ch34 ch35 ch36 ch37 ch38 ch39 ch40
ch41 ch42 ch43 ch44 ch45 ch46 ch47 ch48
appendixA appendixB appendixC appendixD

有效技能书 ID 列表

first-agent  prompt-engineering  rag-agent  multi-agent
agent-testing  production-deploy  enterprise-patterns

基于 MIT 许可发布