feat(core): add EventStreamingAgent so AG-UI can adapt custom agents - #3098
Open
dragondyt wants to merge 1 commit into
Open
feat(core): add EventStreamingAgent so AG-UI can adapt custom agents#3098dragondyt wants to merge 1 commit into
dragondyt wants to merge 1 commit into
Conversation
Extract the v2 streamEvents contract from concrete ReActAgent and HarnessAgent types so protocol adapters no longer hard-code those classes.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
Collaborator
There was a problem hiding this comment.
Summary
Extracts the v2 streaming contract into a new EventStreamingAgent SPI, implements it on ReActAgent/HarnessAgent, and drops the ReActAgent cast plus the reflective HarnessAgent call from AguiAgentAdapter. Nice de-escalation of a hard-coded type check into a proper capability interface, with tests for the ReAct / Harness / custom-agent paths and the v1 fallback.
Verdict
Approachable with one compatibility question answered (see inline): agents that used to reach the v2 path by class name alone now fall back to 1.x silently.
Automated review by github-manager-bot
5 tasks
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.
AgentScope-Java Version
2.0.3-SNAPSHOTDescription
Closes #1894
Related #2102 #2105 #2552
Background
AguiAgentAdapterused to hard-codeReActAgentandHarnessAgentto reach the v2streamEventspath. Those types are not suitable as a shared base class, so custom agents (including graph-based and A2A agents) could only fall back to the 1.xstream()conversion and lost fine-grained AG-UI events.Purpose
Extract the v2 streaming contract into an optional
EventStreamingAgentinterface so protocol adapters can adapt any implementing agent without knowing the concrete type.Changes
EventStreamingAgentwithstreamEvents(List<Msg>, RuntimeContext)and default overloads.ReActAgentandHarnessAgent.AguiAgentAdapterthroughinstanceof EventStreamingAgentand remove theReActAgent/ Harness reflection hard-coding. GenericAgentimplementations still use the 1.xstream()fallback.StreamableAgentdocumentation atEventStreamingAgent.How to test / Test plan
All items below were executed locally and passed:
EventStreamingAgentTestHarnessAgentEventStreamingContractTestAguiAgentAdapterV2Test(ReAct / Harness / customEventStreamingAgentpath)AguiAgentAdapterTest(v1stream()fallback)StreamableAgentTestAguiUtilTestmvn spotless:applyon the affected modules (agentscope-core,agentscope-harness,agentscope-extensions-agui)Full-repo
mvn testis left to CI.Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test) — affected tests listed above; full suite in CIAgent/StreamableAgentJavadoc