Claude Agent SDK(Anthropic)


1. 介绍

1.1. 平台定位与来源

Claude Agent SDK 是 Anthropic 官方提供的智能体运行时库,用于把 Claude Code 那一套「工具 + 智能体循环 + 上下文管理」以编程方式嵌入开发者自己的进程,语言覆盖 Python 与 TypeScript。Anthropic 官方工程博客对它的定位原话是:

"The Claude Agent SDK is a powerful, general-purpose agent harness adept at coding, as well as other tasks that require the model to use tools to gather context, plan, and execute."

这句话在整个 AI Harness 调研中具有定调意义:头部模型厂商第一次把 "harness" 这个词写进产品定义,而不是把它当作内部实现的黑话。它印证了参数卡中的核心判断——Harness 不负责提升模型智能,而负责把模型的不确定性转化为工程上的可预期性。

需要强调的是 SDK 的三重边界:

  1. 与 Claude Code CLI 的边界:CLI 是人在回路的终端工具,SDK 是程序在回路的编程库;二者走的是同一条 agent loop。
  2. 与 Anthropic Client SDK 的边界:Client SDK 只暴露 Messages API,工具循环要开发者自己写;Agent SDK 把工具循环、权限、压缩、会话全部内置。
  3. 与 Managed Agents 的边界:Managed Agents 是 Anthropic 托管的 REST API 产品,沙箱由 Anthropic 提供;Agent SDK 运行在开发者自己的进程里,沙箱要自己解决。

1.2. 基本信息卡

项目内容置信度
开发商Anthropic, PBC高(官方)
首次发布2025-05-22,以 Claude Code SDK 之名随 Claude 4 系列发布中高(官方博客 + 二手时间线)
更名2025-09(Claude Code SDK 更名为 Claude Agent SDK)中高
支持语言Python、TypeScript;其他语言需以 CLI 子进程 + --output-format json 驱动高(官方文档)
开源形态源码公开;整体受 Anthropic 商业条款约束,个别组件按各自 LICENSE 执行中高(官方文档「License and terms」段)
许可证(精确口径)第三方目录站标注 Python 包为 MIT、TypeScript 包为 Anthropic Commercial Terms;各包实际许可证以仓库 LICENSE 文件为准,此处标 低—中
SDK 定价SDK 本身不单独收费;成本来自 Anthropic API 的 token 消耗高(官方)
可运行环境开发者自有进程;可通过 Bedrock / Vertex AI / Azure AI Foundry 路由模型调用高(官方与第三方一致)
最新版本(版本号随发布节奏快速变化,检索日期 2026-09-12)缺口

1.3. 发展时间线

时间事件来源等级
2024-11-25MCP 由 Anthropic 开源发布A(官方)
2025-02-24Claude Code 以 limited research preview 形式发布A(官方)
2025-05-22Claude Code SDK 发布,面向 CI/CD 无头场景B
2025-09-29更名为 Claude Agent SDK,适用范围从编码扩展到通用智能体B
2025-10-16Anthropic Agent Skills 发布;SKILL.md + 渐进式披露A(官方)
2025-12-18Agent Skills 转为开放标准A(官方)
2025-12Anthropic 参与发起 Agentic AI Foundation(Linux Foundation 旗下)A(官方)

1.4. 在 AI Harness 体系中的位置

按参数卡的边界表,Claude Agent SDK 既不是纯粹的 Agent Framework,也不是 Agent Platform,而是厂商提供的 Harness 参考实现

  • 它覆盖了 L1~L4 的大部分,并提供了 L6 的强原语(权限模式、Hooks 拦截、预算上限);
  • 没有内置 L5(评估与观测)与多租户治理,这两层要由宿主系统补齐;
  • 它不提供 UI、租户与计费,因此不构成 Agent Platform。

这也是它最容易被误读的地方:开发者常把「装了 Agent SDK」等同于「有了 Harness」,实际上 SDK 只提供底盘,评估集、回归与审计仍需自建。

2. 名词解释

术语英文/缩写释义
Agent SDKClaude Agent SDKAnthropic 官方智能体运行时库,把 Claude Code 的工具、循环与上下文管理以库的形式暴露给 Python / TypeScript 程序
Agent LoopAgent Loop「接收输入 → 评估并响应 → 执行工具 → 回灌结果 → 重复」的循环,直到模型输出中不再包含工具调用为止
Built-in ToolBuilt-in ToolsSDK 自带的工具集:Read / Write / Edit / Bash / Glob / Grep / WebSearch / WebFetch 等,无需开发者实现
SubagentSubagent由主智能体通过 Agent 工具派生的子智能体,拥有独立上下文窗口,中间过程不污染主上下文,只回传最终结果
HookHooks在智能体生命周期关键点触发的回调,可拦截、阻断、改写工具调用,如 PreToolUsePostToolUseStopSessionStart
MatcherMatcherHook 的过滤模式(如 `Write\Edit`),只有命中的事件才触发对应回调
Permission ModePermission Mode权限模式,控制哪些工具自动执行、哪些需要人工确认;已知模式包括 defaultdontAskacceptEditsbypassPermissionsplan
canUseToolcanUseTool宿主提供的审批回调,执行在该回调返回决策前暂停,可用于实现人工审批队列
SessionSession一次智能体会话,以 JSONL 形式持久化在本地(默认位于 ~/.claude/projects/),可恢复、继续或分叉
Resume / ForkResume / Fork基于已有 session id 恢复上下文;Fork 则从某一节点分叉出新的执行路径
Context CompactionCompact上下文压缩:接近 token 上限时自动摘要早期对话轮次,保留关键信息
MCPModel Context Protocol模型上下文协议,SDK 支持 stdio、HTTP/SSE 与进程内 SDK MCP 服务器三种传输
SkillAgent SkillsSKILL.md 为核心的能力包,采用三层渐进式披露:会话启动只加载 name + description,命中时加载全文,按需读取 scripts / references / assets
PluginPlugins把 Skills、Subagents、Hooks 与 MCP 服务器打包、按本地路径加载的封装单元
max_turnsmax_turns单次运行的最大轮次上限,防止智能体无限循环
max_budget_usdmax_budget_usd单次运行的美元预算上限,超限时智能体停止,是成本护栏的核心参数
Managed AgentsManaged AgentsAnthropic 托管的 REST API 产品,与 Agent SDK 是不同产品,沙箱由 Anthropic 运行

3. 功能说明

3.1. 内置工具集

SDK 出厂即带一套文件与检索工具,开发者通过 allowed_tools 白名单决定智能体可见范围:

工具作用Harness 层归属
Read读取任意文件L2
Write创建新文件L2
Edit对已有文件做精确编辑L2
Bash执行终端命令、脚本、git 操作L2
Glob按模式匹配查找文件L1 / L2
Grep正则检索文件内容L1 / L2
WebSearch联网检索L2
WebFetch抓取并解析网页L2
Agent派生子智能体L3
Skill调用已注册的 SkillL1 / L2

只读场景可显式配置为 ["Read", "Glob", "Grep"],智能体无法越出该列表。这种「白名单即能力边界」的设计,是 L2 与 L6 的交汇点。

3.2. Hooks 事件机制

Hooks 是 SDK 中最具 Harness 特征的设计——它把「拦截点」做成了一等公民。典型事件如下:

事件触发时机典型用途语言可用性
PreToolUse工具调用请求发出前阻断危险命令、改写入参、注入上下文Python / TypeScript
PostToolUse工具执行完成审计日志、结果清洗Python / TypeScript
PostToolUseFailure工具执行失败错误兜底与重试策略Python / TypeScript
PostToolBatch一批工具调用全部返回、下一次模型调用前一次性注入约定仅 TypeScript
UserPromptSubmit用户提示词提交补充上下文、合规过滤Python / TypeScript
UserPromptExpansion用户命令或 MCP 提示词展开为提示词前阻断特定命令仅 TypeScript
Stop执行结束收尾、状态清理、通知Python / TypeScript
SubagentStart / SubagentStop子智能体启停上下文准备与结果处理Python / TypeScript

回调返回一个决策对象,可表达四种意图:放行、阻断、改写输入、注入上下文。例:用 PreToolUse + matcher Write|Edit 拦截对 .env 文件的写入,返回 permissionDecision: "deny"

3.3. 权限与审批

SDK 的权限判定是一条有序链路:Hooks → deny 规则 → 权限模式 → allow 规则 → canUseTool 回调。这条顺序很重要,因为它意味着:

  • Hooks 拥有最高优先级,可以硬阻断;
  • canUseTool 位于最后,是兜底的人工审批位,可无限期挂起等待决策;
  • 权限模式是粗粒度开关,allow / deny 规则是中粒度,canUseTool 是细粒度。

三层叠加,构成了 L6 治理层在本平台上的主要实现形式。

3.4. 会话、子智能体与上下文管理

三个机制共同解决「长任务」问题:

  1. Session 持久化:会话以 JSONL 落盘,携带完整的文件读取历史、对话上下文与已完成的推理;通过 resume 传回 session id 即可续跑,避免重复读取。
  2. Subagent 隔离:子智能体上下文全新开始,中间工具调用留在子智能体内部,只回传一条最终消息。这是 L1 层最有效的「上下文隔离」手段。
  3. Context Compaction:接近 token 上限时自动摘要早期轮次。

三者组合后的效果是:主上下文长度近似恒定,任务长度可以远大于上下文窗口。

3.5. MCP 与 Skills 扩展

  • MCP:SDK 支持三种传输——stdio 子进程、HTTP/SSE 远程服务、进程内 SDK MCP 服务器。自定义工具可以直接实现为进程内 MCP 服务器,无需额外进程。
  • Skills:以目录 + SKILL.md 组织,YAML frontmatter 必含 namedescription。渐进式披露把「能力描述」与「能力实现」分离,使得挂载几十个 Skill 的成本接近于挂载几个。

3.6. 预算与运行约束

约束参数作用缺失后果
max_turns限制最大轮次智能体可能陷入工具调用死循环
max_budget_usd限制美元预算失控智能体产生不可预期账单
effort控制推理力度成本与质量无法按任务分级
permission_mode粗粒度权限开关高危操作自动执行
allowed_tools工具白名单能力边界不可控

4. 平台架构

图 4-1|Claude Agent SDK 四层架构(宿主 × SDK × 执行面 × 模型后端)

Claude Agent SDK 四层架构(宿主 × SDK × 执行面 × 模型后端) 信息截止 2026-09-12 · 示意:基于本文分析绘制 宿主应用(开发者自有进程) 任务编排 / 队列 / 多租户 / 计费 canUseTool 审批回调(人工兜底审批位) Claude Agent SDK 运行时层(本图重点) query() / ClaudeSDKClient · Python / TypeScript Agent Loop 接收·评估·执行·回灌 Context Manager 压缩·子智能体隔离 Permission Engine 权限判定有序链路 Session Store JSONL·resume·fork Extension Loader MCP·Skills·Plugins 执行面(Execution Plane) Built-in Tools MCP Servers 外部沙箱(宿主自备) 模型后端 Anthropic API / Bedrock / Vertex AI / Azure AI Foundry 调用 query() 调度工具 模型推理 结构解读:SDK 覆盖 L1~L4 大部分能力,并提供 L6 强原语(权限链路 · Hooks · 预算上限); L5(评估与观测)与多租户治理缺失,须由宿主系统自建补齐。

数据来源:基于本文分析绘制的示意图。

4.1. 分层架构

┌──────────────────────────────────────────────────────────┐
│ 宿主应用(你自己的进程)                                    │
│  - 任务编排 / 队列 / 多租户 / 计费                          │
│  - canUseTool 审批回调                                     │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ Claude Agent SDK                                          │
│  query() / ClaudeSDKClient                                │
│  ├─ Agent Loop(接收 → 评估 → 执行工具 → 回灌 → 重复)      │
│  ├─ Context Manager(Compaction / Subagent 隔离)          │
│  ├─ Permission Engine(Hooks → deny → mode → allow → 回调)│
│  ├─ Session Store(JSONL 落盘,resume / fork)             │
│  └─ Extension Loader(MCP / Skills / Plugins / Commands)  │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ 执行面                                                     │
│  - Built-in Tools(Read/Write/Edit/Bash/Glob/Grep/...)    │
│  - MCP Servers(stdio / HTTP / in-process)                │
│  - 外部沙箱(需宿主自备:Docker / 容器 / 受限用户)           │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ 模型后端                                                   │
│  Anthropic API / Bedrock / Vertex AI / Azure AI Foundry    │
└──────────────────────────────────────────────────────────┘

4.2. 一次 query 的完整生命周期

  1. 初始化:SDK 返回 SystemMessageinit 子类型)并携带 session_id
  2. 提示词处理UserPromptSubmit 钩子触发,可注入或过滤上下文。
  3. 模型推理:模型返回 ThinkingBlock 与 / 或 ToolUseBlock
  4. 工具前拦截PreToolUse 钩子按 matcher 匹配,返回放行 / 阻断 / 改写。
  5. 权限判定:Hooks → deny → 权限模式 → allow → canUseTool
  6. 工具执行:执行结果以 ToolResultBlock 回灌为 UserMessage
  7. 循环:回到第 3 步,直到模型输出不含工具调用。
  8. 收尾Stop 钩子触发,返回 ResultMessage

4.3. 与 CLI / Client SDK / Managed Agents 的边界

维度Agent SDKClaude Code CLIClient SDKManaged Agents
形态终端命令REST API
运行位置你的进程本地终端你的进程Anthropic 托管
工具循环SDK 管理CLI 内部管理开发者自写Anthropic 管理
内置工具
MCP支持支持不支持支持
Subagents支持支持不支持支持
Hooks支持支持不支持不支持
沙箱需自备需自备需自备Anthropic 提供
典型场景自动化流水线 / CI交互式开发完全自定义无服务器生产部署

5. Harness 设计

5.1. 六层能力总览

名称本平台实现强度判断依据
L1上下文工程Compaction + Subagent 隔离 + Skills 渐进披露 + 文件系统即上下文
L2工具与执行强(执行)/ 弱(隔离)内置工具与 MCP 完备;无内置沙箱,容器隔离需宿主自备
L3编排与控制中强循环 + 子智能体 + 会话 resume/fork;无显式图 / DAG 原语
L4记忆与状态中强JSONL 会话持久化、resume/fork、检查点回退;长期记忆依赖文件,非结构化
L5评估与观测无内置 Eval Set / Golden Dataset;轨迹需靠 Hooks 自行导出
L6治理与安全强(机制)/ 中(体系)权限链路 + Hooks 阻断 + 预算上限齐备;无内建 RBAC / 多租户 / 合规报表

5.2. L1 上下文工程层

Claude Agent SDK 在 L1 上的设计可归纳为四条原则:

  1. 文件系统即上下文:大对象不进上下文窗口,只把路径与摘要放进上下文,需要时再读。这是「MCP-as-Code-API」思路的延伸——中间数据留在执行环境而非上下文窗口。
  2. 子智能体即隔离单元:把探索性、高噪声的检索工作下沉到子智能体,主上下文只接收结论。
  3. 渐进式披露:Skills 只在会话启动时加载 name + description,命中才加载全文,按需再读脚本与参考文件。
  4. 压缩兜底:接近上限时自动摘要早期轮次。

代价是:压缩与隔离都会丢失细节。这也是本平台在 L1 上唯一的负面项——上下文策略越激进,可追溯性越弱。

5.3. L2 工具与执行层

  • 工具注册:内置工具 + 自定义进程内 MCP 服务器 + 外部 MCP 服务器(stdio / HTTP)。
  • 调用形态:串行为主,批处理由 PostToolBatch 暗示存在批量调用语义。
  • 执行隔离明确缺失。官方文档口径是 SDK 不提供容器隔离,智能体默认可访问宿主文件系统;若要生产安全,需自行加 Docker 或等价隔离。

这一条是选型时最容易被忽略的风险点:SDK 的「能力很强」与「默认不安全」是同一枚硬币的两面。

5.4. L3 编排与控制层

本节的判断是:Claude Agent SDK 在 L3 上属于「隐式编排」,与 LangGraph 的「显式编排」构成同一根轴的两端。

具体表现:

  • 控制流由模型在循环内自主决定,开发者不写图、不写状态机;
  • 可用的结构化手段只有三种:子智能体派生、Hooks 拦截、会话 resume/fork;
  • 没有 DAG、没有条件分支原语、没有并行编排器(并行靠一次提示词里派生多个子智能体实现)。

灵活性 ↔ 可预测性的张力在此处最尖锐:

  • 换来的灵活性:无需预先枚举路径,适应开放式任务;
  • 付出的可预测性:同一输入两次运行可能走不同路径,无法在代码层面对「执行顺序」做回归断言。

对应的工程补偿是:把不可预测性关进 Hooks 与权限链路里——不控制「走哪条路」,而是控制「哪些路不许走」。这是本平台给出的一种有代表性的答案。

5.5. L4 记忆与状态层

机制持久性粒度跨会话
Session JSONL磁盘完整消息流是(resume / fork)
文件检查点磁盘工作区快照
Memory / CLAUDE.md磁盘人工维护的事实条目
Skills磁盘能力包

优势:会话可恢复、可分叉,长任务可从崩溃点续跑。

短板:没有面向语义的长期记忆(不同于 Dify 的知识库或专门的 Memory Service),跨会话的「记住什么」仍需人工写入文件或外挂检索系统。

5.6. L5 评估与观测层

这是本平台最薄弱的一层,必须明确指出:

  • 无内置 Eval Set、无 Golden Dataset、无回归集管理机制;
  • 轨迹数据不自动落库,需要从 PostToolUse / Stop 等 Hook 自行导出到外部观测系统;
  • 没有 A/B 与在线指标能力。

因此,任何以 Claude Agent SDK 为底座的生产系统,L5 必须由宿主自建。这也印证了参数卡的判断:Framework 主要覆盖 L2/L3,是 Harness 的子集——Claude Agent SDK 覆盖得比一般 Framework 更宽,但依然没有补齐 L5。

5.7. L6 治理与安全层

治理能力实现方式强度
工具准入allowed_tools / disallowed_tools 白黑名单
行为阻断Hooks 返回 deny 决策
人工审批canUseTool 回调挂起
粗粒度模式permission_mode(default / dontAsk / acceptEdits / bypassPermissions / plan 等)中强
成本护栏max_budget_usd + max_turns
审计日志需由 Hooks 自行写入弱(需自建)
身份与租户无内建 RBAC / 多租户缺失

开放性 ↔ 治理的张力在本平台表现得很清楚:MCP 让智能体可以连接任意外部系统,能力边界被打开的同时,攻击面同步被打开——恶意 MCP 服务器、提示词注入、凭据泄露都发生在这一层。SDK 给出的补偿是「Hooks 最高优先级 + 白名单 + 审批回调」三件套,但这套机制要求宿主团队自己写、自己维护,不是开箱即用的合规能力。

5.8. 三条内在张力的具体表现

张力在本平台的体现缓解手段
灵活性 ↔ 可预测性隐式循环,控制流由模型决定,无显式图Hooks 约束「不许走什么」而非「必须走什么」;用 max_turns 限定深度
开放性 ↔ 治理MCP 三种传输打开互操作,也打开攻击面白名单 + deny 钩子 + canUseTool 审批;沙箱外挂
成本 ↔ 深度子智能体并行与长循环显著放大 token 消耗max_budget_usd 硬止损;Compaction 降输入成本;按任务选模型档位

6. 实际案例

以下案例均来自 Anthropic 官方公开工程博客,未做效果数据外推。

案例一:长时运行智能体的双智能体 Harness

Anthropic 在《Effective harnesses for long-running agents》中给出了长时运行智能体的初始方案:一个初始化智能体负责搭建环境、写初始进度文件,一个编码智能体负责按增量推进并在每轮结束时写入结构化进度。核心价值不在模型,而在Harness 把长任务切成可判定、可恢复的增量。该文同时给出了 Claude Agent SDK 的官方定位原话,是本组文档引用的定调来源。

案例二:三智能体演进

同一系列工作中,方案从双智能体演进为三智能体,增加了专门的验证 / 收尾角色。这一演进说明:当任务变长,Harness 的复杂度增长主要体现在 L3(编排)与 L5(验证)两层,而不是模型调用层

案例三:Claude Code 作为 Agent SDK 的同源验证

Claude Code 与 Agent SDK 共用同一条 agent loop,因此 Claude Code 的公开数据可作为该 loop 工程可用性的旁证。第三方口径称 Claude Code 发布七周内达到 350,000 DAU、产生超 100 万个被合并 PR、Anthropic 内部约 1/4 的代码提交由其产生——该组数据来自二手来源,标 ,不作为结论依据

未检索到公开量化数据的部分:截至检索日期 2026-09-12,未检索到 Anthropic 官方发布的、以 Claude Agent SDK 为底座的第三方企业落地量化效果数据(如成本下降百分比、任务成功率)。此处如实标注,不做补全。

7. 总结

7.1. 优势

  1. 官方定义级样本:厂商首次将 "harness" 写入产品定义,六层模型在本平台上有完整可对照物。
  2. L1 设计成熟:上下文压缩、子智能体隔离、渐进式披露三者组合,是长任务可行性的关键。
  3. L6 机制强:权限判定链路有序、Hooks 可硬阻断、预算可硬止损,是同类 SDK 中治理原语最完整的之一。
  4. 与 Claude Code 同源:工程验证充分,工具与循环经过大规模真实使用打磨。
  5. 后端可替换:支持 Bedrock / Vertex AI / Azure AI Foundry,适配既有云账本。

7.2. 劣势

  1. L5 缺失:无内置评估与观测,轨迹与回归集需自建。
  2. 无内置沙箱:生产安全需宿主自备容器隔离。
  3. L3 隐式:控制流不可见、不可断言,可预测性弱于显式图框架。
  4. 无多租户与 RBAC:不构成 Agent Platform,租户、计费、审计体系需自建。
  5. 成本不可预先估算:隐式循环 + 子智能体并行使单次任务成本方差大。

7.3. 适用边界

场景是否适用理由
自动化编码流水线 / CI适用与 Claude Code 同源,工具链完备
需要人工审批的高危操作适用canUseTool 可无限期挂起等待决策
长时研究型任务适用子智能体隔离 + 会话恢复
需要强可预测性的金融 / 合规流程不适用L3 无显式图,无法做执行顺序回归
需要开箱即用评估体系的团队不适用L5 需自建
需要多租户 SaaS 交付不适用SDK 不提供租户与计费

7.4. 选型建议

  • 若团队已有较强的平台工程能力,能把 L5(评估观测)与 L6 中的审计、租户部分补齐,Claude Agent SDK 是目前六层覆盖最均衡的厂商级底盘
  • 若团队首要诉求是「执行顺序可断言、可回归」,应优先考虑显式图框架(详见 04-langgraph.md)。
  • 若团队首要诉求是「非工程角色也能搭智能体」,应优先考虑 Agent Platform(详见 05-dify.md06-coze.md)。
  • 无论何种选型,max_budget_usdmax_turns 必须在首次上线前配置,否则成本护栏形同虚设。

信息缺口声明

  1. 各包精确许可证:第三方目录站给出 "Python 包 MIT、TypeScript 包 Anthropic Commercial Terms" 的口径,但未与仓库 LICENSE 文件逐包核对,标 。
  2. 当前最新版本号:SDK 版本随发布节奏快速变化,检索日期 2026-09-12 未取得权威版本号,标 。
  3. 模型具体单价:不同第三方来源给出的 Sonnet / Opus 档位单价相互冲突,本文件只保留「SDK 免费、按 token 计费」这一确定性表述,单价标 。
  4. 完整 Hooks 事件清单:官方文档中事件总数存在版本差异(有来源称 27 个事件点),本文件只列出可交叉验证的主要事件。
  5. 第三方企业落地量化数据:未检索到以 Claude Agent SDK 为底座的公开可验证企业效果数据,未做任何补全。
  6. Managed Agents 的功能边界:与 Agent SDK 为不同产品,本次未做专项检索,其定价与配额标 。

8. 参考资料

  1. Effective harnesses for long-running agents — Anthropic Engineering, 2025。https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
  2. Agent SDK overview — Anthropic(Claude Code Docs)。https://platform.claude.com/docs/en/agent-sdk/overview
  3. Intercept and control agent behavior with hooks — Anthropic(Claude Code Docs)。https://code.claude.com/docs/en/agent-sdk/hooks
  4. Equipping agents for the real world with Agent Skills — Anthropic Engineering, 2025。https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
  5. Claude Agent SDK — Agent Patterns Catalog(组件清单与许可口径)。https://www.agentpatternscatalog.org/compositions/claude-agent-sdk
  6. Claude Agent SDK — Anthropic's Framework for Production AI Agents — Cybernauten。https://cybernauten.com/tools/claude-agent-sdk
  7. Claude Agent SDK: Features, Pricing & Alternatives — AI Coolies。https://aicoolies.com/tools/claude-agent-sdk
  8. New tools for building agents — OpenAI(作为同期编排层官方化的对照)。https://openai.com/blog/new-tools-for-building-agents
  9. R01-概述检索报告(Harness 定义、MCP 时间线、Skills 发布节点)— 本项目内部检索报告。
  10. 项目参数卡 v1.0(六层能力模型与概念边界)— 本项目内部基准文件。

Claude Agent SDK(Anthropic)

1. Introduction

1.1. Platform Positioning and Origin

Claude Agent SDK is the agent runtime library officially provided by Anthropic, used to embed the Claude Code tooling of "tools + agent loop + context management" programmatically into a developer's own process, with language coverage of Python and TypeScript. Here is the exact positioning statement from Anthropic's official engineering blog:

"The Claude Agent SDK is a powerful, general-purpose agent harness adept at coding, as well as other tasks that require the model to use tools to gather context, plan, and execute."

This statement is of tone-setting significance throughout the entire AI Harness research: it is the first time a leading model vendor wrote the word "harness" into a product definition, rather than treating it as an internal implementation jargon. It confirms the core judgment in the parameter card — Harness is not responsible for improving model intelligence, but for transforming the model's uncertainty into engineering predictability.

It is worth emphasizing the SDK's three boundaries:

  1. Boundary with Claude Code CLI: the CLI is a human-in-the-loop terminal tool, while the SDK is a program-in-the-loop programming library; both run on the same agent loop.
  2. Boundary with Anthropic Client SDK: the Client SDK exposes only the Messages API, so the tool loop must be written by the developer; the Agent SDK builds in the tool loop, permissions, compaction, and sessions entirely.
  3. Boundary with Managed Agents: Managed Agents is a REST API product hosted by Anthropic, with the sandbox provided by Anthropic; the Agent SDK runs in the developer's own process, so the sandbox must be solved by the developer.

1.2. Basic Information Card

ItemContentConfidence
DeveloperAnthropic, PBCHigh (official)
First release2025-05-22, released under the name Claude Code SDK alongside the Claude 4 seriesMedium-high (official blog + secondary timeline)
Rename2025-09 (Claude Code SDK renamed to Claude Agent SDK)Medium-high
Supported languagesPython, TypeScript; other languages must be driven via CLI subprocess + --output-format jsonHigh (official docs)
Open-source formSource code is public; overall subject to Anthropic's commercial terms, individual components follow their respective LICENSEMedium-high (official docs, "License and terms" section)
License (precise)Third-party directory sites mark the Python package as MIT and the TypeScript package as Anthropic Commercial Terms; the actual license of each package is governed by the repository LICENSE file, marked here as [To be verified]Low-medium
SDK pricingThe SDK itself is not charged separately; cost comes from Anthropic API token consumptionHigh (official)
Runnable environmentDeveloper's own process; model calls can be routed via Bedrock / Vertex AI / Azure AI FoundryHigh (official and third-party agree)
Latest version (version number changes rapidly with the release cadence, search date 2026-09-12)Gap

1.3. Development Timeline

DateEventSource level
2024-11-25MCP released as open source by AnthropicA (official)
2025-02-24Claude Code released as a limited research previewA (official)
2025-05-22Claude Code SDK released, aimed at headless CI/CD scenariosB
2025-09-29Renamed to Claude Agent SDK, scope expanded from coding to general-purpose agentsB
2025-10-16Anthropic Agent Skills released; SKILL.md + progressive disclosureA (official)
2025-12-18Agent Skills became an open standardA (official)
2025-12Anthropic co-founded the Agentic AI Foundation (under the Linux Foundation)A (official)

1.4. Position in the AI Harness System

According to the boundary table in the parameter card, Claude Agent SDK is neither a pure Agent Framework nor an Agent Platform, but rather a vendor-provided Harness reference implementation:

  • It covers most of L1~L4 and provides strong primitives for L6 (permission modes, Hooks interception, budget caps);
  • It does not build in L5 (evaluation and observability) and multi-tenant governance; these two layers must be completed by the host system;
  • It provides no UI, tenancy, or billing, and therefore does not constitute an Agent Platform.

This is also where it is most easily misread: developers often equate "installing the Agent SDK" with "having a Harness", but in reality the SDK only provides the chassis — the evaluation set, regression, and auditing still need to be self-built.

2. Glossary

TermEnglish / AbbreviationDefinition
Agent SDKClaude Agent SDKAnthropic's official agent runtime library, exposing Claude Code's tools, loop, and context management as a library to Python / TypeScript programs
Agent LoopAgent Loopa loop of "receive input → evaluate and respond → execute tools → feed results back → repeat" until the model output no longer contains tool calls
Built-in ToolBuilt-in Toolsthe tool set that ships with the SDK: Read / Write / Edit / Bash / Glob / Grep / WebSearch / WebFetch, etc., no developer implementation required
SubagentSubagenta child agent derived by the main agent via the Agent tool, with its own context window; intermediate processes do not pollute the main context, and only the final result is returned
HookHookscallbacks triggered at key points in the agent lifecycle that can intercept, block, or rewrite tool calls, such as PreToolUse, PostToolUse, Stop, SessionStart
MatcherMatchera filter pattern for Hooks (e.g. `Write\Edit`), where only matching events trigger the corresponding callback
Permission ModePermission Modepermission mode, controlling which tools execute automatically and which require human confirmation; known modes include default, dontAsk, acceptEdits, bypassPermissions, plan, etc.
canUseToolcanUseToolthe approval callback provided by the host; execution pauses until the callback returns a decision, and it can be used to implement a human approval queue
SessionSessiona single agent session, persisted locally in JSONL form (by default at ~/.claude/projects/), which can be resumed, continued, or forked
Resume / ForkResume / Forkrestore context based on an existing session id; Fork branches a new execution path from a given node
Context CompactionCompactcontext compaction: when approaching the token limit, early conversation turns are automatically summarized, preserving key information
MCPModel Context Protocolthe Model Context Protocol; the SDK supports three transports: stdio, HTTP/SSE, and in-process SDK MCP servers
SkillAgent Skillsa capability package centered on SKILL.md, using three levels of progressive disclosure: only name + description are loaded at session start, the full text is loaded on a hit, and scripts / references / assets are read on demand
PluginPluginsa packaging unit that bundles Skills, Subagents, Hooks, and MCP servers and loads them by local path
max_turnsmax_turnsthe maximum number of turns for a single run, preventing the agent from looping indefinitely
max_budget_usdmax_budget_usdthe USD budget cap for a single run; the agent stops when the limit is exceeded, and it is the core parameter of the cost guardrail
Managed AgentsManaged AgentsAnthropic's hosted REST API product, a different product from the Agent SDK, with the sandbox operated by Anthropic

3. Features

3.1. Built-in Tool Set

The SDK ships with a set of file and retrieval tools out of the box; the developer decides the agent's visible scope through the allowed_tools allowlist:

ToolFunctionHarness layer
ReadRead arbitrary filesL2
WriteCreate new filesL2
EditMake precise edits to existing filesL2
BashExecute terminal commands, scripts, and git operationsL2
GlobFind files by pattern matchingL1 / L2
GrepSearch file contents by regexL1 / L2
WebSearchSearch the webL2
WebFetchFetch and parse web pagesL2
AgentDerive subagentsL3
SkillInvoke a registered SkillL1 / L2

Read-only scenarios can be explicitly configured as ["Read", "Glob", "Grep"], and the agent cannot go beyond that list. This "allowlist-as-capability-boundary" design is the meeting point of L2 and L6.

3.2. Hooks Event Mechanism

Hooks are the most Harness-typical design in the SDK — it makes "interception points" first-class citizens. Typical events are as follows:

EventTrigger timingTypical useLanguage availability
PreToolUseBefore the tool call request is madeBlock dangerous commands, rewrite input parameters, inject contextPython / TypeScript
PostToolUseAfter tool execution completesAudit logging, result cleaningPython / TypeScript
PostToolUseFailureTool execution failsError fallback and retry strategiesPython / TypeScript
PostToolBatchAfter a batch of tool calls all return, before the next model callOne-time injection conventionTypeScript only
UserPromptSubmitUser prompt submittedSupplement context, compliance filteringPython / TypeScript
UserPromptExpansionBefore a user command or MCP prompt is expanded into a promptBlock specific commandsTypeScript only
StopExecution endsWrap-up, state cleanup, notificationsPython / TypeScript
SubagentStart / SubagentStopSubagent start/stopContext preparation and result handlingPython / TypeScript

The callback returns a decision object that can express four intentions: allow, block, rewrite input, and inject context. For example, use PreToolUse with matcher Write|Edit to intercept writes to a .env file and return permissionDecision: "deny".

3.3. Permissions and Approval

The SDK's permission decision is an ordered chain: Hooks → deny rules → permission mode → allow rules → canUseTool callback. This order matters, because it means:

  • Hooks have the highest priority and can hard-block;
  • canUseTool sits at the end as the fallback human-approval slot and can suspend indefinitely waiting for a decision;
  • permission mode is a coarse-grained switch, allow / deny rules are medium-grained, and canUseTool is fine-grained.

The three layers stacked together constitute the main implementation form of the L6 governance layer on this platform.

3.4. Sessions, Subagents, and Context Management

Three mechanisms together solve the "long-task" problem:

  1. Session persistence: sessions are written to disk in JSONL, carrying the complete file-read history, conversation context, and completed reasoning; passing the session id back via resume resumes the run and avoids re-reading.
  2. Subagent isolation: a subagent's context starts fresh, intermediate tool calls remain inside the subagent, and only one final message is returned. This is the most effective "context isolation" means at the L1 layer.
  3. Context Compaction: when approaching the token limit, early turns are automatically summarized.

The combined effect of the three is: the main context length stays approximately constant, so the task length can be far greater than the context window.

3.5. MCP and Skills Extension

  • MCP: the SDK supports three transports — stdio subprocess, HTTP/SSE remote services, and in-process SDK MCP servers. Custom tools can be implemented directly as in-process MCP servers without an extra process.
  • Skills: organized as a directory + SKILL.md, with the YAML frontmatter necessarily containing name and description. Progressive disclosure separates "capability description" from "capability implementation", so that mounting dozens of Skills costs about as much as mounting a few.

3.6. Budget and Runtime Constraints

Constraint parameterFunctionConsequence if missing
max_turnsLimit the maximum number of turnsThe agent may fall into an infinite tool-call loop
max_budget_usdLimit the USD budgetA runaway agent produces unpredictable bills
effortControl reasoning effortCost and quality cannot be tiered by task
permission_modeCoarse-grained permission switchHigh-risk operations execute automatically
allowed_toolsTool allowlistCapability boundaries are uncontrollable

4. Platform Architecture

图 4-1|Claude Agent SDK 四层架构(宿主 × SDK × 执行面 × 模型后端)

Claude Agent SDK 四层架构(宿主 × SDK × 执行面 × 模型后端) 信息截止 2026-09-12 · 示意:基于本文分析绘制 宿主应用(开发者自有进程) 任务编排 / 队列 / 多租户 / 计费 canUseTool 审批回调(人工兜底审批位) Claude Agent SDK 运行时层(本图重点) query() / ClaudeSDKClient · Python / TypeScript Agent Loop 接收·评估·执行·回灌 Context Manager 压缩·子智能体隔离 Permission Engine 权限判定有序链路 Session Store JSONL·resume·fork Extension Loader MCP·Skills·Plugins 执行面(Execution Plane) Built-in Tools MCP Servers 外部沙箱(宿主自备) 模型后端 Anthropic API / Bedrock / Vertex AI / Azure AI Foundry 调用 query() 调度工具 模型推理 结构解读:SDK 覆盖 L1~L4 大部分能力,并提供 L6 强原语(权限链路 · Hooks · 预算上限); L5(评估与观测)与多租户治理缺失,须由宿主系统自建补齐。

数据来源:基于本文分析绘制的示意图。

4.1. Layered Architecture

┌──────────────────────────────────────────────────────────┐
│ 宿主应用(你自己的进程)                                    │
│  - 任务编排 / 队列 / 多租户 / 计费                          │
│  - canUseTool 审批回调                                     │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ Claude Agent SDK                                          │
│  query() / ClaudeSDKClient                                │
│  ├─ Agent Loop(接收 → 评估 → 执行工具 → 回灌 → 重复)      │
│  ├─ Context Manager(Compaction / Subagent 隔离)          │
│  ├─ Permission Engine(Hooks → deny → mode → allow → 回调)│
│  ├─ Session Store(JSONL 落盘,resume / fork)             │
│  └─ Extension Loader(MCP / Skills / Plugins / Commands)  │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ 执行面                                                     │
│  - Built-in Tools(Read/Write/Edit/Bash/Glob/Grep/...)    │
│  - MCP Servers(stdio / HTTP / in-process)                │
│  - 外部沙箱(需宿主自备:Docker / 容器 / 受限用户)           │
└──────────────────────────────────────────────────────────┘
                          │
┌──────────────────────────────────────────────────────────┐
│ 模型后端                                                   │
│  Anthropic API / Bedrock / Vertex AI / Azure AI Foundry    │
└──────────────────────────────────────────────────────────┘

4.2. Complete Lifecycle of a Single Query

  1. Initialization: the SDK returns a SystemMessage (of the init subtype) carrying the session_id.
  2. Prompt processing: the UserPromptSubmit hook fires, allowing context to be injected or filtered.
  3. Model reasoning: the model returns a ThinkingBlock and / or a ToolUseBlock.
  4. Pre-tool interception: the PreToolUse hook matches by matcher and returns allow / block / rewrite.
  5. Permission decision: Hooks → deny → permission mode → allow → canUseTool.
  6. Tool execution: the execution result is fed back as a UserMessage via ToolResultBlock.
  7. Loop: return to step 3 until the model output contains no tool calls.
  8. Wrap-up: the Stop hook fires and a ResultMessage is returned.

4.3. Boundaries with CLI / Client SDK / Managed Agents

DimensionAgent SDKClaude Code CLIClient SDKManaged Agents
FormLibraryTerminal commandLibraryREST API
Runtime locationYour processLocal terminalYour processAnthropic-hosted
Tool loopManaged by the SDKManaged internally by the CLIWritten by the developerManaged by Anthropic
Built-in toolsYesYesNoYes
MCPSupportedSupportedNot supportedSupported
SubagentsSupportedSupportedNot supportedSupported
HooksSupportedSupportedNot supportedNot supported
SandboxMust be self-providedMust be self-providedMust be self-providedProvided by Anthropic
Typical scenarioAutomated pipeline / CIInteractive developmentFully customServerless production deployment

5. Harness Design

5.1. Overview of the Six-Layer Capabilities

LayerNameImplementation strength on this platformBasis for judgment
L1Context engineeringStrongCompaction + Subagent isolation + Skills progressive disclosure + filesystem-as-context
L2Tools and executionStrong (execution) / Weak (isolation)Built-in tools and MCP are complete; no built-in sandbox, container isolation must be self-provided by the host
L3Orchestration and controlMedium-strongLoop + subagents + session resume/fork; no explicit graph / DAG primitives
L4Memory and stateMedium-strongJSONL session persistence, resume/fork, checkpoint rollback; long-term memory depends on files, unstructured
L5Evaluation and observabilityWeakNo built-in Eval Set / Golden Dataset; traces must be exported manually via Hooks
L6Governance and securityStrong (mechanisms) / Medium (system)Permission chain + Hooks blocking + budget caps are all in place; no built-in RBAC / multi-tenancy / compliance reporting

5.2. L1 Context Engineering Layer

Claude Agent SDK's design at L1 can be summarized into four principles:

  1. Filesystem-as-context: large objects do not enter the context window; only the path and summary are placed in the context, and the object is read when needed. This is an extension of the "MCP-as-Code-API" approach — intermediate data stays in the execution environment rather than the context window.
  2. Subagent-as-isolation-unit: exploratory, high-noise retrieval work is pushed down to subagents, and the main context only receives the conclusions.
  3. Progressive disclosure: Skills only load name + description at session start, load the full text on a hit, and read scripts and reference files on demand.
  4. Compaction as fallback: when approaching the limit, early turns are automatically summarized.

The cost is that both compaction and isolation lose details. This is also the platform's only negative item at L1 — the more aggressive the context strategy, the weaker the traceability.

5.3. L2 Tools and Execution Layer

  • Tool registration: built-in tools + custom in-process MCP servers + external MCP servers (stdio / HTTP).
  • Call form: predominantly serial; batching is hinted at by PostToolBatch, implying a batch-call semantic exists.
  • Execution isolation: explicitly absent. According to the official docs, the SDK does not provide container isolation, and the agent can access the host filesystem by default; for production safety you must add Docker or an equivalent isolation yourself.

This item is the risk point most easily overlooked during selection: the SDK's "very capable" and "not secure by default" are two sides of the same coin.

5.4. L3 Orchestration and Control Layer

The judgment of this section is: at L3, Claude Agent SDK belongs to "implicit orchestration", forming the two ends of the same axis with LangGraph's "explicit orchestration".

Concretely:

  • Control flow is decided autonomously by the model within the loop; the developer writes no graphs and no state machines;
  • only three structured means are available: subagent derivation, Hooks interception, and session resume/fork;
  • there is no DAG, no conditional-branch primitive, and no parallel orchestrator (parallelism is achieved by deriving multiple subagents in a single prompt).

The flexibility ↔ predictability tension is sharpest here:

  • the flexibility gained: no need to enumerate paths in advance, adapting to open-ended tasks;
  • the predictability paid: the same input may take different paths across two runs, making it impossible to assert "execution order" regressions at the code level.

The corresponding engineering compensation is to confine unpredictability within Hooks and the permission chain — not to control "which way to go", but to control "which ways are forbidden". This is one representative answer offered by this platform.

5.5. L4 Memory and State Layer

MechanismPersistenceGranularityCross-session
Session JSONLDiskFull message streamYes (resume / fork)
File checkpointsDiskWorkspace snapshotYes
Memory / CLAUDE.mdDiskManually maintained fact entriesYes
SkillsDiskCapability packagesYes

Strengths: sessions can be resumed and forked, so long tasks can continue from the point of a crash.

Weaknesses: there is no semantic-oriented long-term memory (unlike Dify's knowledge base or a dedicated Memory Service); across sessions, "what to remember" still requires manual writing to files or an external retrieval system.

5.6. L5 Evaluation and Observability Layer

This is the weakest layer of the platform, and it must be clearly stated:

  • no built-in Eval Set, no Golden Dataset, no regression-set management mechanism;
  • trace data is not automatically persisted; it must be exported manually to an external observability system via Hooks such as PostToolUse / Stop;
  • no A/B or online-metric capabilities.

Therefore, any production system built on Claude Agent SDK must have L5 self-built by the host. This also confirms the judgment in the parameter card: a Framework mainly covers L2/L3 and is a subset of a Harness — Claude Agent SDK covers wider than a typical Framework, yet still does not complete L5.

5.7. L6 Governance and Security Layer

Governance capabilityImplementationStrength
Tool admissionallowed_tools / disallowed_tools allow/deny listsStrong
Behavior blockingHooks returning a deny decisionStrong
Human approvalcanUseTool callback suspensionStrong
Coarse-grained modepermission_mode (default / dontAsk / acceptEdits / bypassPermissions / plan, etc.)Medium-strong
Cost guardrailmax_budget_usd + max_turnsStrong
Audit logMust be written manually via HooksWeak (needs self-building)
Identity and tenancyNo built-in RBAC / multi-tenancyAbsent

The openness ↔ governance tension is very clear on this platform: MCP lets an agent connect to any external system — as the capability boundary opens, the attack surface opens at the same time; malicious MCP servers, prompt injection, and credential leakage all happen at this layer. The compensation the SDK offers is the trio of "Hooks highest priority + allowlist + approval callback", but this mechanism requires the host team to write and maintain it themselves; it is not an out-of-the-box compliance capability.

5.8. Concrete Manifestations of the Three Intrinsic Tensions

TensionManifestation on this platformMitigation
Flexibility ↔ predictabilityImplicit loop, control flow decided by the model, no explicit graphHooks constrain "what is not allowed" rather than "what must be done"; use max_turns to bound depth
Openness ↔ governanceMCP's three transports open interoperability but also the attack surfaceAllowlist + deny hooks + canUseTool approval; sandbox externally mounted
Cost ↔ depthSubagent parallelism and long loops significantly amplify token consumptionmax_budget_usd as a hard stop; Compaction to lower input cost; pick a model tier per task

6. Real-World Examples

The following cases all come from Anthropic's official public engineering blog, with no extrapolation of effect data.

Case One: A two-agent Harness for long-running agents

In Effective harnesses for long-running agents, Anthropic presented an initial design for long-running agents: one initializer agent is responsible for setting up the environment and writing the initial progress file, and one coding agent is responsible for advancing in increments and writing structured progress at the end of each round. The core value lies not in the model, but in the Harness cutting a long task into decidable, resumable increments. The article also gives the official positioning statement of the Claude Agent SDK, which serves as the tone-setting source cited by this group of documents.

Case Two: The three-agent evolution

In the same series of work, the design evolved from two agents to three, adding a dedicated verification / wrap-up role. This evolution shows that: as the task grows longer, the growth in Harness complexity is mainly reflected in the L3 (orchestration) and L5 (verification) layers, not the model-call layer.

Case Three: Claude Code as a same-origin validation of the Agent SDK

Claude Code and the Agent SDK share the same agent loop, so Claude Code's public data can serve as supporting evidence for the engineering usability of that loop. Third-party sources claim that within seven weeks of its release Claude Code reached 350,000 DAU, produced more than 1 million merged PRs, and generated about 1/4 of Anthropic's internal code commits — this set of data comes from secondary sources, is marked [To be verified], and is not used as a basis for conclusions.

Part for which no public quantified data was found: as of the search date 2026-09-12, no third-party enterprise adoption data with quantified effects (such as cost-reduction percentages or task success rates) officially published by Anthropic and built on the Claude Agent SDK could be found. This is stated truthfully here, with no attempt to fill the gap.

7. Summary

7.1. Strengths

  1. An officially defining sample: the vendor wrote "harness" into the product definition for the first time, and the six-layer model has a complete, comparable counterpart on this platform.
  2. Mature L1 design: the combination of context compaction, subagent isolation, and progressive disclosure is key to the feasibility of long tasks.
  3. Strong L6 mechanisms: the permission-decision chain is ordered, Hooks can hard-block, and the budget has a hard stop — among the most complete governance primitives in similar SDKs.
  4. Same origin as Claude Code: engineering validation is ample, and the tools and loop are refined through large-scale real-world use.
  5. Replaceable backends: supports Bedrock / Vertex AI / Azure AI Foundry, fitting existing cloud cost ledgers.

7.2. Weaknesses

  1. L5 is missing: there is no built-in evaluation or observability, and traces and regression sets must be self-built.
  2. No built-in sandbox: production safety requires the host to provide container isolation.
  3. Implicit L3: control flow is invisible and non-assertable, and predictability is weaker than in explicit-graph frameworks.
  4. No multi-tenancy or RBAC: it does not constitute an Agent Platform, so the tenancy, billing, and audit systems must be self-built.
  5. Cost cannot be estimated in advance: the implicit loop plus subagent parallelism makes the cost variance of a single task large.

7.3. Applicability Scope

ScenarioApplicable?Reason
Automated coding pipelines / CIApplicableSame origin as Claude Code, complete toolchain
High-risk operations requiring human approvalApplicablecanUseTool can suspend indefinitely waiting for a decision
Long-duration research-type tasksApplicableSubagent isolation + session resumption
Financial / compliance processes requiring strong predictabilityNot applicableL3 has no explicit graph, so execution-order regression is impossible
Teams needing an out-of-the-box evaluation systemNot applicableL5 must be self-built
Multi-tenant SaaS deliveryNot applicableThe SDK does not provide tenancy or billing

7.4. Selection Recommendations

  • If the team already has strong platform-engineering capabilities and can complete L5 (evaluation and observability) and the audit / tenancy parts of L6, Claude Agent SDK is currently the vendor-grade chassis with the most well-balanced six-layer coverage.
  • If the team's primary requirement is "execution order must be assertable and regressable", explicit-graph frameworks should be preferred (see 04-langgraph.md).
  • If the team's primary requirement is "non-engineering roles can also build agents", an Agent Platform should be preferred (see 05-dify.md, 06-coze.md).
  • Regardless of the choice, max_budget_usd and max_turns must be configured before the first launch; otherwise, the cost guardrail is nothing but a formality.

Information Gap Statement

  1. Exact license of each package: third-party directory sites give the statement "Python package MIT, TypeScript package Anthropic Commercial Terms", but it has not been checked package by package against the repository LICENSE file; marked [To be verified].
  2. Current latest version number: the SDK version changes rapidly with the release cadence; no authoritative version number was obtained as of the search date 2026-09-12; marked [To be verified].
  3. Specific model unit prices: unit prices given by different third-party sources for the Sonnet / Opus tiers conflict with each other; this document only retains the definitive statement "SDK is free, billed by token", and the unit price is marked [To be verified].
  4. Complete list of Hooks events: the total number of events differs across versions of the official docs (one source cites 27 event points); this document only lists the major events that can be cross-validated.
  5. Third-party enterprise adoption quantified data: no publicly verifiable enterprise-effect data built on the Claude Agent SDK was found, and no attempt was made to fill the gap.
  6. Functional boundary of Managed Agents: it is a different product from the Agent SDK; no dedicated search was done this time, and its pricing and quotas are marked [To be verified].

8. References

  1. Effective harnesses for long-running agents — Anthropic Engineering, 2025. https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
  2. Agent SDK overview — Anthropic (Claude Code Docs). https://platform.claude.com/docs/en/agent-sdk/overview
  3. Intercept and control agent behavior with hooks — Anthropic (Claude Code Docs). https://code.claude.com/docs/en/agent-sdk/hooks
  4. Equipping agents for the real world with Agent Skills — Anthropic Engineering, 2025. https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
  5. Claude Agent SDK — Agent Patterns Catalog (component list and licensing terms). https://www.agentpatternscatalog.org/compositions/claude-agent-sdk
  6. Claude Agent SDK — Anthropic's Framework for Production AI Agents — Cybernauten. https://cybernauten.com/tools/claude-agent-sdk
  7. Claude Agent SDK: Features, Pricing & Alternatives — AI Coolies. https://aicoolies.com/tools/claude-agent-sdk
  8. New tools for building agents — OpenAI (as a contemporaneous reference for the formalization of the orchestration layer). https://openai.com/blog/new-tools-for-building-agents
  9. R01-Overview research report (Harness definition, MCP timeline, Skills release milestones) — this project's internal research report.
  10. Project parameter card v1.0 (six-layer capability model and conceptual boundaries) — this project's internal baseline document.