Interface A2AMessage
- All Known Implementing Classes:
A2AErrorResponse,A2ARequest,A2AResponse,CancelTaskRequest,CancelTaskResponse,CreateTaskPushNotificationConfigRequest,CreateTaskPushNotificationConfigResponse,DeleteTaskPushNotificationConfigRequest,DeleteTaskPushNotificationConfigResponse,GetExtendedAgentCardRequest,GetExtendedAgentCardResponse,GetTaskPushNotificationConfigRequest,GetTaskPushNotificationConfigResponse,GetTaskRequest,GetTaskResponse,ListTaskPushNotificationConfigsRequest,ListTaskPushNotificationConfigsResponse,ListTasksRequest,ListTasksResponse,NonStreamingJSONRPCRequest,SendMessageRequest,SendMessageResponse,SendStreamingMessageRequest,SendStreamingMessageResponse,StreamingJSONRPCRequest,SubscribeToTaskRequest
Base interface for all JSON-RPC 2.0 protocol messages in the A2A Protocol.
This sealed interface defines the fundamental structure shared by all JSON-RPC 2.0
messages used in the A2A Protocol's JSON-RPC transport layer. It ensures type safety
and exhaustiveness checking by permitting only A2ARequest and A2AResponse
as implementing types.
According to the JSON-RPC 2.0 specification, all messages must include a jsonrpc
version field set to "2.0", and may optionally include an id field for correlation
between requests and responses.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe JSON-RPC protocol version string as defined by the JSON-RPC 2.0 specification. -
Method Summary
Modifier and TypeMethodDescriptiongetId()Gets the request/response correlation identifier.Gets the JSON-RPC version for this message.
-
Field Details
-
JSONRPC_VERSION
The JSON-RPC protocol version string as defined by the JSON-RPC 2.0 specification. All messages must have theirjsonrpcfield set to this value.- See Also:
-
-
Method Details
-
getJsonrpc
String getJsonrpc()Gets the JSON-RPC version for this message.According to the JSON-RPC 2.0 specification, this must be exactly "2.0".
- Returns:
- the JSON-RPC version string, always "2.0"
-
getId
Object getId()Gets the request/response correlation identifier.The ID is used to match responses with their corresponding requests. It may be a String, Integer, or null for notification-style requests that do not expect a response.
- Returns:
- the correlation ID, or null for notifications
-