Class SendMessageRequest
java.lang.Object
org.a2aproject.sdk.jsonrpc.common.wrappers.A2ARequest<T>
org.a2aproject.sdk.jsonrpc.common.wrappers.NonStreamingJSONRPCRequest<MessageSendParams>
org.a2aproject.sdk.jsonrpc.common.wrappers.SendMessageRequest
- All Implemented Interfaces:
A2AMessage
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingSendMessageRequestinstances with a fluent API. -
Field Summary
Fields inherited from class org.a2aproject.sdk.jsonrpc.common.wrappers.A2ARequest
id, jsonrpc, method, paramsFields inherited from interface org.a2aproject.sdk.jsonrpc.common.wrappers.A2AMessage
JSONRPC_VERSION -
Constructor Summary
ConstructorsConstructorDescriptionSendMessageRequest(Object id, MessageSendParams params) Constructs a SendMessageRequest with default JSON-RPC version.SendMessageRequest(String jsonrpc, Object id, MessageSendParams params) Constructs a SendMessageRequest with the specified JSON-RPC fields. -
Method Summary
Modifier and TypeMethodDescriptionstatic SendMessageRequest.Builderbuilder()Create a new BuilderMethods inherited from class org.a2aproject.sdk.jsonrpc.common.wrappers.A2ARequest
getId, getJsonrpc, getMethod, getParams, validateAndSetJsonParameters
-
Constructor Details
-
SendMessageRequest
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
Constructs a SendMessageRequest with default JSON-RPC version.- Parameters:
id- the request correlation identifierparams- the message send parameters (required)
-
-
Method Details
-
builder
Create a new Builder- Returns:
- the builder
-