工具使用 · 说一句与做一下之间Tool Use · Between Saying and Doing
model request → tool choice → permission → confirmation →
external result
工具使用(Tool Use)让模型选择并调用外部函数、API
或程序,以读取信息或改变状态。它把语言候选变成系统动作,因此权限、成本和副作用必须在执行前可见。Tool use lets a model select and call an external function, API, or
program to read information or change state. It turns language into
system action, so permission, cost, and side effects must be visible
before execution.
01 · 查询与发送不是同一种“会做”01 · Reading and sending are different kinds of action
搜索网页、读取数据库、给客户发消息,都叫“用工具”,风险会一样吗?Search the web, read a database, send a customer message: all are
tools, but do they carry the same risk?
⌁
02工具坞:切换工具,执行门随之改变Tool Dock: Switch Tools, Watch the Gate Change
执行前可见visible before action
权限Permission
GRANTED
最小权限集least-privilege scope
执行门Execution gate
READY
read-only tool
已产生副作用Side effects made
0
外部改变external changes
03一次工具调用要看 4 个零件Four Parts of a Tool Call
动作不是文本action is not text
CHOICE
选对工具Choose the right tool
同一目标可能需要读信息或改状态;工具能力必须与任务匹配。A goal may require reading information or changing state.
Capability must match the task.
PERMISSION
核验权限Verify permission
模型提出调用不等于获得权限,应用必须按真实身份和范围判定。A model requesting a call does not grant permission. The
application checks identity and scope.
SIDE EFFECT
标明副作用Expose side effects
搜索与读库不改变外部状态;发信、付款、删除会影响真实对象。Search and database read do not change external state; sending,
paying, or deleting does.
RESULT
读回真实结果Read the real result
HTTP 200
或函数返回只是调用状态,还要校验业务目标是否真的完成。HTTP 200 or a function return shows call status; the business
outcome must still be checked.
04最小机制:三道门共同放行才执行Minimal Mechanism: Three Gates Must Agree
execute = schema ∧ permission ∧ confirm
run = valid ∧ allowed ∧ confirmedif side effect
切到“发消息”后确认门变为必需。未勾选时执行按钮会被拒绝,而不是由模型自行决定绕过。For “send message,” confirmation becomes mandatory. Without
it, execution is denied rather than left to the model to
bypass.
结构有效Valid structure工具名与参数明确tool name and arguments defined
权限允许Permission allows限定真实能力范围real capability is scoped
副作用已确认Side effect confirmed再交给执行环境then hand to execution
让草稿直接变成客户收到的消息Turn a draft directly into a customer message
模拟错误 Harness 无视确认状态,直接调用
send_message。语言错误立即变成不可撤回的外部副作用。This toy failure makes the Harness ignore confirmation and call
send_message directly. A language error becomes an external side
effect.
尚未执行。外部副作用计数为 0。Not run yet. External side effects remain at zero.
✗ 模型能写函数名,就有权调用。If the model can name a function, it may call it.
→ ✓ 能力发现与真实授权是两道不同的门。Capability discovery and real authorization are separate
gates.
✗ 工具返回成功,业务目标就完成。A successful tool return means the business goal is
complete.
→ ✓ 还要读回环境并核验实际结果。Read the environment and verify the actual outcome.
✗ 所有工具只是“查询”,没有风险。All tools are harmless queries.
→ ✓ 发信、删除、付款都会改变真实世界。Sending, deleting, and paying change the real world.
06 · 一句话带走06 · One line to keep
工具使用把模型的语言候选变成外部读取或状态改变;工具越有副作用,越要在执行前独立核验结构、权限、成本与确认。Tool use turns a model’s language candidate into an external read
or state change. The greater the side effect, the more important
independent structure, permission, cost, and confirmation checks
become.