Class CancelTaskRequest
java.lang.Object
org.a2aproject.sdk.jsonrpc.common.wrappers.A2ARequest<T>
org.a2aproject.sdk.jsonrpc.common.wrappers.NonStreamingJSONRPCRequest<CancelTaskParams>
org.a2aproject.sdk.jsonrpc.common.wrappers.CancelTaskRequest
- All Implemented Interfaces:
A2AMessage
JSON-RPC request to cancel an in-progress task.
This request instructs the agent to cancel execution of a specific task identified by ID.
The agent should stop processing, clean up resources, and transition the task to
TaskState.TASK_STATE_CANCELED state if cancellation is possible.
Not all tasks can be canceled (e.g., already completed tasks), which may result in
a TaskNotCancelableError.
This class implements the JSON-RPC tasks/cancel method as specified in the A2A Protocol.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingCancelTaskRequestinstances. -
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
ConstructorsConstructorDescriptionCancelTaskRequest(Object id, CancelTaskParams params) Creates a new CancelTaskRequest with default JSON-RPC version and method.CancelTaskRequest(String jsonrpc, Object id, CancelTaskParams params) Creates a new CancelTaskRequest with the specified JSON-RPC parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic CancelTaskRequest.Builderbuilder()Create a new BuilderMethods inherited from class org.a2aproject.sdk.jsonrpc.common.wrappers.A2ARequest
getId, getJsonrpc, getMethod, getParams, validateAndSetJsonParameters
-
Constructor Details
-
CancelTaskRequest
Creates a new CancelTaskRequest with the specified JSON-RPC parameters.- Parameters:
jsonrpc- the JSON-RPC version (defaults to "2.0" if null)id- the request identifier (string, integer, or null)params- the request parameters containing the task ID- Throws:
IllegalArgumentException- if jsonrpc version is invalid, method is not "CancelTask", params is null, or id is not a String/Integer/null
-
CancelTaskRequest
Creates a new CancelTaskRequest with default JSON-RPC version and method.- Parameters:
id- the request identifier (string, integer, or null)params- the request parameters containing the task ID- Throws:
IllegalArgumentException- if params is null or id is not a string/integer/null
-
-
Method Details
-
builder
Create a new Builder- Returns:
- the builder
-