Skip to content

[Enhancement][A2A] Agent-to-Agent Gateway: REST API, SSE streaming, Task lifecycle, Java SDK #5259

Description

@qqeasonchen

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

Motivation

Apache EventMesh is evolving toward an Agent messaging bus. The A2A (Agent-to-Agent) protocol needs a runtime gateway that enables agents to discover each other, send tasks, and receive streaming responses — all through standard HTTP/SSE without requiring every agent to implement the EventMesh messaging protocol directly.

Current State

EventMesh already has basic A2A protocol plugin support (eventmesh-protocol-a2a) with AgentCard discovery and EnhancedA2AProtocolAdaptor. However, there is no:

  • REST API gateway for external HTTP clients
  • SSE (Server-Sent Events) streaming for real-time task status
  • Task lifecycle management (create -> running -> completed/failed/cancelled)
  • Typed Java SDK for agent developers
  • Health check / task list / pagination endpoints

Describe the solution you'd like

Proposal

A2A Gateway Runtime (eventmesh-runtime)

Component Description
A2AGatewayServer Standalone HTTP server entry point
A2AGatewayService Core gateway logic: task timeout, agent validation, cancel notification, concurrent-safe subscribers
A2AGatewayHttpHandler Netty-based REST handler: CORS, SSE streaming, health check, pagination, precise error codes
TaskRegistry In-memory task lifecycle with TTL cleanup, CopyOnWriteArrayList for concurrency
InMemoryA2AMessageTransport Default transport implementation

A2A Protocol Plugin (eventmesh-protocol-a2a)

Component Description
A2AClient Typed Java SDK: sync/async task send, SSE streaming (streamTaskStatus), agent discovery, heartbeat
A2AMessageTransport Transport abstraction interface
A2ATopicFactory A2A topic convention standardization

REST API Endpoints

Method Path Description
POST /a2a/tasks?mode=sync|async Submit task
GET /a2a/tasks/{taskId} Query task status
GET /a2a/tasks/{taskId}/stream SSE streaming status
GET /a2a/tasks List tasks (paginated)
POST /a2a/tasks/{taskId}/cancel Cancel task
GET /a2a/agents List registered agents
GET /a2a/agents/{agentName}/card Get AgentCard
GET /a2a/health Health check

Key Engineering Decisions

  • Task timeout: auto-fail non-terminal tasks after configurable threshold
  • SSE: heartbeat mechanism + socketTimeout(0) for long-lived connections
  • Concurrency: CopyOnWriteArrayList + ConcurrentHashMap throughout
  • CORS: Access-Control-Allow-Origin on all A2A endpoints
  • Agent validation: reject tasks for unregistered agents

Tests (all passing)

  • A2AGatewayServiceTest: 15+ tests (timeout, agent validation, cancel, SSE, pagination)
  • TaskRegistryTest: TTL, concurrent child creation, lifecycle transitions
  • A2AClientServerIntegrationTest: full client-server integration (SSE, CORS, health, heartbeat)
  • A2AGatewayEndToEndTest: end-to-end pipeline verification
  • A2ATopicFactoryTest, InMemoryA2AMessageTransportTest

Documentation

7 docs updated: eventmesh-a2a-design.md, ARCHITECTURE.md, IMPLEMENTATION_SUMMARY.md (EN/CN), TEST_RESULTS.md, README.md (EN/CN)


This issue tracks the A2A Gateway feature PR to upstream apache/eventmesh.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions