Agent 将 const 误解为字面值而非 schema 约束 #129
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
当 output schema 使用
const关键字时,agent 不理解这是 JSON Schema 约束,而是把const当作字面值输出。复现
hello.yaml:
运行后 agent 输出:
期望输出:
分析
const是 JSON Schema 规范关键字,意思是"值必须是这个"。但 agent 不懂 JSON Schema,它看到的只是原始 schema 文本。根因
UWF 引擎应该把
const: greeted翻译成 agent 能理解的提示词,例如:而不是把原始 schema 直接丢给 agent。
临时 Workaround
在 procedure 里明确告诉 agent 输出什么值: