A Java implementation of the Agent-to-Agent (A2A) protocol server SDK, built with Spring Boot and Spring AI. This SDK provides a complete framework for building A2A-compliant agents and services.
The A2A Server SDK is a comprehensive Java library that implements the A2A protocol server-side functionality. It provides all the necessary components to build agents that can communicate with other A2A-compatible systems. The included translation bot is a demonstration of how to use the SDK to build intelligent agents.
- JSON-RPC 2.0 support for all A2A operations
- Agent Card publishing at
/.well-known/agent-card.json - Task Management - send, query, cancel operations
- Streaming Support - real-time task updates via Server-Sent Events
- Error Handling - comprehensive error management with proper codes
- Auto-configuration for easy setup
- RESTful API endpoints with proper HTTP status codes
- Built-in validation and serialization
- Health checks and metrics endpoints
- Spring AI integration for AI model connectivity
- ChatClient abstraction for easy AI service integration
- Support for OpenAI, Azure OpenAI, and other providers
- Configurable model parameters and prompts
A2AServer- Main server class managing agent behaviorA2AController- REST controller implementing A2A endpointsTaskHandler- Interface for implementing custom agent logicA2AServerConfiguration- Configuration class for agent setup
GET /.well-known/agent-card.json
Accept: application/jsonReturns the agent's capabilities and metadata.
POST /a2a
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": "request-1",
"method": "message/send",
"params": {
"id": "task-1",
"message": {
"messageId": "msg-1",
"kind": "message",
"role": "user",
"parts": [
{
"kind": "text",
"text": "Hello, agent!"
}
]
}
}
}POST /a2a/stream
Content-Type: application/json
Accept: text/event-stream