pub struct A2AClient { /* private fields */ }Expand description
High-level A2A client for communicating with remote agents.
Implementations§
Source§impl A2AClient
impl A2AClient
Sourcepub fn with_http_client(base_url: &str, http: Client) -> Self
pub fn with_http_client(base_url: &str, http: Client) -> Self
Create a client with a custom HTTP client.
Sourcepub async fn discover(&mut self) -> A2AResult<&AgentCard>
pub async fn discover(&mut self) -> A2AResult<&AgentCard>
Discover the remote agent’s capabilities by fetching its Agent Card.
Sourcepub fn agent_card(&self) -> Option<&AgentCard>
pub fn agent_card(&self) -> Option<&AgentCard>
Get the cached agent card (call discover() first).
Sourcepub async fn send_message(&self, request: SendMessageRequest) -> A2AResult<Task>
pub async fn send_message(&self, request: SendMessageRequest) -> A2AResult<Task>
Send a message to the remote agent, creating or continuing a task.
Sourcepub async fn send_message_text(&self, text: &str) -> A2AResult<Task>
pub async fn send_message_text(&self, text: &str) -> A2AResult<Task>
Convenience: send a simple text message.
Sourcepub async fn continue_task(&self, task_id: &str, text: &str) -> A2AResult<Task>
pub async fn continue_task(&self, task_id: &str, text: &str) -> A2AResult<Task>
Continue an existing task with additional input.
Sourcepub async fn list_tasks(&self, params: TaskQueryParams) -> A2AResult<Vec<Task>>
pub async fn list_tasks(&self, params: TaskQueryParams) -> A2AResult<Vec<Task>>
List tasks matching the given query parameters.
Sourcepub async fn cancel_task(&self, task_id: &str) -> A2AResult<Task>
pub async fn cancel_task(&self, task_id: &str) -> A2AResult<Task>
Cancel a running task.
Sourcepub async fn send_streaming_message(
&self,
request: SendMessageRequest,
) -> A2AResult<TaskEventStream>
pub async fn send_streaming_message( &self, request: SendMessageRequest, ) -> A2AResult<TaskEventStream>
Send a streaming message — returns an SSE stream of task events.
The remote agent will stream back TaskEvents as it processes
the message (state changes, partial artifacts, etc.).
Sourcepub async fn send_streaming_text(
&self,
text: &str,
) -> A2AResult<TaskEventStream>
pub async fn send_streaming_text( &self, text: &str, ) -> A2AResult<TaskEventStream>
Convenience: send a streaming text message.
Sourcepub async fn subscribe_task(&self, task_id: &str) -> A2AResult<TaskEventStream>
pub async fn subscribe_task(&self, task_id: &str) -> A2AResult<TaskEventStream>
Subscribe to an existing task’s updates via SSE.
Sourcepub async fn create_push_notification(
&self,
config: &PushNotificationConfig,
) -> A2AResult<PushNotificationConfig>
pub async fn create_push_notification( &self, config: &PushNotificationConfig, ) -> A2AResult<PushNotificationConfig>
Create a push notification configuration for a task.
Sourcepub async fn get_push_notification(
&self,
config_id: &str,
task_id: &str,
) -> A2AResult<PushNotificationConfig>
pub async fn get_push_notification( &self, config_id: &str, task_id: &str, ) -> A2AResult<PushNotificationConfig>
Get a push notification configuration by ID.
Sourcepub async fn list_push_notifications(
&self,
task_id: &str,
) -> A2AResult<Vec<PushNotificationConfig>>
pub async fn list_push_notifications( &self, task_id: &str, ) -> A2AResult<Vec<PushNotificationConfig>>
List push notification configurations for a task.
Sourcepub async fn delete_push_notification(
&self,
config_id: &str,
task_id: &str,
) -> A2AResult<()>
pub async fn delete_push_notification( &self, config_id: &str, task_id: &str, ) -> A2AResult<()>
Delete a push notification configuration.
Sourcepub async fn get_extended_agent_card(&self) -> A2AResult<AgentCard>
pub async fn get_extended_agent_card(&self) -> A2AResult<AgentCard>
Get the extended agent card (post-authentication).