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

public sealed interface A2AMessage permits A2ARequest<T>, A2AResponse<T>
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.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The JSON-RPC protocol version string as defined by the JSON-RPC 2.0 specification.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the request/response correlation identifier.
    Gets the JSON-RPC version for this message.
  • Field Details

    • JSONRPC_VERSION

      static final String JSONRPC_VERSION
      The JSON-RPC protocol version string as defined by the JSON-RPC 2.0 specification. All messages must have their jsonrpc field 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