Repository navigation
feat(a2a): add streamEvents to A2aAgent - #3674
Merged
jujn merged 1 commit intoOct 20, 2026
Merged
Conversation
A2aAgent had no streamEvents; streaming a remote agent was only possible through the deprecated stream() or hooks. streamEvents streams AgentStartEvent, the text and thinking the remote agent streams as TextBlockDeltaEvent and ThinkingBlockDeltaEvent, AgentResultEvent and AgentEndEvent, like ReActAgent. call() returns the result of the same stream, so both always agree. Tool calls and tool results are only in the result message, since the remote agent sends them in chunks without start or end. Hooks and the deprecated stream() work as before.
jujn
approved these changes
Oct 20, 2026
This was referenced Oct 21, 2026
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.1.0-SNAPSHOT (main)
Description
Fixes #2105
A2A client 去掉弃用 API 的第二步(第一步是 #3663):给
A2aAgent加streamEvents()。之前流式拿远端 Agent 的输出,只能用已弃用的stream()或 Hook。改动
A2aAgent.streamEvents(Msg)/(List<Msg>)/(List<Msg>, RuntimeContext),返回Flux<AgentEvent>,事件和ReActAgent一致:AgentStartEventTextBlockDeltaEvent、ThinkingBlockDeltaEventAgentResultEvent:和call()返回的是同一条消息AgentEndEvent;调用失败时以原错误结束。call()照ReActAgent的写法覆盖callInternal,从同一条事件流里取AgentResultEvent,保证两者结果一致。stream()行为不变。streamEvents的用法。测试
A2aAgentTest:事件顺序、文本和思考的增量、replyId一致、AgentResultEvent与call()结果一致;带RuntimeContext时AgentStartEvent带上会话 id;调用失败时以原错误结束且关闭 client。用空实现的骨架确认先失败。A2aHttpEndToEndTest(真实 HTTP,连 Starter 服务端):远端流式返回思考和文本,streamEvents逐段收到增量,结果与call()一致。mvn -B -T1C clean verify99 个模块全部通过(11,047 个测试,0 失败,200 跳过);之后只补了一条RuntimeContext的测试,client 模块verify通过。补丁覆盖率:行 54/56,分支 11/14。Checklist
mvn spotless:applymvn -B -T1C clean verify)