pub struct A2aClient { /* private fields */ }Expand description
Client for communicating with A2A-compatible agents.
Implementations§
Source§impl A2aClient
impl A2aClient
Sourcepub fn new(auth_token: Option<String>) -> Self
pub fn new(auth_token: Option<String>) -> Self
Create a new A2A client with an optional global fallback auth token.
Sourcepub async fn set_agent_token(&self, base_url: &str, token: String)
pub async fn set_agent_token(&self, base_url: &str, token: String)
Set an authentication token for a specific agent base URL.
Sourcepub async fn discover(&self, base_url: &str) -> Result<AgentCard>
pub async fn discover(&self, base_url: &str) -> Result<AgentCard>
Discover an agent by fetching its card from /.well-known/agent.json.
Sourcepub async fn get_agent(&self, base_url: &str) -> Result<AgentCard>
pub async fn get_agent(&self, base_url: &str) -> Result<AgentCard>
Get a cached agent card, or discover if not cached.
Sourcepub async fn send_task(
&self,
agent_url: &str,
task: &TaskRequest,
options: Option<SendTaskOptions>,
) -> Result<TaskResponse>
pub async fn send_task( &self, agent_url: &str, task: &TaskRequest, options: Option<SendTaskOptions>, ) -> Result<TaskResponse>
Send a task to an agent, optionally applying a timeout from SendTaskOptions.
Sourcepub async fn get_task(
&self,
agent_url: &str,
task_id: &str,
) -> Result<TaskResponse>
pub async fn get_task( &self, agent_url: &str, task_id: &str, ) -> Result<TaskResponse>
Get the status of a task.
Sourcepub async fn cancel_task(
&self,
agent_url: &str,
task_id: &str,
) -> Result<TaskStatusUpdate>
pub async fn cancel_task( &self, agent_url: &str, task_id: &str, ) -> Result<TaskStatusUpdate>
Cancel a running task.
Sourcepub async fn cached_agents(&self) -> Vec<AgentCard>
pub async fn cached_agents(&self) -> Vec<AgentCard>
List all cached agents.
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the agent cache.
Auto Trait Implementations§
impl !Freeze for A2aClient
impl !RefUnwindSafe for A2aClient
impl Send for A2aClient
impl Sync for A2aClient
impl Unpin for A2aClient
impl UnsafeUnpin for A2aClient
impl !UnwindSafe for A2aClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more