Skip to content

feat(a2a): expose fine-grained agent event stream - #2577

Open
mikemikimike wants to merge 4 commits into
agentscope-ai:mainfrom
mikemikimike:issue-2552-stream-events
Open

feat(a2a): expose fine-grained agent event stream#2577
mikemikimike wants to merge 4 commits into
agentscope-ai:mainfrom
mikemikimike:issue-2552-stream-events

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary

  • Add AgentRunner.streamEvents(...) to expose fine-grained AgentEvent streaming for A2A runners.
  • Reuse the existing cached-agent lifecycle for legacy and fine-grained streams, including cleanup on completion and error.
  • Keep the existing stream(...) API for backward compatibility and add regression coverage.

Closes #2552.

Tests

  • mvn -pl agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-a2a/agentscope-extensions-a2a-server -am clean verify
  • mvn -pl agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-a2a/agentscope-extensions-a2a-server -am -Dtest=AgentRunnerTest,AgentScopeAgentExecutorTest -Dsurefire.failIfNoSpecifiedTests=false test
  • git diff --check

@CLAassistant

CLAassistant commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.68817% with 44 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e/a2a/server/executor/AgentScopeAgentExecutor.java 48.83% 35 Missing and 9 partials ⚠️

📢 Thoughts on this report? Let us know!

@zcw888

zcw888 commented Aug 7, 2026

Copy link
Copy Markdown

PR #2577 added the AgentRunner.streamEvents() capability (fine-grained Flux<AgentEvent>) and implemented it in BaseReActAgentRunner, but the fix looks incomplete: the actual A2A server call chain still uses the legacy coarse-grained stream.

In AgentScopeAgentExecutor.execute() (agentscope-extensions-a2a-server), line 101 still calls agentRunner.stream(...) returning Flux<Event>, and the whole handler chain (BaseFluxEventHandler, BlockingFluxEventHandler, StreamingFluxEventHandler) consumes Event. AgentRunner.streamEvents() is only exercised by AgentRunnerTest and is never consumed by any executor, so A2A clients still cannot receive fine-grained AgentEvents — this is exactly what #2552 asks for.

To fully close this issue, AgentScopeAgentExecutor (and its FluxEventHandler implementations / tests) should be switched to consume streamEvents() / AgentEvent, ideally with a backward-compatible adapter so the existing Event consumers keep working. Could a follow-up PR cover the executor-side wiring?

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

This PR modifies 3 files with 254 lines of diff.

Observations

  • Files changed: 3
  • Test coverage: ✅ Tests included
  • CLA: ✅ Signed

Suggestions

  • Please ensure all public API changes are backward compatible
  • Consider adding unit tests for new logic paths

Automated review by github-manager-bot

@mikemikimike

Copy link
Copy Markdown
Author

Addressed the executor-side wiring noted in the review comment:

  • AgentScopeAgentExecutor now prefers streamEvents() and routes fine-grained AgentEvent values through the blocking and streaming handlers.
  • Legacy custom runners remain supported through an adapter/fallback to stream().
  • Added regression coverage for fine-grained execution and legacy fallback.

Validation at 489f67d:

  • mvn -pl agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-a2a/agentscope-extensions-a2a-server -am clean verify ✅ (core: 2,257 tests; A2A client: 109; A2A server: 138; 8 existing core skips)
  • git diff --check

The previous required Ubuntu run failed in the unrelated agentscope-harness module; the focused A2A reactor passed locally.

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/ext/integration External protocols & middleware integrations labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ext/integration External protocols & middleware integrations enhancement New feature or request

Projects

None yet

5 participants