You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Distinguish the final-round answer from intermediate reasoning text in ReAct streaming events #2872
I plan to add an opt-in FinalAnswerFilterMiddleware under agentscope-core.
It will buffer text events during each reasoning round, discard them when a
tool call is detected, and emit them only when the round finishes without a
tool call. Non-text events and the existing default behavior will remain
unchanged.
The middleware will use per-subscription state to support concurrent sessions.
I will also add focused tests for direct answers, tool-calling rounds, event
ordering, and state isolation.
Since the final round can only be identified after the model call completes,
the text needs to be buffered until ModelCallEndEvent.
Would this implementation direction be acceptable for a PR?
Activity
jujn commentedon Aug 30, 2026
可以用 middleware:
wmh123wmh1 commentedon Sep 1, 2026
Hi, I would like to work on this issue.
I plan to add an opt-in
FinalAnswerFilterMiddlewareunderagentscope-core.It will buffer text events during each reasoning round, discard them when a
tool call is detected, and emit them only when the round finishes without a
tool call. Non-text events and the existing default behavior will remain
unchanged.
The middleware will use per-subscription state to support concurrent sessions.
I will also add focused tests for direct answers, tool-calling rounds, event
ordering, and state isolation.
Since the final round can only be identified after the model call completes,
the text needs to be buffered until
ModelCallEndEvent.Would this implementation direction be acceptable for a PR?
dargoner commentedon Sep 2, 2026
这个好,需要这个功能,目前框架对智能体的自研自答,思考过程和正文区分不开。
feat(middleware): add final answer filter for ReAct streams (agentsco…
AriseFX commentedon Sep 8, 2026
建议增加一个零参数的
final_answer()终止工具:final_answer(),框架注入用户问题、对话历史和工具结果。这样在生成正文前就能确定它属于最终回复,不依赖模型原生
phase,也不用缓存整篇答案。代价是增加一次模型调用及其首字等待。