Class GrpcTransport
java.lang.Object
org.a2aproject.sdk.client.transport.grpc.GrpcTransport
- All Implemented Interfaces:
ClientTransport
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcTransport(io.grpc.Channel channel, AgentCard agentCard) GrpcTransport(io.grpc.Channel channel, AgentCard agentCard, @Nullable String agentTenant, @Nullable List<ClientCallInterceptor> interceptors) -
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.
-
Constructor Details
-
GrpcTransport
-
GrpcTransport
public GrpcTransport(io.grpc.Channel channel, AgentCard agentCard, @Nullable String agentTenant, @Nullable List<ClientCallInterceptor> interceptors)
-
-
Method Details
-
sendMessage
public EventKind sendMessage(MessageSendParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportSend a non-streaming message request to the agent.- Specified by:
sendMessagein interfaceClientTransport- 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
public void sendMessageStreaming(MessageSendParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportSend a streaming message request to the agent and receive responses as they arrive.- Specified by:
sendMessageStreamingin interfaceClientTransport- 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
public Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportRetrieve the current state and history of a specific task.- Specified by:
getTaskin interfaceClientTransport- 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
public Task cancelTask(CancelTaskParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportRequest the agent to cancel a specific task.- Specified by:
cancelTaskin interfaceClientTransport- 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
public ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportList tasks with optional filtering and pagination.- Specified by:
listTasksin interfaceClientTransport- 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
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportCreate or update the push notification configuration for a specific task.- Specified by:
createTaskPushNotificationConfigurationin interfaceClientTransport- 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
public TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportRetrieve the push notification configuration for a specific task.- Specified by:
getTaskPushNotificationConfigurationin interfaceClientTransport- 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
public ListTaskPushNotificationConfigsResult listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigsParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportRetrieve the list of push notification configurations for a specific task with pagination support.- Specified by:
listTaskPushNotificationConfigurationsin interfaceClientTransport- 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
public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportDelete the list of push notification configurations for a specific task.- Specified by:
deleteTaskPushNotificationConfigurationsin interfaceClientTransport- 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
public void subscribeToTask(TaskIdParams request, Consumer<StreamingEventKind> eventConsumer, Consumer<Throwable> errorConsumer, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportReconnect to get task updates for an existing task.- Specified by:
subscribeToTaskin interfaceClientTransport- 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
public AgentCard getExtendedAgentCard(GetExtendedAgentCardParams params, @Nullable ClientCallContext context) throws A2AClientException Description copied from interface:ClientTransportRetrieve the extended AgentCard.- Specified by:
getExtendedAgentCardin interfaceClientTransport- 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
public void close()Description copied from interface:ClientTransportClose the transport and release any associated resources.- Specified by:
closein interfaceClientTransport
-