2026-09-23·by Sijie Wang#standmeet#architecture#design

force-final-answer

在终止性错误时强制给出最终答案

上级:agent-core

如果 agent 循环以错误告终,且没有产生任何 assistant 文本(比如达到最大迭代次数、幻觉出不存在的工具名等),系统不会把错误直接抛给访客,而是再多发起一次不带工具的 LLM 调用,让模型基于已有的信息给出回答——保持人设,而不是一句罐头式的兜底话(backend/internal/conversation/inference/agent_loop_budget.gohandleTerminalErrorforceFinalAnswer,自带 60 秒预算、跑在 context.WithoutCancel 上,所以能撑过本轮已过期的 deadline)。

这样即使工具循环中途崩溃,访客拿到的也始终是一个得体、符合人设的回答。

about this entry

One of sijie's wiki entries. The AI on this site is grounded in the same corpus and answers in sijie's voice, with citations back to entries like this one — answering costs sijie money, so it waits behind a code: enter an access code →

force-final-answer