Class AbstractClient_v0_3
java.lang.Object
org.a2aproject.sdk.compat03.client.AbstractClient_v0_3
- Direct Known Subclasses:
Client_v0_3
Abstract class representing an A2A client. Provides a standard set
of methods for interacting with an A2A agent, regardless of the underlying
transport protocol. It supports sending messages, managing tasks, and
handling event streams.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractClient_v0_3(@NonNull List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, @Nullable Consumer<Throwable> streamingErrorHandler) AbstractClient_v0_3(List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers) -
Method Summary
Modifier and TypeMethodDescriptioncancelTask(TaskIdParams_v0_3 request) Request the agent to cancel a specific task.abstract Task_v0_3cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Request the agent to cancel a specific task.abstract voidclose()Close the transport and release any associated resources.voidDelete the list of push notification configurations for a specific task.abstract voiddeleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Delete the list of push notification configurations for a specific task.Retrieve the AgentCard.abstract AgentCard_v0_3getAgentCard(@Nullable ClientCallContext_v0_3 context) Retrieve the AgentCard.Get the error handler that should be used during streaming.getTask(TaskQueryParams_v0_3 request) Retrieve the current state and history of a specific task.abstract Task_v0_3getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Retrieve the current state and history of a specific task.Retrieve the push notification configuration for a specific task.abstract TaskPushNotificationConfig_v0_3getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Retrieve the push notification configuration for a specific task.Retrieve the list of push notification configurations for a specific task.abstract List<TaskPushNotificationConfig_v0_3> listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Retrieve the list of push notification configurations for a specific task.voidresubscribe(TaskIdParams_v0_3 request) Resubscribe to a task's event stream.voidresubscribe(TaskIdParams_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler) Resubscribe to a task's event stream.abstract voidresubscribe(TaskIdParams_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) Resubscribe to a task's event stream.abstract voidresubscribe(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) Resubscribe to a task's event stream.voidsendMessage(Message_v0_3 request) Send a message to the remote agent.voidsendMessage(Message_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler) Send a message to the remote agent.abstract voidsendMessage(Message_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) Send a message to the remote agent.abstract voidsendMessage(Message_v0_3 request, @Nullable ClientCallContext_v0_3 context) Send a message to the remote agent.voidsendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, Map<String, Object> metadata) Send a message to the remote agent.abstract voidsendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, Map<String, Object> metadata, @Nullable ClientCallContext_v0_3 context) Send a message to the remote agent.Set or update the push notification configuration for a specific task.abstract TaskPushNotificationConfig_v0_3setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, @Nullable ClientCallContext_v0_3 context) Set or update the push notification configuration for a specific task.
-
Constructor Details
-
AbstractClient_v0_3
-
AbstractClient_v0_3
public AbstractClient_v0_3(@NonNull List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, @Nullable Consumer<Throwable> streamingErrorHandler)
-
-
Method Details
-
sendMessage
Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming. The configured client push notification configuration will get used for streaming.- Parameters:
request- the message- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
sendMessage
public abstract void sendMessage(Message_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming. The configured client push notification configuration will get used for streaming.- Parameters:
request- the messagecontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
sendMessage
public void sendMessage(Message_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler) throws A2AClientException_v0_3 Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The specified client consumers will be used to handle messages, tasks, and update events received from the remote agent. The specified streaming error handler will be used if an error occurs during streaming. The configured client push notification configuration will get used for streaming.- Parameters:
request- the messageconsumers- a list of consumers to pass responses from the remote agent tostreamingErrorHandler- an error handler that should be used for the streaming case if an error occurs- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
sendMessage
public abstract void sendMessage(Message_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The specified client consumers will be used to handle messages, tasks, and update events received from the remote agent. The specified streaming error handler will be used if an error occurs during streaming. The configured client push notification configuration will get used for streaming.- Parameters:
request- the messageconsumers- a list of consumers to pass responses from the remote agent tostreamingErrorHandler- an error handler that should be used for the streaming case if an error occurscontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
sendMessage
public void sendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, Map<String, Object> metadata) throws A2AClientException_v0_3Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the messagepushNotificationConfiguration- the push notification configuration that should be used if the streaming approach is usedmetadata- the optional metadata to include when sending the message- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
sendMessage
public abstract void sendMessage(Message_v0_3 request, PushNotificationConfig_v0_3 pushNotificationConfiguration, Map<String, Object> metadata, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3Send a message to the remote agent. This method will automatically use the streaming or non-streaming approach as determined by the server's agent card and the client configuration. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the messagepushNotificationConfiguration- the push notification configuration that should be used if the streaming approach is usedmetadata- the optional metadata to include when sending the messagecontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if sending the message fails for any reason
-
getTask
Retrieve the current state and history of a specific task.- Parameters:
request- the task query parameters specifying which task to retrieve- Returns:
- the task
- Throws:
A2AClientException_v0_3- if retrieving the task fails for any reason
-
getTask
public abstract Task_v0_3 getTask(TaskQueryParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Retrieve the current state and history of a specific task.- Parameters:
request- the task query parameters specifying which task to retrievecontext- optional client call context for the request (may benull)- Returns:
- the task
- Throws:
A2AClientException_v0_3- if retrieving the task fails for any reason
-
cancelTask
Request the agent to cancel a specific task.- Parameters:
request- the task ID parameters specifying which task to cancel- Returns:
- the cancelled task
- Throws:
A2AClientException_v0_3- if cancelling the task fails for any reason
-
cancelTask
public abstract Task_v0_3 cancelTask(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Request the agent to cancel a specific task.- Parameters:
request- the task ID parameters specifying which task to cancelcontext- optional client call context for the request (may benull)- Returns:
- the cancelled task
- Throws:
A2AClientException_v0_3- if cancelling the task fails for any reason
-
setTaskPushNotificationConfiguration
public TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request) throws A2AClientException_v0_3 Set or update the push notification configuration for a specific task.- Parameters:
request- the push notification configuration to set for the task- Returns:
- the configured TaskPushNotificationConfig
- Throws:
A2AClientException_v0_3- if setting the task push notification configuration fails for any reason
-
setTaskPushNotificationConfiguration
public abstract TaskPushNotificationConfig_v0_3 setTaskPushNotificationConfiguration(TaskPushNotificationConfig_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Set or update the push notification configuration for a specific task.- Parameters:
request- the push notification configuration to set for the taskcontext- optional client call context for the request (may benull)- Returns:
- the configured TaskPushNotificationConfig
- Throws:
A2AClientException_v0_3- if setting the task push notification configuration fails for any reason
-
getTaskPushNotificationConfiguration
public TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 Retrieve the push notification configuration for a specific task.- Parameters:
request- the parameters specifying which task's notification config to retrieve- Returns:
- the task push notification config
- Throws:
A2AClientException_v0_3- if getting the task push notification config fails for any reason
-
getTaskPushNotificationConfiguration
public abstract TaskPushNotificationConfig_v0_3 getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Retrieve the push notification configuration for a specific task.- Parameters:
request- the parameters specifying which task's notification config to retrievecontext- optional client call context for the request (may benull)- Returns:
- the task push notification config
- Throws:
A2AClientException_v0_3- if getting the task push notification config fails for any reason
-
listTaskPushNotificationConfigurations
public List<TaskPushNotificationConfig_v0_3> listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 Retrieve the list of push notification configurations for a specific task.- Parameters:
request- the parameters specifying which task's notification configs to retrieve- Returns:
- the list of task push notification configs
- Throws:
A2AClientException_v0_3- if getting the task push notification configs fails for any reason
-
listTaskPushNotificationConfigurations
public abstract List<TaskPushNotificationConfig_v0_3> listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Retrieve the list of push notification configurations for a specific task.- Parameters:
request- the parameters specifying which task's notification configs to retrievecontext- optional client call context for the request (may benull)- Returns:
- the list of task push notification configs
- Throws:
A2AClientException_v0_3- if getting the task push notification configs fails for any reason
-
deleteTaskPushNotificationConfigurations
public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request) throws A2AClientException_v0_3 Delete the list of push notification configurations for a specific task.- Parameters:
request- the parameters specifying which task's notification configs to delete- Throws:
A2AClientException_v0_3- if deleting the task push notification configs fails for any reason
-
deleteTaskPushNotificationConfigurations
public abstract void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Delete the list of push notification configurations for a specific task.- Parameters:
request- the parameters specifying which task's notification configs to deletecontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if deleting the task push notification configs fails for any reason
-
resubscribe
Resubscribe to a task's event stream. This is only available if both the client and server support streaming. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the parameters specifying which task's notification configs to delete- Throws:
A2AClientException_v0_3- if resubscribing fails for any reason
-
resubscribe
public abstract void resubscribe(TaskIdParams_v0_3 request, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Resubscribe to a task's event stream. This is only available if both the client and server support streaming. The configured client consumers will be used to handle messages, tasks, and update events received from the remote agent. The configured streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the parameters specifying which task's notification configs to deletecontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if resubscribing fails for any reason
-
resubscribe
public void resubscribe(TaskIdParams_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler) throws A2AClientException_v0_3 Resubscribe to a task's event stream. This is only available if both the client and server support streaming. The specified client consumers will be used to handle messages, tasks, and update events received from the remote agent. The specified streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the parameters specifying which task's notification configs to deleteconsumers- a list of consumers to pass responses from the remote agent tostreamingErrorHandler- an error handler that should be used for the streaming case if an error occurs- Throws:
A2AClientException_v0_3- if resubscribing fails for any reason
-
resubscribe
public abstract void resubscribe(TaskIdParams_v0_3 request, List<BiConsumer<ClientEvent_v0_3, AgentCard_v0_3>> consumers, Consumer<Throwable> streamingErrorHandler, @Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Resubscribe to a task's event stream. This is only available if both the client and server support streaming. The specified client consumers will be used to handle messages, tasks, and update events received from the remote agent. The specified streaming error handler will be used if an error occurs during streaming.- Parameters:
request- the parameters specifying which task's notification configs to deleteconsumers- a list of consumers to pass responses from the remote agent tostreamingErrorHandler- an error handler that should be used for the streaming case if an error occurscontext- optional client call context for the request (may benull)- Throws:
A2AClientException_v0_3- if resubscribing fails for any reason
-
getAgentCard
Retrieve the AgentCard.- Returns:
- the AgentCard
- Throws:
A2AClientException_v0_3- if retrieving the agent card fails for any reason
-
getAgentCard
public abstract AgentCard_v0_3 getAgentCard(@Nullable ClientCallContext_v0_3 context) throws A2AClientException_v0_3 Retrieve the AgentCard.- Parameters:
context- optional client call context for the request (may benull)- Returns:
- the AgentCard
- Throws:
A2AClientException_v0_3- if retrieving the agent card fails for any reason
-
close
public abstract void close()Close the transport and release any associated resources. -
getStreamingErrorHandler
-