Class SendMessageRequest

All Implemented Interfaces:
A2AMessage

public final class SendMessageRequest extends NonStreamingJSONRPCRequest<MessageSendParams>
JSON-RPC request for the SendMessage method in the A2A Protocol.

This request initiates a new task or continues an existing task by sending a message to an agent. The request returns a single response containing the final Task state once processing completes (blocking/non-streaming mode).

The SendMessage method is used for:

  • Creating new tasks with an initial user message
  • Continuing existing tasks with additional messages
  • Restarting tasks with new context

For real-time event streaming during task execution, use SendStreamingMessageRequest with the SendStreamingMessage method instead.

This class includes a fluent SendMessageRequest.Builder for convenient request construction. The method name is fixed as "SendMessage" and is set automatically by the constructor.

See Also:
  • Constructor Details

    • SendMessageRequest

      public SendMessageRequest(String jsonrpc, Object id, MessageSendParams params)
      Constructs a SendMessageRequest with the specified JSON-RPC fields.

      This constructor is used for JSON deserialization and validates that the method name is exactly "SendMessage".

      Parameters:
      jsonrpc - the JSON-RPC version (must be "2.0")
      id - the request correlation identifier (String, Integer, or null)
      params - the message send parameters (required)
      Throws:
      IllegalArgumentException - if validation fails
    • SendMessageRequest

      public SendMessageRequest(Object id, MessageSendParams params)
      Constructs a SendMessageRequest with default JSON-RPC version.
      Parameters:
      id - the request correlation identifier
      params - the message send parameters (required)
  • Method Details