JSON Specification
Detailed JSON schema specification for the A2A protocol
A2A Protocol JSON Specification
The A2A protocol is defined through a set of JSON schemas that specify the structure of agent cards, messages, sessions, and artifacts. This document provides the complete JSON specification for implementing A2A-compatible agents and clients.
Agent Card Schema
The agent card is a JSON document that describes an agent's capabilities, endpoints, and metadata. Here's the full schema:
Session Schema
Sessions represent ongoing conversations between clients and agents. Here's the schema for session objects:
Message Schema
Messages are the units of communication in the A2A protocol. Here's the schema for message objects:
API Request/Response Schemas
Create Session Request
Create Session Response
Send Message Request
Send Message Response
Get Session Messages Response
Error Response
Schema Extensions
The A2A protocol allows for schema extensions through custom properties and the metadata
fields. Extensions should follow these guidelines:
- Custom properties should use a namespace prefix to avoid conflicts
- Core schema properties should never be overridden
- Extensions should be documented in the agent card
Example of a custom extension for a financial capability:
Multimodal Content
The A2A protocol supports multimodal content through artifacts. Artifacts can represent various types of content:
Text Artifact
JSON Data Artifact
Image Artifact (Base64 encoded)
URL Reference Artifact
API Endpoints
The A2A protocol defines these standardized RESTful endpoints:
Agent Card Endpoint
Sessions Endpoints
Messages Endpoints
Streaming Endpoint (Optional)
Implementation Guidance
When implementing the A2A protocol:
- Validate All JSON: Always validate incoming and outgoing JSON against the schema
- Handle Unknown Properties: Be tolerant of unknown properties to support future extensions
- Follow HTTP Standards: Use appropriate HTTP methods and status codes
- Include Content-Type Headers: Always specify
Content-Type: application/json
- Timestamp Format: Use ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) for all timestamps
- Unique IDs: Generate globally unique IDs for sessions, messages, and artifacts
- Error Handling: Return structured error responses with appropriate HTTP status codes
Versioning
The A2A protocol uses semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR version changes indicate breaking changes
- MINOR version changes add functionality in a backwards-compatible manner
- PATCH version changes make backwards-compatible bug fixes
Agents should specify their supported protocol version in their agent card.
Reference Validation Tools
The A2A repository includes validation tools for the JSON schema:
- JavaScript validation library
- Command-line validator
- Online validation tool
These tools help ensure compliance with the A2A protocol specification.
Conclusion
This document provides the complete JSON specification for the A2A protocol. By adhering to these schemas, developers can create interoperable agents that can communicate with any A2A-compatible client or agent.