Overview
The Agent-to-Agent Protocol (A2A) is a standardized protocol developed by Google to enable structured communication between independent AI agents. Using JSON-RPC 2.0 over HTTP/HTTPS, A2A facilitates interoperability between different agent systems, allowing them to work together efficiently.Official Protocol: A2A is maintained by Google and is available at google.github.io/A2A.
The source code can be found in the GitHub repository.
Key Features
JSON-RPC 2.0
Protocol based on JSON-RPC 2.0 for structured and standardized communication
Multi-turn
Native support for multi-turn conversations using contextId
File Upload
File transfer via Base64 with support for different MIME types
Streaming
Asynchronous communication via Server-Sent Events (SSE) for real-time responses
Quick Overview
Key Point | Summary |
---|---|
Objective | Standardize conversation between AI agents (regardless of vendor) using JSON-RPC 2.0 |
Base format | Each call is a JSON object with jsonrpc:"2.0" , id , method and params |
Main methods | message/send • message/stream • tasks/get • tasks/cancel • tasks/pushNotificationConfig/{set|get} • tasks/resubscribe • agent/authenticatedExtendedCard |
Required IDs | messageId (UUID v4) within each message and id /taskId /callId to track request and task |
First-class features | Multi-turn conversations (contextId ) • File upload (parts[] type file with Base64 + MIME) • Push notifications via pushNotificationConfig • Authentication via x-api-key or Authorization: Bearer |
Task lifecycle | submitted → working → completed / failed / canceled , reported in result.status.state |
Protocol Methods
message/send (Synchronous HTTP)
The main method for sending messages synchronously.Request Structure
Request Structure
Typical Response
Typical Response
message/stream (Asynchronous SSE)
For real-time communication with streaming responses.Initial Request
Initial Request
SSE Events
SSE Events
Implementation Examples
cURL
JavaScript / Fetch
Python
File Upload
The A2A protocol supports file upload through thefile
type in parts
:
Base64 Format: Files must be encoded in Base64 without the
data:mime/type;base64,
header.
Only the pure Base64 content should be included in the bytes
field.Multi-turn Conversations
To maintain context between multiple messages, use thecontextId
:
First message
First message
Subsequent message
Subsequent message
Task States
The A2A protocol defines specific states for the task lifecycle:State | Description |
---|---|
submitted | Task has been received and is in the queue |
working | Task is being processed |
completed | Task completed successfully |
failed | Task failed during processing |
canceled | Task was canceled by the user |
Authentication
The protocol supports different authentication methods:- API Key
- Bearer Token
Tips and Best Practices
Unique IDs
Unique IDs
- Use UUID v4 for all required IDs (
messageId
,id
, etc.) - Maintain consistency in IDs for proper tracking
Multi-turn
Multi-turn
- Always save the returned
contextId
for continuous conversations - Send the
contextId
in all subsequent messages of the same conversation
Files
Files
- Use Base64 without header in the
bytes
field - Always specify the correct
mimeType
- Consider the maximum size supported by the server
Streaming
Streaming
- Handle ping events (
: ping
) appropriately - Close the
EventSource
connection whenfinal: true
- Implement reconnection handling for robustness
CORS
CORS
- Configure CORS on the server (
Access-Control-Allow-Origin: *
) for browser testing - Use appropriate headers for production
Additional Resources
Official Specification
Complete A2A protocol documentation maintained by Google
GitHub Repository
Source code, examples and issues for the A2A project
Quick Start Guide
Set up your first agent in less than 2 minutes
Agent Types
Explore different types of agents compatible with A2A
With the A2A protocol, you can quickly integrate any agent or front-end application into the Evo AI ecosystem, ensuring interoperability and standardized communication between different AI agent systems.