添加工具
当 Anyy 需要新的 runtime behavior 时才添加 tool。如果 reusable instructions 加 existing tools 足够, 请写 skill。
Tool Descriptor
Runtime tools 通过 internal/tools 使用 protocol.ToolDescriptor。Descriptor 命名 tool、toolset、
schema、risk、timeout、output budget、approval policy、execution policy 和 audit category。
Names 是 model-visible API。修改前要保持稳定并补 tests。
参数 Schema
Schemas 是 JSON-schema-like maps。Handler 中仍需验证 decoded arguments;model 和 UI 都不是可信 validator。
当 action 会 mutate state 或触碰 host 时,拒绝 unknown 或 unsafe inputs。
风险级别
Risk classes 位于 internal/protocol:read、runtime-low、runtime-high、config-low、
config-high、credential-high、dangerous 和 force-required。
选择最低但准确的 class。不要把 file writes、shell operations、credential changes 或 config mutations 标成 read-only。
审批策略
Approval policy 和 execution policy 决定 call 是直接运行、审计、需要 confirmation,还是需要 ChangePlan。
State-changing host operations 应使用 ChangePlan semantics,除非附近已有明确的 lower-risk pattern。
审计类别
尽量使用现有 protocol.AuditCategory。Audit records 应 bounded 且 redacted,同时足够说明发生了什么变化。
不要在 audit metadata 中包含 raw secrets、provider tokens、channel tokens 或完整 private payloads。
测试
添加 descriptor shape、argument validation、approval behavior、audit output、result budgeting 和 toolset visibility 的 tests。
如果 tool 通过 RPC 或 dashboard setup 暴露,也要在该边界补 tests。