You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Service Discovery and Governance for A2A Java Implementations #683
The Agent2Agent (A2A) Protocol is an open standard designed to enable communication and interoperability between AI agents across diverse platforms. The a2aproject/a2a-java SDK provides a Java implementation for building A2A-compliant agentic applications.
In the current A2A specification, Agent Card (located at /.well-known/agent.json) serves as the primary mechanism for agents to declare their capabilities, API endpoints, skills, and authentication methods. This acts as a form of service discovery.
Problem Statement
While the A2A protocol defines the Agent Card as a standardized way for agents to describe themselves, there are several challenges related to service discovery and governance in the context of a2a-java implementations:
1. Lack of Centralized Service Registry
Currently, Agent Cards are typically hosted by individual agents at the well-known endpoint. In a microservices-style architecture with numerous agent instances, this distributed approach raises concerns:
How can agent consumers efficiently discover all available agents?
How to handle dynamic scaling (spin-up/shutdown) of agent instances?
How to maintain a unified view of the agent ecosystem?
2. Health Monitoring and Availability
Service discovery systems typically include health monitoring capabilities. Questions to consider:
Should A2A agents implement heartbeat mechanisms?
How to detect and handle failed or unresponsive agent instances?
Should the a2a-java SDK provide built-in health check utilities?
3. Load Balancing and Failover
When multiple instances of the same agent type exist:
How should consumers select among instances?
Should client-side or server-side load balancing be recommended?
Can a2a-java provide abstractions for load balancing strategies?
4. Integration with Existing Service Discovery Solutions
Many enterprises already use service discovery tools such as:
Polarismesh
Netflix Eureka
Consul
Nacos
ZooKeeper
Kubernetes Service Discovery
Should a2a-java provide integrations with these platforms? For example:
Auto-registration of A2A agents with Eureka/Nacos
Discovery client implementations for fetching agent endpoints from existing registries
Mapping Agent Card metadata to service registration metadata
Potential Solutions / Discussion Points
Enhanced Agent Card Discovery:
Support for Agent Card federation or aggregation endpoints
Agent Card caching and refresh strategies
Optional Service Registry Support:
Provide interfaces or modules for integration with popular service registries
Consider a ServiceDiscoveryProvider abstraction in a2a-java
Health Monitoring Extensions:
Standardize health check endpoints for A2A agents
Support heartbeat configuration in the SDK
Client-Side Load Balancing:
Implement round-robin or weighted load balancing in the A2A client
Support retry and fallback mechanisms
Governance Features:
Version management for agent capabilities
Access control and authentication policies across agent instances
Questions for the Community
What are the current best practices for discovering multiple A2A agent instances in production?
Is there a need for a centralized agent registry in the A2A ecosystem?
Are there existing integrations or examples of using a2a-java with service discovery platforms?
Should the A2A protocol specification be extended to address service discovery more comprehensively?
Proposed Next Steps
Discuss and gather requirements for service discovery in A2A environments
Evaluate potential integration points with existing Java service discovery frameworks
Consider adding service discovery utilities or extensions to the a2a-java SDK
We have been actively exploring the service discovery and governance challenges highlighted in this RFC and wanted to share our architectural findings and a working open-source implementation.
To address the gaps mentioned in this issue, we developed A2A-Hub, a standalone Discovery Registry & Orchestration Hub designed specifically around the A2A protocol. Here is how we approached each problem area:
1. Centralized Registry & Dynamic Discovery
While the /.well-known/agent.json (Agent Card) is great for decentralized self-description, discovering dynamic clusters requires active cataloging. In A2A-Hub:
Agents can self-register or be discovered via endpoint polling.
In addition to standard tag/skill filtering, we implemented HNSW semantic search (pgvector) over Agent Card capabilities, allowing orchestrators to match task descriptions in natural language to the most appropriate agent instance.
2. Health Monitoring & Availability
Relying solely on client retry logic leads to cascading failures. We implemented:
Configurable background health probes with a state machine (HEALTHY, DEGRADED, OFFLINE).
Circuit breaker / isolation for failing agents so discovery consumers only receive live, responsive instances.
3. Security & Governance (Lessons Learned)
When building discovery for arbitrary external agents, critical security boundaries emerged:
Strict Anti-SSRF (CWE-918): Discovery registries fetching Agent Cards must validate DNS resolution and ban private/loopback/cloud metadata ranges (169.254.169.254).
Constant-time Auth Validation (CWE-208): Safeguarding API keys and inter-agent tokens against timing attacks.
4. Integration with a2a-java SDK
Regarding the question of whether a2a-java should support service discovery abstractions:
We believe introducing a lightweight ServiceDiscoveryProvider / AgentRegistryClient SPI in the client or extras module of a2a-java would be a great addition.
This would allow the core A2A client to dynamically resolve base URLs from registries (whether A2A-Hub, Consul, Eureka, or Kubernetes DNS) before initiating JSON-RPC, REST, or gRPC handshakes.
If the maintainers are open to exploring a ServiceDiscoveryProvider SPI for a2a-java, we would be glad to collaborate and contribute an initial draft PR following the project standards.
Activity
oscarbol09 commentedon Oct 1, 2026
Hi @SkyeBeFreeman and community,
We have been actively exploring the service discovery and governance challenges highlighted in this RFC and wanted to share our architectural findings and a working open-source implementation.
To address the gaps mentioned in this issue, we developed A2A-Hub, a standalone Discovery Registry & Orchestration Hub designed specifically around the A2A protocol. Here is how we approached each problem area:
1. Centralized Registry & Dynamic Discovery
While the
/.well-known/agent.json(Agent Card) is great for decentralized self-description, discovering dynamic clusters requires active cataloging. In A2A-Hub:2. Health Monitoring & Availability
Relying solely on client retry logic leads to cascading failures. We implemented:
HEALTHY,DEGRADED,OFFLINE).3. Security & Governance (Lessons Learned)
When building discovery for arbitrary external agents, critical security boundaries emerged:
169.254.169.254).4. Integration with
a2a-javaSDKRegarding the question of whether
a2a-javashould support service discovery abstractions:ServiceDiscoveryProvider/AgentRegistryClientSPI in theclientorextrasmodule ofa2a-javawould be a great addition.If the maintainers are open to exploring a
ServiceDiscoveryProviderSPI fora2a-java, we would be glad to collaborate and contribute an initial draft PR following the project standards.