接口 A2AClient
- 所有已知实现类:
DefaultA2AClient
public interface A2AClient
Interface defining the core functionality of an A2A client.
The A2A client is responsible for interacting with an A2A server.
-
方法概要
修饰符和类型方法说明Get the AgentCard info current in clientcancelTask(TaskIdParams params) Cancels a currently running task.getTask(TaskQueryParams params) Retrieves the current state of a task.getTaskPushNotification(TaskIdParams params) Retrieves the currently configured push notification config for a task.reactor.core.publisher.Flux<SendStreamingMessageResponse>resubscribeTask(TaskQueryParams params) Resubscribes to updates for a task after a potential connection interruption.Retrieves the AgentCard for the server this client connects to.sendMessage(MessageSendParams params) Sends a task request to the server (non-streaming).reactor.core.publisher.Flux<SendStreamingMessageResponse>sendMessageStream(MessageSendParams params) Sends a task request and subscribes to streaming updates.Sets or updates the push notification config for a task.Optional: Checks if the server likely supports optional methods based on agent card.
-
方法详细资料
-
agentCard
AgentCard agentCard()Get the AgentCard info current in client- 返回:
- AgentCard
-
retrieveAgentCard
AgentCard retrieveAgentCard()Retrieves the AgentCard for the server this client connects to. This is typically fetched from a well-known endpoint.- 返回:
- AgentCard.
-
sendMessage
Sends a task request to the server (non-streaming).- 参数:
params- The parameters for the tasks/send method.- 返回:
- created Task object or null.
- 抛出:
A2AError
-
sendMessageStream
reactor.core.publisher.Flux<SendStreamingMessageResponse> sendMessageStream(MessageSendParams params) Sends a task request and subscribes to streaming updates. Returns a Flux that emits TaskUpdateEvent payloads (either TaskStatusUpdateEvent or TaskArtifactUpdateEvent).- 参数:
params- The parameters for the tasks/sendSubscribe method.- 返回:
- A Flux of task update events.
-
getTask
Retrieves the current state of a task.- 参数:
params- The parameters for the tasks/get method.- 返回:
- Task object or null.
-
cancelTask
Cancels a currently running task.- 参数:
params- The parameters for the tasks/cancel method.- 返回:
- the updated Task object (usually canceled state) or null.
-
setTaskPushNotification
Sets or updates the push notification config for a task.- 参数:
params- The parameters for the tasks/pushNotification/set method.- 返回:
- the confirmed TaskPushNotificationConfig or null.
-
getTaskPushNotification
Retrieves the currently configured push notification config for a task.- 参数:
params- The parameters for the tasks/pushNotification/get method.- 返回:
- the TaskPushNotificationConfig or null.
-
resubscribeTask
Resubscribes to updates for a task after a potential connection interruption. Returns a Publisher that emits TaskUpdateEvent payloads (either TaskStatusUpdateEvent or TaskArtifactUpdateEvent).- 参数:
params- The parameters for the tasks/resubscribe method.- 返回:
- A Flux of task update events.
-
supports
Optional: Checks if the server likely supports optional methods based on agent card. This is a client-side heuristic and might not be perfectly accurate.- 参数:
capability- The capability to check (e.g., 'streaming', 'pushNotifications').- 返回:
- true if the capability is likely supported.
-