feat(agui): Upgrade AG_UI module event mechanism - #2306
Merged
Conversation
oss-maintainer
approved these changes
Jul 19, 2026
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
This PR contains 3314 lines of changes. Review in progress.
Automated review by github-manager-bot
…; Allow to emit token usage event
…; Allow to emit token usage event
|
这个PR 中,只是抽象定义 AguiRuntimeContextResolver 接口,没有提供任何默认实现,是目前不需要默认的实现是吗? |
Collaborator
Author
后面可以慢慢完善,欢迎参与。 |
当前这个 PR 已合入主分支。 #2463 是延续这个进行调整的,烦请及时确认合并。 |
4 tasks
wzq-xzwj
added a commit
to wzq-xzwj/agentscope-java
that referenced
this pull request
Jul 30, 2026
…ation (agentscope-ai#2437) The AG-UI adapter only handled suspend-type HITL (ToolSuspendException / frontend tools, GenerateReason.TOOL_SUSPENDED). Permission-type HITL -- where a non-readonly tool under DEFAULT permission mode makes ReActAgent emit RequireUserConfirmEvent + RequestStopEvent(PERMISSION_ASKING) -- was dropped: RequireUserConfirmEvent fell through to the RAW fallback and no Interrupt reached RUN_FINISHED, so the frontend could never confirm/deny. Building on the converter-registry architecture introduced by agentscope-ai#2306: - Add PermissionConfirmEventConverter that maps RequireUserConfirmEvent to one AG-UI Interrupt per pending ToolUseBlock (reason "tool_confirmation"), carrying toolName/toolInput/toolContent/replyId metadata, and register it in AgentEventConverterRegistry. Interrupt id keeps the "replyId:toolCallId" format so resume can recover the tool call id. - AguiResumeCoordinator now tracks "tool_confirmation" interrupts alongside "tool_call" ones and exposes them via a new resume-interrupts runtime key. - AguiAgentAdapter forwards the resume interrupts to the message converter. - AguiMessageConverter builds a ConfirmResult (approved/denied) from the resume payload for confirmation interrupts, reconstructing the ToolUseBlock with non-null JSON content to avoid the tool-input validation NPE on resume; non-confirmation resumes keep the existing ToolResultBlock path. - Add unit tests covering resolved/cancelled/explicit-false confirmations and the non-confirmation fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Close #2202
1.0 stream() → 2.0 streamEvents()
This PR upgrades the AG-UI v2 integration to better align with the official AG-UI protocol and make the adapter easier to extend.
Key Changes
AgentEvent -> AguiEventmapping, allowing users to register customAgentEventConverters that can override built-in mappings.AguiEventEnrichersupport for cross-cutting event decoration such astimestamp,rawEvent, tracing metadata, or custom event rewriting.AguiEventtypes viatimestampandrawEvent.AgentStartEvent/AgentEndEventintoRUN_STARTED/RUN_FINISHEDthrough the normal converter path.CUSTOM token_usageevents with delta and cumulative usage.RunAgentInput.resume[]support for HITL interrupts and bridges tool-call resumes back into AgentScope tool-result recovery.RuntimeContextresolution, and custom adapter factories.