Conversation
- Add CUSTOM type to AguiEventType enum - Implement Custom record in AguiEvent with name and value fields - Update @JsonSubTypes annotation to support Custom event serialization/deserialization - Update sealed interface permits clause to include Custom
- Add CustomTest nested class with comprehensive test coverage - Update testEventTypeCount to expect 13 event types - Add CUSTOM to testAllEventTypesExist test
Summary of ChangesHello @xingmengxian, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the AG-UI protocol by integrating a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively adds support for CUSTOM events to the AG-UI protocol, which is a valuable extension mechanism. The implementation is clean, follows the existing structure of AguiEvent, and includes a comprehensive set of unit tests for the new functionality. I have a few minor suggestions to improve code formatting consistency and to make the new tests even more robust. Overall, this is a solid contribution.
...nsions/agentscope-extensions-agui/src/main/java/io/agentscope/core/agui/event/AguiEvent.java
Outdated
Show resolved
Hide resolved
...ns/agentscope-extensions-agui/src/test/java/io/agentscope/core/agui/event/AguiEventTest.java
Show resolved
Hide resolved
...ns/agentscope-extensions-agui/src/test/java/io/agentscope/core/agui/event/AguiEventTest.java
Show resolved
Hide resolved
- Fix indentation for @JsonSubTypes annotation - Adjust line breaks for Custom record declaration
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
# Conflicts: # agentscope-extensions/agentscope-extensions-agui/src/main/java/io/agentscope/core/agui/event/AguiEvent.java # agentscope-extensions/agentscope-extensions-agui/src/main/java/io/agentscope/core/agui/event/AguiEventType.java # agentscope-extensions/agentscope-extensions-agui/src/test/java/io/agentscope/core/agui/event/AguiEventTest.java
| */ | ||
| record Custom(String threadId, String runId, String name, Object value) implements AguiEvent { |
There was a problem hiding this comment.
How to publish this event?
There was a problem hiding this comment.
Currently, we have certain scenarios where, in addition to the AguiEvent output by AguiAgentAdapter, we need to send an extra card render event to the client for rendering card-based information. This event cannot be effectively carried using a RawEvent.
Moreover, since CustomEvent is already a defined type within the AG-UI protocol, it is theoretically necessary to extend or formalize this capability.
There was a problem hiding this comment.
Currently, this POJO definition is not directly used within AgentScope. Therefore, my question is: how should users utilize it? Does it require directly modifying the implementation of AG-UI in AgentScope?
There was a problem hiding this comment.
Yes, currently there is no place in AgentScope that actually uses the CustomEvent POJO.
I’m not fully leveraging all the AG-UI features provided by AgentScope—for example, the AguiRestController. Although it exposes a complete RunAgentInputPOJO, some parameters (such as RunAgentInput.context) are not actually used or passed through, which prevents the agent from accessing the context content.
Therefore, I only use the AguiRequestProcessor to directly handle the AG-UI event stream and inject my own custom events.
This is the motivation and rationale behind adding the CustomEvent POJO, which is currently unused by AgentScope.

Add Custom Event Support to AguiEvent
Summary
This issue implements support for Custom events in the AG-UI protocol, providing an extension mechanism for implementing features not covered by the standard event types.
Motivation
The AG-UI protocol currently supports various standard event types (RUN_STARTED, TEXT_MESSAGE_START, TOOL_CALL_START, etc.) and a RAW event type for unstructured custom data. However, there is a need for a structured Custom event type that allows passing custom data with a name identifier, following the AG-UI protocol specification.
Implementation Details
Changes Made
Added CUSTOM Event Type
CUSTOMenum value toAguiEventTypeImplemented Custom Event Record
AguiEvent.Customrecord implementingAguiEventinterfacethreadId(String, required): Thread ID associated with the eventrunId(String, required): Run ID associated with the eventname(String, required): Name of the custom eventvalue(Object, optional): Value associated with the event@JsonCreatorand@JsonPropertyannotationsUpdated Sealed Interface
AguiEvent.Customto thepermitsclause of the sealedAguiEventinterface@JsonSubTypesannotation entry for Custom event type mappingTest Coverage
CustomTestnested class:testEventTypeCountto expect 13 event typestestAllEventTypesExisttestProtocol Compliance
The implementation follows the AG-UI protocol specification:
namefield for event identificationvaluefield for event dataExample Usage