Interface ClientTransport
- All Known Implementing Classes:
GrpcTransport, JSONRPCTransport, OpenTelemetryClientPropagatorTransport, OpenTelemetryClientTransport, RestTransport
public interface ClientTransport
Interface for a client transport.
-
Method Summary
Modifier and TypeMethodDescriptioncancelTask(CancelTaskParams request, @Nullable ClientCallContext context) Request the agent to cancel a specific task.voidclose()Close the transport and release any associated resources.createTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) Create or update the push notification configuration for a specific task.voiddeleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) Delete the list of push notification configurations for a specific task.getExtendedAgentCard(GetExtendedAgentCardParams params, @Nullable ClientCallContext context) Retrieve the extended AgentCard.getTask(TaskQueryParams request, @Nullable ClientCallContext context) Retrieve the current state and history of a specific task.getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) Retrieve the push notification configuration for a specific task.listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigsParams request, @Nullable ClientCallContext context) Retrieve the list of push notification configurations for a specific task with pagination support.listTasks(ListTasksParams request, @Nullable ClientCallContext context) List tasks with optional filtering and pagination.sendMessage(MessageSendParams request, @Nullable ClientCallContext context) Send a non-streaming message request to the agent.voidsendMessageStreaming(MessageSendParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) Send a streaming message request to the agent and receive responses as they arrive.voidsubscribeToTask(TaskIdParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) Reconnect to get task updates for an existing task.
-
Method Details
-
sendMessage
EventKind sendMessage(MessageSendParams request, @Nullable ClientCallContext context) throws A2AClientException Send a non-streaming message request to the agent.- Parameters:
request- the message send parameterscontext- optional client call context for the request (may benull)- Returns:
- the response, either a Task or Message
- Throws:
A2AClientException- if sending the message fails for any reason
-
sendMessageStreaming
void sendMessageStreaming(MessageSendParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException Send a streaming message request to the agent and receive responses as they arrive.- Parameters:
request- the message send parameterseventConsumer- consumer that will receive streaming events as they arriveerrorConsumer- consumer that will be called if an error occurs during streamingcontext- optional client call context for the request (may benull)- Throws:
A2AClientException- if setting up the streaming connection fails
-
getTask
Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException 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- if retrieving the task fails for any reason
-
cancelTask
Task cancelTask(CancelTaskParams request, @Nullable ClientCallContext context) throws A2AClientException 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- if cancelling the task fails for any reason
-
listTasks
ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallContext context) throws A2AClientException List tasks with optional filtering and pagination.- Parameters:
request- the list tasks parameters including filters and paginationcontext- optional client call context for the request (may benull)- Returns:
- the list tasks result containing tasks and pagination information
- Throws:
A2AClientException- if listing tasks fails for any reason
-
createTaskPushNotificationConfiguration
TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException Create 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- if creating or updating the task push notification configuration fails for any reason
-
getTaskPushNotificationConfiguration
TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException 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- if getting the task push notification config fails for any reason
-
listTaskPushNotificationConfigurations
ListTaskPushNotificationConfigsResult listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigsParams request, @Nullable ClientCallContext context) throws A2AClientException Retrieve the list of push notification configurations for a specific task with pagination support.- Parameters:
request- the parameters specifying which task's notification configs to retrievecontext- optional client call context for the request (may benull)- Returns:
- the result containing the list of task push notification configs and pagination information
- Throws:
A2AClientException- if getting the task push notification configs fails for any reason
-
deleteTaskPushNotificationConfigurations
void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException 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- if deleting the task push notification configs fails for any reason
-
subscribeToTask
void subscribeToTask(TaskIdParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException Reconnect to get task updates for an existing task.- Parameters:
request- the task ID parameters specifying which task to subscribe toeventConsumer- consumer that will receive streaming events as they arriveerrorConsumer- consumer that will be called if an error occurs during streamingcontext- optional client call context for the request (may benull)- Throws:
A2AClientException- if subscribing to the task fails for any reason
-
getExtendedAgentCard
AgentCard getExtendedAgentCard(GetExtendedAgentCardParams params, @Nullable ClientCallContext context) throws A2AClientException Retrieve the extended AgentCard.- Parameters:
params- the parameters to get the extended agent card.context- optional client call context for the request (may benull)- Returns:
- the extended agent card
- Throws:
A2AClientException- if retrieving the agent card fails for any reason
-
close
void close()Close the transport and release any associated resources.
-