Skip to content

fix(extensions-agui): convert SUMMARY events to AG-UI messages (#1029)#1168

Open
lynx009 wants to merge 3 commits intoagentscope-ai:mainfrom
lynx009:fix/extensions-agui-summary-event-1029
Open

fix(extensions-agui): convert SUMMARY events to AG-UI messages (#1029)#1168
lynx009 wants to merge 3 commits intoagentscope-ai:mainfrom
lynx009:fix/extensions-agui-summary-event-1029

Conversation

@lynx009
Copy link
Copy Markdown

@lynx009 lynx009 commented Apr 8, 2026

Description

Fixes #1029.

When a ReAct agent reaches maxIters, AgentScope emits a SUMMARY event as a fallback response.
Before this change, extensions-agui only converted REASONING events into AG-UI text events, so the client only received RUN_FINISHED and could not see the summary content.

This PR updates the AG-UI adapter to also convert EventType.SUMMARY using the existing text-message mapping path.
As a result, when the agent stops because it exceeds maxIters, the frontend can still receive the final summary content through AG-UI events.

Changes included:

  • Handle EventType.SUMMARY in the AG-UI adapter
  • Reuse the existing text/reasoning event conversion flow
  • Add regression tests for normal summary and streaming summary cases

How to verify:

  • Configure an agent with maxIters=1
  • Send a request that requires at least one tool call before producing the final answer
  • Before the fix:
    • the AG-UI stream ends after TOOL_CALL_RESULT with RUN_FINISHED
    • no assistant summary text is delivered
  • After the fix:
    • the AG-UI stream includes TEXT_MESSAGE_START / TEXT_MESSAGE_CONTENT / TEXT_MESSAGE_END
    • the summary content is visible to the client

Checklist

  • Code has been formatted
  • All tests are passing
  • Javadoc comments are complete and follow project conventions
  • Code is ready for review

@lynx009 lynx009 requested review from a team and Copilot April 8, 2026 13:43
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 8, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes extensions-agui event conversion so that AgentScope EventType.SUMMARY events (emitted as a fallback when a ReAct agent hits maxIters) are converted into AG-UI text-message events, ensuring the client receives the summary content instead of only RUN_FINISHED.

Changes:

  • Extend AguiAgentAdapter conversion logic to treat EventType.SUMMARY like EventType.REASONING for text/reasoning block mapping.
  • Update adapter Javadoc to reflect SUMMARY event mapping.
  • Add regression tests covering both single-chunk and multi-chunk streaming summary scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
agentscope-extensions/agentscope-extensions-agui/src/main/java/io/agentscope/core/agui/adapter/AguiAgentAdapter.java Adds EventType.SUMMARY handling to the existing REASONING conversion path and updates the documented event mapping.
agentscope-extensions/agentscope-extensions-agui/src/test/java/io/agentscope/core/agui/adapter/AguiAgentAdapterTest.java Adds tests verifying SUMMARY events are converted into AG-UI TEXT_MESSAGE_* events for both non-streaming-like and streaming-like summary emissions.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...agentscope/core/agui/adapter/AguiAgentAdapter.java 66.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@lynx009
Copy link
Copy Markdown
Author

lynx009 commented Apr 8, 2026

Setting maxIters to 1, the single round ReAct test samples are as follows, and the same results are obtained for multiple rounds of ReAct test samples.

Before the fix:
截屏2026-04-08 22 04 29
When reaching maxIters, it is necessary to inquire about the results again:
截屏2026-04-08 22 15 42
After the fix:
截屏2026-04-08 22 05 41

@lynx009 lynx009 force-pushed the fix/extensions-agui-summary-event-1029 branch from f543ac6 to 384c4de Compare April 9, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [extensions-agui] 超过maxIters了, 是否也需要将SUMMARY事件转换为AG-UI事件

3 participants