Tools are security boundaries

Giving an agent access to an external system is not a prompt feature. It is an identity, credential, policy, and audit decision.

The moment an agent can call an external tool, it stops being only a text interface. It can read a customer record, create a ticket, deploy code, query a data warehouse, or send a message under a company's name. The technical question of whether the model can form the right API request is usually the easy part.

The harder questions are operational. Who granted this reach? Which exact operations are allowed? Where does the credential live? Can a person inspect a sensitive action before it happens? If something goes wrong, can the team tell which agent and which task caused it?

Those questions make tools security boundaries.

A connector is not a bag of secrets

The early pattern for agent integrations is understandable: place API keys in an environment file, expose a few wrappers, and instruct the model to be careful. It is fast, and it demonstrates value. It also leaves the runtime with a broad credential that can be exposed through logs, subprocesses, file reads, or prompt injection.

A production design should separate the agent's request from the credential used to fulfill it. The agent can ask to use a connector. A trusted control plane checks the task identity and policy, resolves a scoped credential outside the model environment, performs or brokers the request, records the result, and returns only what the task needs.

This arrangement changes more than secret handling. It creates a place to enforce policy and produce a meaningful audit trail.

Reads, writes, and consequences

"Can use Slack" is not a useful permission. Reading a project channel, drafting a message, posting it, deleting history, and changing workspace settings all have different consequences. The same is true for source control, cloud infrastructure, billing, and internal data systems.

An agent policy should reflect those differences. It might allow routine reads, permit a branch write inside an isolated environment, require approval before external sends, and block destructive operations altogether. The important thing is not the exact set of labels. It is that the rule is visible, reviewable, and enforced outside the model.

This also helps teams make sensible tradeoffs. A support assistant can summarize a ticket without being able to issue a refund. An engineering agent can run tests and open a change request without merging to the shared branch. A research assistant can retrieve papers without having the ability to alter a source dataset. Capability remains useful because authority is scoped.

Treat every call as attributable

When a shared service account performs all agent actions, downstream logs often show only that the account made a request. The missing context is precisely what a security review needs: which person initiated the work, which agent carried it out, which project or tenant it belonged to, which policy applied, and whether a human approved the operation.

A well-designed runtime carries that context through the call. It does not need to expose private reasoning, but it should preserve the identity and decision path that made the action legitimate. That record supports incident response, revocation, billing, and ordinary debugging.

It also creates a better user experience. Rather than receiving a vague warning that an agent wants to "use a tool," a person can see that a task is requesting permission to publish a specific preview to a specific environment, using a limited grant, because a review needs a visible artifact. The difference is clarity.

Prompt injection does not respect intent

Tool access becomes particularly sensitive when an agent reads untrusted content. A document, webpage, issue, or email can contain instructions that conflict with the user's intent. A model may not be able to perfectly distinguish content from commands, especially when the request is complex and the content is persuasive.

The answer is not a stronger sentence in the system prompt. The answer is containment. The tool layer should limit what the task can do, the credentials it can reach, and the operations that can leave the workspace. Risky actions should require an explicit policy decision or human approval. The system should assume that any text an agent reads may be adversarial and should not let that text expand the agent's authority.

This is why the boundary needs to be structural. A model can make an imperfect judgment; the runtime should still prevent that judgment from becoming unrestricted access.

Security should make useful work easier to trust

Security controls are often described only as restrictions. In an agent system, good controls can make useful work easier to delegate. When a person knows that an agent has only the connector grants needed for a task, that external sends require approval, and that every action is attributable, they can hand it more meaningful work with less anxiety.

The goal is not to create a maze of confirmations. It is to make the real boundary visible: what the agent can observe, what it can change, what it can propose, and what must remain a human decision.

Tools are where models meet the world. That meeting deserves the same care as any other production security boundary.

工具就是安全边界

让 Agent 访问外部系统不是一个 Prompt 功能,而是一次身份、凭证、政策与审计决定。

当 Agent 能够调用外部工具时,它就不再只是文本界面。它可以读取客户记录、创建工单、部署代码、查询数据仓库,或以公司的名义发送消息。模型能否生成正确 API 请求,通常反而是容易的问题。

更难的是运行问题:是谁授予了访问?哪些具体操作被允许?凭证放在哪里?敏感动作发生前,人能否检查?如果出了问题,团队能否知道是哪个 Agent、哪个任务造成的?

这些问题让工具成为安全边界。

外部工具不应该是一袋秘密

Agent 集成早期常见的方式可以理解:把 API Key 放进环境文件,暴露几个封装函数,再告诉模型要小心。这种方式很快,也能展示价值,但它会把宽泛凭证暴露给日志、子进程、文件读取或 Prompt Injection。

生产设计应该把 Agent 的请求和执行请求所需的凭证分开。Agent 可以请求使用外部工具;可信控制平面检查任务身份和政策,在模型环境之外解析范围受限的凭证,执行或代理请求,记录结果,只把任务需要的内容返回。

这个安排改变的不只是秘密管理,也创造了执行政策和产生有效审计记录的位置。

读取、写入与后果

“可以使用 Slack”不是有用的权限。读取项目频道、起草消息、发布消息、删除历史和修改工作区设置,会产生完全不同的后果。源码管理、云基础设施、账单和内部数据系统也一样。

Agent 政策应该体现这些区别。它可以允许日常读取,允许隔离环境中的分支写入,要求外部发送前审批,并完全阻止破坏性操作。关键不是具体标签,而是规则在系统外部可见、可审查并被执行。

这样,团队也能做出更合理的权衡。支持助手可以总结工单,却不能发起退款;工程 Agent 可以运行测试并创建变更请求,却不能合并到共享分支;研究助手可以检索论文,却不能修改源数据集。能力仍然有用,因为权限是有范围的。

每次调用都应该可追溯

当所有 Agent 动作都使用共享服务账号时,下游日志通常只能显示这个账号发出了请求。安全 review 真正需要的上下文却不见了:谁发起工作、哪个 Agent 执行、属于哪个项目或租户、适用什么政策,以及是否有人批准了操作。

设计良好的运行时会把这些上下文带过调用。它不必暴露私有推理,但应该保存让动作合法的身份和决定路径。这份记录支持事故响应、撤销、计费和普通调试。

它还会改善体验。人与其收到“Agent 想使用工具”的模糊警告,不如看到任务正在请求向某个环境发布具体预览,使用范围受限的授权,因为 review 需要可见产物。区别就在于清晰。

Prompt Injection 不会尊重意图

当 Agent 读取不可信内容时,工具访问尤其敏感。文档、网页、Issue 或 Email 可能包含与用户意图冲突的指令。请求复杂、内容有说服力时,模型不一定能完美区分内容和命令。

答案不是在系统 Prompt 中再加一句更强的警告,而是进行隔离。工具层应该限制任务可以做什么、可以接触哪些凭证,以及哪些操作能够离开工作区。高风险动作应该要求明确政策决定或人工审批。系统应该假设 Agent 读取的任何文字都可能是对抗性的,不能让文字扩张 Agent 的权限。

边界必须是结构性的。模型可能做出不完美的判断,运行时仍然应该阻止这个判断变成无限制访问。

安全应该让有用工作更容易被信任

安全控制常被描述成限制。在 Agent 系统中,好的控制可以让有用工作更容易被委托。当一个人知道 Agent 只拥有任务所需的工具授权、外部发送必须审批、每个动作都可追溯时,就可以更放心地把有意义的工作交给它。

目标不是制造确认迷宫,而是让真实边界可见:Agent 能观察什么、能改变什么、能提出什么,以及什么必须仍然由人决定。

工具是模型与世界相遇的地方。这个相遇应该和任何其他生产安全边界一样被认真对待。