最新资讯
dev.to 你的 Agent Harness 应具备的 17 项能力 dev.to 离线 AI 记忆中 0.8 余弦阈值为何失效 dev.to Kimi K3.1 Pro 开放权重:自托管 2.8T 模型前的开发者清单 dev.to 如何通过工具调用引导模型以提升 Harness 质量 dev.to AI Agent 审计轨迹不等于对话记录 dev.to 精简 MCP server 工具数量:更少工具、更小影响面,双重收益 dev.to 为什么 git checkout 无法撤销 AI 编码 agent 的改动? wechat AI短剧门槛降降降!实测即梦短剧工作室:剧本分镜预演一条龙,伙伴计划长期护航 dev.to 让模型改写文档前,先量化事实保真度 dev.to 回放 153 个 Claude Code 与 Codex 会话,审计 Agent 的生产影响范围 dev.to 银行 77 意图分类最便宜 LLM:GPT-6.1 Terra 每次成功任务 $0.000727 theinformation.com Chesky的副业:Airbnb向CEO新设AI实验室出售IP
多元动态
登录 注册
智能体 dev.to · @Marc

对 agent 而言,没有文档的处理函数等于不存在

原文 我的收藏

作者将应用内 AI agent 接入已有完整读写接口的产品时发现,agent 有写权限,但所需处理函数有一半未出现在工具列表中。原因是 agent 不读取原始 TypeScript,而是使用由应用挂载的 handlers、screens、entities 生成的 manifest,每个条目需在定义处写一段简短描述,缺失描述即被丢弃,模型根本看不到该工具。作者称有 21 个处理函数因此缺失,并指出面向 agent 的处理函数若无描述则完全不可调用。

AI推荐理由 提出一个具体且可操作的 agent 工程经验:agent 的工具清单由带描述字符串的 manifest 生成,缺少描述的处理函数不会出现在工具列表中,模型因此完全看不到、无法调用。作者以实际接入产品时 21 个处理函数缺失为例,说明描述字符串对 agent 是准入门槛而非文档装饰,对构建 agent 工具接口有直接参考价值。

73

正文

We wired an in-app AI agent into a product that already had a full write/query surface. Auth was fine. The agent had permission to call writes. Half the handlers it needed simply never showed up in its tool list. The agent said it couldn't find them. The handlers existed. What was missing was a description string. What the agent can see Our agent doesn't get raw TypeScript. It gets a manifest built from every feature the app mounts: handlers, screens, entities. Each entry needs a short description, written at the place the handler is defined. Without that string, the entry is dropped. The agent never learns the name exists. That surprised a few people, including me the first time. We treated descriptions as documentation polish. For the agent they are the gate. An endpoint without an OpenAPI description might still be callable if you know the path. An agent-facing handler without a description isn't callable at all, because the model never sees a tool to choose. Twenty-one handlers across our AI pipeline and prompt store features were in that state. The code ran for humans in the UI. The agent walked past them. You also can't patch this later at the composition site. The description has to live next to the handler definition, so every app that mounts the feature inherits it. We learned that the hard way: people tried to "add docs" in the app and the gap tests kept failing, because the packaged feature still shipped blank. Always allow is a permission, not a mood Visibility is half of it. The other half is what happens after the agent picks a tool. Writes default to risk mid. Queries default to low. The UI can offer "always allow" for those. Two of our writes are different: { name: "delete-golden", description: "Permanently deletes a golden fixture, so it can no longer be used for dry-runs. This is a hard delete, not an appended revision, and cannot be undone.", agent: { risk: "high" }, // ... } Enter fullscreen mode Exit fullscreen mode { name: "edit", description: "Saves new content for a prompt template by appending a revision that becomes the active prompt immediately… The owning AI feature uses this content verbatim as its system prompt…", agent: { risk: "high" }, // ... } Enter fullscreen mode Exit fullscreen mode delete-golden is a hard delete. Prompt edit is free text that becomes another feature's system prompt on the next run. Both are marked high. The permission loop refuses always for those handlers outright. You can still approve a single call. You cannot teach the agent that this shape of write is permanently fine. Most of the neighbouring writes append a restorable revision (set-policy, rollback, prompt revert). Those stay at the default. Restorable side effects and irreversible ones share a form in the code; they don't share a permission ceiling. Phone apps already do this split. Camera access can be "always". Wipe storage can't. We needed the same ceiling for an agent that can press buttons faster than a human reviews them. Make the gap fail a test Once you decide "no description means invisible", silence becomes the failure mode. The agent looks underpowered. Nobody opens a ticket that says "missing string on handler 14". So each feature that should be agent-visible gets a gap test: test("createAiPipelineFeature([]) exposes 0 doc gaps", () => { const gaps = findAgentDocGaps([createAiPipelineFeature([])]); expect(gaps).toEqual([]); }); test("delete-golden is high risk, set-policy is mid risk", () => { const feature = createAiPipelineFeature([]); expect(resolveAgentExposure(feature.writeHandlers["delete-golden"], "write").risk).toBe("high"); expect(resolveAgentExposure(feature.writeHandlers["set-policy"], "write").risk).toBe("mid"); }); Enter fullscreen mode Exit fullscreen mode The first test is the smoke alarm for missing descriptions. The second pins the two risk decisions we actually care about, so a refactor can't quietly demote a hard delete back to "always allow"-eligible. We also run the same gap lint from a CLI against a whole app config. Shipping a new consumer feature without descriptions turns red before anyone asks the agent to do a demo. What we tell ourselves now If a human can click it and an agent should be able to call it, write the description where the handler is defined. One sentence that says what changes and what stays reversible is enough; our pipeline descriptions are longer because the agent needs the follow-up query names (revisions before activate). If the write can't be undone, or it rewrites another feature's brain, mark it high. Don't rely on the operator to remember which "always allow" clicks were a bad idea. If you only remember one check: ask the agent to list what it can do, then compare that list to your write handlers. The missing names are usually missing strings, not missing models. I wrote earlier about schemas beating prose for tool outputs. This is the other side of the same habit. There the description was advice and the schema was the contract. Here the description is the contract for whether the tool exists at all, and risk is the contract for whether "always" is even legal.

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容