feat(a2a): implement SSE streaming endpoint for real-time plan execution events #10031

Open
opened 2026-04-16 13:37:34 +00:00 by HAL9000 · 0 comments
Owner

Background: The A2A protocol integration requires a Server-Sent Events (SSE) streaming endpoint so that clients can receive real-time plan execution events (status updates, artifact updates, errors) without polling. Without this endpoint, the event queue publish/subscribe system has no transport layer to deliver events to external consumers, leaving the A2A facade's real-time capabilities incomplete for v3.5.0.

Acceptance criteria:

  • An SSE streaming endpoint is implemented and registered in the A2A facade/router that clients can connect to for real-time plan execution events
  • The endpoint subscribes to A2aEventQueue on connection and streams A2aEvent objects as SSE-formatted data: lines to the connected client
  • The endpoint correctly handles client disconnection by unsubscribing from the event queue and cleaning up resources
  • Events are serialized to JSON and streamed with correct Content-Type: text/event-stream headers and data: prefix per SSE spec
  • The endpoint supports filtering by plan_id so clients can subscribe to events for a specific plan
  • BDD scenarios cover: successful streaming of events, client disconnect cleanup, plan_id filtering, and empty-queue keep-alive

Metadata

  • Commit Message: feat(a2a): implement SSE streaming endpoint for real-time plan execution events
  • Branch: feat/a2a-sse-streaming-endpoint

Subtasks

  • Design and implement the SSE streaming endpoint handler in the A2A layer
  • Wire the SSE endpoint into the A2A facade router/dispatcher
  • Implement A2aEventQueue subscription lifecycle within the SSE handler (subscribe on connect, unsubscribe on disconnect)
  • Implement JSON serialization of A2aEvent to SSE data: format with correct headers
  • Implement optional plan_id query parameter filtering
  • Implement keep-alive heartbeat (e.g., : ping comment every 15s) to prevent connection timeouts
  • Tests (Behave): Add BDD scenario for successful event streaming to connected client
  • Tests (Behave): Add BDD scenario for client disconnect triggering unsubscribe and cleanup
  • Tests (Behave): Add BDD scenario for plan_id filtering (only matching events streamed)
  • Tests (Behave): Add BDD scenario for keep-alive heartbeat when no events are published
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • All acceptance criteria met
  • Tests written and passing (coverage ≥ 97%)
  • Code reviewed and approved
  • Documentation updated
  • No regressions introduced

Parent Epic

Child of and blocks #8423 — A2A Protocol Integration (v3.5.0)


Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor
Worker: [AUTO-EPIC-3]

**Background**: The A2A protocol integration requires a Server-Sent Events (SSE) streaming endpoint so that clients can receive real-time plan execution events (status updates, artifact updates, errors) without polling. Without this endpoint, the event queue publish/subscribe system has no transport layer to deliver events to external consumers, leaving the A2A facade's real-time capabilities incomplete for v3.5.0. **Acceptance criteria**: - [ ] An SSE streaming endpoint is implemented and registered in the A2A facade/router that clients can connect to for real-time plan execution events - [ ] The endpoint subscribes to `A2aEventQueue` on connection and streams `A2aEvent` objects as SSE-formatted `data:` lines to the connected client - [ ] The endpoint correctly handles client disconnection by unsubscribing from the event queue and cleaning up resources - [ ] Events are serialized to JSON and streamed with correct `Content-Type: text/event-stream` headers and `data:` prefix per SSE spec - [ ] The endpoint supports filtering by `plan_id` so clients can subscribe to events for a specific plan - [ ] BDD scenarios cover: successful streaming of events, client disconnect cleanup, plan_id filtering, and empty-queue keep-alive ## Metadata - **Commit Message**: `feat(a2a): implement SSE streaming endpoint for real-time plan execution events` - **Branch**: `feat/a2a-sse-streaming-endpoint` ## Subtasks - [ ] Design and implement the SSE streaming endpoint handler in the A2A layer - [ ] Wire the SSE endpoint into the A2A facade router/dispatcher - [ ] Implement `A2aEventQueue` subscription lifecycle within the SSE handler (subscribe on connect, unsubscribe on disconnect) - [ ] Implement JSON serialization of `A2aEvent` to SSE `data:` format with correct headers - [ ] Implement optional `plan_id` query parameter filtering - [ ] Implement keep-alive heartbeat (e.g., `: ping` comment every 15s) to prevent connection timeouts - [ ] Tests (Behave): Add BDD scenario for successful event streaming to connected client - [ ] Tests (Behave): Add BDD scenario for client disconnect triggering unsubscribe and cleanup - [ ] Tests (Behave): Add BDD scenario for plan_id filtering (only matching events streamed) - [ ] Tests (Behave): Add BDD scenario for keep-alive heartbeat when no events are published - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] All acceptance criteria met - [ ] Tests written and passing (coverage ≥ 97%) - [ ] Code reviewed and approved - [ ] Documentation updated - [ ] No regressions introduced ## Parent Epic Child of and blocks #8423 — A2A Protocol Integration (v3.5.0) --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planning-pool-supervisor Worker: [AUTO-EPIC-3]
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10031
No description provided.