“think” 工具:让 Claude 在复杂工具使用中停下来思考¶
- 原文链接:https://www.anthropic.com/engineering/claude-think-tool [58]
- 发布时间:2025-03-20
- 作者:未署名
通过为思考留出专用空间,“think” 工具显著提升了复杂工具使用的表现。[58]
扩展思考更新(2025-12-15): 扩展思考能力自初次发布以来已经提升,通常建议优先使用扩展思考而非单独的 think 工具。扩展思考能提供类似收益(为复杂问题提供推理空间),且在集成与性能上更好。实现细节请参考扩展思考文档。[58]
随着 Claude 在复杂问题求解上的持续增强,我们发现一种非常有效的方法:使用 “think” 工具,为复杂任务提供结构化思考的专用空间。[58]
这种简单但强大的技术——如后文所述,它与 Claude 的“扩展思考”能力不同(实现细节见 extended thinking 文档)——显著提升了 Claude 的代理式工具使用能力,包括遵循政策、保持一致决策、处理多步问题,且实现成本很低。[58]
本文将基于基准评测结果,介绍在不同应用中实现“think”工具的方法,并给出开发者可操作的建议。[58]
什么是 “think” 工具?¶
“think” 工具让 Claude 在生成最终答案过程中,插入一个“停下来想一想”的步骤,并提供独立的思考空间。[58]
它看起来与扩展思考相似,但概念不同。扩展思考关注的是 Claude 在生成响应前的规划与迭代;而 “think” 工具发生在生成过程中,让 Claude 判断是否已经掌握继续前进所需的信息。这在长链工具调用或多轮对话里尤为有用。[58]
当用户问题本身无法提供充分信息、需要从工具结果中获取新信息时,“think” 更合适。它的推理深度通常不如扩展思考,但更聚焦于模型刚发现的新信息。[58]
对于较简单的工具使用场景(如非串行工具调用、直接执行指令),我们建议使用扩展思考。扩展思考也适用于不需要调用工具的场景,如编码、数学与物理问题。而 “think” 更适合:需要调用复杂工具、在长链工具调用中仔细分析输出、在政策密集环境中严格对齐规范,或每一步都依赖上一步且错误代价高的顺序决策。[58]
下面是来自 τ-Bench 标准工具规范的示例实现:[58]
{
"name": "think",
"description": "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
"input_schema": {
"type": "object",
"properties": {
"thought": {
"type": "string",
"description": "A thought to think about."
}
},
"required": ["thought"]
}
}
在 τ-Bench 上的表现¶
我们使用 τ-bench 评测 “think” 工具。τ-bench 是一套面向真实客服场景的综合基准,其中 “think” 也是标准环境的一部分。[58]
τ-bench 评测 Claude 在以下方面的能力:[58]
- 与模拟用户进行真实对话
- 在复杂客服政策下保持一致遵循
- 使用多种工具访问和操作环境数据库
τ-bench 主要指标是 pass^k:表示某任务在 k 次独立尝试中全部成功的概率,并在任务集合上取平均。它不同于常见的 pass@k(只要 k 次中任意一次成功即可),pass^k 更强调一致性与可靠性,尤其适合客服场景。[58]
表现分析¶
我们对比了多种配置:[58]
- 基线(无 “think” 工具、无扩展思考)
- 仅扩展思考
- 仅 “think” 工具
- “think” + 优化提示(航空领域)
结果显示,在 “airline” 与 “retail” 两个客服领域中,Claude 3.7 有显著提升:[58]
- 航空领域:“think + 优化提示”在 pass^1 上达到 0.570,基线仅 0.370,相对提升 54%。
- 零售领域:仅 “think” 达到 0.812,高于基线 0.783。

图注:Claude 3.7 Sonnet 在 Tau-Bench “airline” 领域四种配置下的表现。[58]
Claude 3.7 Sonnet 在 Tau-Bench “airline” 领域的表现:
| 配置 | k=1 | k=2 | k=3 | k=4 | k=5 |
|---|---|---|---|---|---|
| “Think” + Prompt | 0.584 | 0.444 | 0.384 | 0.356 | 0.340 |
| “Think” | 0.404 | 0.254 | 0.186 | 0.140 | 0.100 |
| Extended thinking | 0.412 | 0.290 | 0.232 | 0.192 | 0.160 |
| Baseline | 0.332 | 0.206 | 0.148 | 0.116 | 0.100 |
评分为比例值。[58]
航空领域最佳表现来自 “think + 优化提示”,因为它提供了处理客户请求时的思考范式示例。以下是优化提示示例:[58]
## Using the think tool
Before taking any action or responding to the user after receiving tool results, use the think tool as a scratchpad to:
- List the specific rules that apply to the current request
- Check if all required information is collected
- Verify that the planned action complies with all policies
- Iterate over tool results for correctness
Here are some examples of what to iterate over inside the think tool:
<think_tool_example_1>
User wants to cancel flight ABC123
- Need to verify: user ID, reservation ID, reason
- Check cancellation rules:
* Is it within 24h of booking?
* If not, check ticket class and insurance
- Verify no segments flown or are in the past
- Plan: collect missing info, verify rules, get confirmation
</think_tool_example_1>
<think_tool_example_2>
User wants to book 3 tickets to NYC with 2 checked bags each
- Need user ID to check:
* Membership tier for baggage allowance
* Which payments methods exist in profile
- Baggage calculation:
* Economy class × 3 passengers
* If regular member: 1 free bag each → 3 extra bags = $150
* If silver member: 2 free bags each → 0 extra bags = $0
* If gold member: 3 free bags each → 0 extra bags = $0
- Payment rules to verify:
* Max 1 travel certificate, 1 credit card, 3 gift cards
* All payment methods must be in profile
* Travel certificate remainder goes to waste
- Plan:
1. Get user ID
2. Verify membership level for bag fees
3. Check which payment methods in profile and if their combination is allowed
4. Calculate total: ticket price + any bag fees
5. Get explicit confirmation for booking
</think_tool_example_2>
不同方案对比显示:带优化提示的 “think” 明显优于扩展思考(其效果接近“未提示”的 think)。单独使用 “think” 虽优于基线,但仍不及优化方案。[58]
“think + 优化提示”优势巨大,可能源于航空政策复杂度高,airline policy 需要模型学习“如何思考”。[58]
在零售领域,我们也测试了多种配置:[58]

图注:Claude 3.7 Sonnet 在 Tau-Bench “retail” 领域三种配置下的表现。[58]
Claude 3.7 Sonnet 在 Tau-Bench “retail” 领域的表现:
| 配置 | k=1 | k=2 | k=3 | k=4 | k=5 |
|---|---|---|---|---|---|
| “Think” + no prompt | 0.812 | 0.735 | 0.685 | 0.650 | 0.626 |
| Extended thinking | 0.770 | 0.681 | 0.623 | 0.581 | 0.548 |
| Baseline | 0.783 | 0.695 | 0.643 | 0.607 | 0.583 |
评分为比例值。[58]
在零售领域,“think” 即使不加提示也达到最高 pass^1(0.812)。相比航空领域,retail policy 更容易,Claude 仅凭“有地方思考”就能提升表现。[58]
τ-Bench 的关键洞察¶
基于分析,我们得到几条可操作模式:[58]
- 难域依赖提示:复杂领域必须配合优化提示;简单领域可能只需开放 think 即可。
- 一致性提升:从 pass^k(k≤5)看,“think” 能帮助 Claude 更好处理边界与异常情况。
在 SWE-Bench 上的表现¶
我们在 SWE-bench 中也加入了类似 “think” 工具,帮助 Claude 3.7 Sonnet 获得 0.623 的 SOTA 成绩。其定义如下:[58]
{
"name": "think",
"description": "Use the tool to think about something. It will not obtain new information or make any changes to the repository, but just log the thought. Use it when complex reasoning or brainstorming is needed. For example, if you explore the repo and discover the source of a bug, call this tool to brainstorm several unique ways of fixing the bug, and assess which change(s) are likely to be simplest and most effective. Alternatively, if you receive some test results, call this tool to brainstorm ways to fix the failing tests.",
"input_schema": {
"type": "object",
"properties": {
"thought": {
"type": "string",
"description": "Your thoughts."
}
},
"required": ["thought"]
}
}
实验(n=30 含 think,n=144 不含 think)表明,引入该工具平均提升 1.6%(Welch t-test: t(38.89)=6.71,p<.001,d=1.47)。[58]
什么时候使用 “think” 工具¶
基于评测结果,最适合的场景包括:[58]
- 工具输出分析:需要在行动前仔细处理工具结果,并可能回溯策略。
- 政策密集环境:需要严格遵循细则并验证合规。
- 顺序决策:每一步建立在前一步之上,错误代价高。
实现最佳实践¶
基于 τ-bench,我们建议如下:[58]
1. 用领域示例进行策略性提示¶
最有效的方法是在系统提示中清晰说明何时、如何使用 “think”,并给出与你业务相关的示例。这会显著提高工具使用质量:[58]
- 期望的推理细节层级
- 如何把复杂指令拆成可执行步骤
- 常见场景的决策树
- 如何检查是否收集齐必要信息
2. 把复杂指导放进系统提示¶
当指导较长或复杂时,把它放进系统提示比放进工具描述更有效。系统提示能提供更宏观的上下文,让模型更好地整合思考过程。[58]
什么时候不该用 “think” 工具¶
“think” 工具并不适用于所有场景,并会增加提示长度与输出 token。我们发现以下场景没有收益:[58]
- 非顺序工具调用:一次或并行工具调用即可完成的任务。
- 简单指令执行:约束少、默认行为足够好时,不需要额外思考。
开始上手¶
“think” 工具的接入成本很低,几步即可带来收益:[58]
- 先在复杂代理场景中测试:优先选择当前在政策合规或长链工具调用上表现不佳的用例。
- 添加工具定义:基于业务场景定制 “think” 工具,并考虑在系统提示中加入使用规则与示例。
- 监控并迭代:观察使用方式,调整提示以强化有效的思考模式。
引入该工具几乎没有副作用:除非 Claude 自己决定调用,它不会改变外部行为,也不会干扰现有工具与流程。[58]
结论¶
研究表明,“think” 工具能显著提升 Claude 3.7 Sonnet 在复杂工具链与政策遵循场景的表现。“think” 并非万能,但在正确场景下能以极低实现成本带来明显收益。[58]
我们期待看到你如何用 “think” 工具构建更强大、更可靠、更透明的 AI 系统。[58]
- 虽然 τ-Bench 的结果基于 Claude 3.7 Sonnet,我们的实验显示 Claude 3.5 Sonnet (New) 在相同配置下也能获益,说明该改进可泛化到其他 Claude 模型。[58]