feat(a2a): integrate Agent2Agent (A2A) protocol for enhanced agent in…#211
feat(a2a): integrate Agent2Agent (A2A) protocol for enhanced agent in…#211
Conversation
…teroperability - Introduced full support for the A2A protocol, enabling seamless communication between AI agents built on various frameworks (LangGraph, CrewAI, Pydantic AI, etc.). - Implemented A2A transport via HTTP at the `/a2a` endpoint, consolidating agent communication under a unified transport layer. - Added comprehensive documentation and examples to facilitate user adoption and understanding of A2A capabilities. - Enhanced agent registry and task management to support A2A-specific functionalities, including agent card discovery and task lifecycle management. - Updated network configuration templates to include A2A support across various demo setups.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive support for the A2A (Agent2Agent) protocol v0.3, enabling seamless communication between AI agents built on various frameworks. Key changes include:
- Full A2A protocol implementation with HTTP/JSON-RPC transport at
/a2aendpoint - Agent registry for managing remote A2A agents with health checks and card refresh
- Task lifecycle management with in-memory store
- Cross-protocol communication between gRPC, WebSocket, HTTP, and A2A agents
- Comprehensive test coverage across all A2A components
- Configuration templates updated for all demo networks
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 34 comments.
Show a summary per file
| File | Description |
|---|---|
tests/a2a/test_remote_agent_registry.py |
Tests for A2A agent registry including announcement, withdrawal, health checks, and card refresh |
tests/a2a/test_cross_protocol_communication.py |
Integration tests verifying communication between gRPC and A2A agents |
tests/a2a/test_a2a_transport.py |
Tests for A2A transport including JSON-RPC endpoints, authentication, and task management |
tests/a2a/test_a2a_task_store.py |
Tests for task store implementation with LRU eviction and callbacks |
tests/a2a/test_a2a_models.py |
Tests for A2A protocol data models (tasks, messages, agent cards) |
tests/a2a/test_a2a_converters.py |
Tests for event/message conversion utilities |
tests/a2a/test_a2a_connector.py |
Tests for A2A network connector for external A2A servers |
src/openagents/utils/a2a_converters.py |
Converters between OpenAgents events and A2A messages/tasks |
src/openagents/models/a2a.py |
Pydantic models for A2A protocol (tasks, messages, agent cards, JSON-RPC) |
src/openagents/models/transport.py |
Transport model updates with A2A support and remote agent status |
src/openagents/core/transports/http.py |
HTTP transport extended with A2A protocol at /a2a endpoint |
src/openagents/core/transports/a2a.py |
Standalone A2A transport implementation |
src/openagents/core/topology.py |
Topology integration with A2A registry and agent management |
src/openagents/core/connectors/a2a_connector.py |
Connector for OpenAgents agents to communicate with external A2A servers |
src/openagents/core/a2a_task_store.py |
Task store abstraction with in-memory implementation |
| Network YAML templates | Updated configurations with A2A transport enabled |
examples/cross_protocol_agents_example.py |
Example demonstrating gRPC-A2A cross-protocol communication |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| topology.agent_registry["grpc-translator"] = grpc_connection | ||
|
|
||
| # Announce A2A agent via registry | ||
| a2a_connection = await a2a_registry.announce_agent( |
There was a problem hiding this comment.
Variable a2a_connection is not used.
| a2a_connection = await a2a_registry.announce_agent( | |
| await a2a_registry.announce_agent( |
| - events/send - Send an event through the network | ||
| """ | ||
|
|
||
| import asyncio |
There was a problem hiding this comment.
Import of 'asyncio' is not used.
| import asyncio |
| from aiohttp import web | ||
|
|
||
| from .base import Transport | ||
| from openagents.models.transport import TransportType, AgentConnection, RemoteAgentStatus |
There was a problem hiding this comment.
Import of 'AgentConnection' is not used.
Import of 'RemoteAgentStatus' is not used.
| from openagents.models.transport import TransportType, AgentConnection, RemoteAgentStatus | |
| from openagents.models.transport import TransportType |
| from openagents.models.a2a import ( | ||
| AgentCard, | ||
| AgentSkill, | ||
| AgentCapabilities, | ||
| AgentProvider, | ||
| Task, | ||
| TaskState, | ||
| TaskStatus, | ||
| A2AMessage, | ||
| Artifact, | ||
| TextPart, | ||
| DataPart, | ||
| Role, | ||
| JSONRPCRequest, | ||
| JSONRPCResponse, | ||
| JSONRPCError, | ||
| A2AErrorCode, | ||
| parse_parts, | ||
| create_text_message, | ||
| ) |
There was a problem hiding this comment.
Import of 'Task' is not used.
Import of 'DataPart' is not used.
Import of 'JSONRPCResponse' is not used.
Import of 'JSONRPCError' is not used.
| TaskStatus, | ||
| A2AMessage, | ||
| Artifact, | ||
| TextPart, | ||
| DataPart, | ||
| Role, | ||
| Part, | ||
| PushNotificationConfig, | ||
| parse_parts, |
There was a problem hiding this comment.
Import of 'DataPart' is not used.
Import of 'TaskStatus' is not used.
Import of 'Artifact' is not used.
Import of 'TextPart' is not used.
Import of 'Role' is not used.
Import of 'Part' is not used.
Import of 'parse_parts' is not used.
| TaskStatus, | |
| A2AMessage, | |
| Artifact, | |
| TextPart, | |
| DataPart, | |
| Role, | |
| Part, | |
| PushNotificationConfig, | |
| parse_parts, | |
| A2AMessage, | |
| PushNotificationConfig, |
| } | ||
| ) | ||
|
|
||
| network = AgentNetwork(config) |
There was a problem hiding this comment.
Call to AgentNetwork.init with too few arguments; should be no fewer than 2.
| network = AgentNetwork(config) | |
| network = AgentNetwork(config, asyncio.get_running_loop()) |
| polling_task.cancel() | ||
| try: | ||
| await polling_task | ||
| except asyncio.CancelledError: |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
| except asyncio.CancelledError: | |
| except asyncio.CancelledError: | |
| # Expected when we cancel the polling task during disconnect; safe to ignore. |
| try: | ||
| await polling_task | ||
| except asyncio.CancelledError: | ||
| pass |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
| pass | |
| # Suppress cancellation error: this is expected when stopping background polling. | |
| return |
| self._card_refresh_task.cancel() | ||
| try: | ||
| await self._card_refresh_task | ||
| except asyncio.CancelledError: |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
| self._health_check_task.cancel() | ||
| try: | ||
| await self._health_check_task | ||
| except asyncio.CancelledError: |
There was a problem hiding this comment.
'except' clause does nothing but pass and there is no explanatory comment.
- Introduced a new job in the pytest workflow to run tests for the Agent2Agent (A2A) protocol. - Configured environment variables for the A2A tests to ensure proper execution and compatibility.
- Updated the GitHub Actions workflow to include pytest-aiohttp in the dependencies, enhancing the testing capabilities for asynchronous HTTP requests.
…teroperability
/a2aendpoint, consolidating agent communication under a unified transport layer.