pub struct A2aClient { /* private fields */ }Expand description
A2A Client for communicating with A2A-compliant agent servers
Implementations§
Source§impl A2aClient
impl A2aClient
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new A2A client with the given configuration
Sourcepub fn with_server(server_url: &str) -> Result<Self>
pub fn with_server(server_url: &str) -> Result<Self>
Create a client with default configuration for a given server URL
Sourcepub fn server_url(&self) -> &str
pub fn server_url(&self) -> &str
Get the server base URL
Sourcepub async fn fetch_agent_card(&self) -> Result<AgentCard>
pub async fn fetch_agent_card(&self) -> Result<AgentCard>
Fetch the agent card, using cache if available and valid
Sourcepub async fn invalidate_card_cache(&self)
pub async fn invalidate_card_cache(&self)
Invalidate the cached agent card and endpoint
Sourcepub fn get_rpc_url(card: &AgentCard) -> Option<&str>
pub fn get_rpc_url(card: &AgentCard) -> Option<&str>
Get the JSON-RPC endpoint URL from the agent card
Sourcepub async fn send_message(
&self,
message: Message,
session_token: Option<&str>,
) -> Result<SendMessageResponse>
pub async fn send_message( &self, message: Message, session_token: Option<&str>, ) -> Result<SendMessageResponse>
Send a message to the agent and receive a response (Task or Message)
Sourcepub async fn poll_task(
&self,
task_id: &str,
session_token: Option<&str>,
) -> Result<Task>
pub async fn poll_task( &self, task_id: &str, session_token: Option<&str>, ) -> Result<Task>
Poll a task by ID
Sourcepub async fn poll_until_complete(
&self,
task_id: &str,
session_token: Option<&str>,
) -> Result<Task>
pub async fn poll_until_complete( &self, task_id: &str, session_token: Option<&str>, ) -> Result<Task>
Poll a task until it reaches a terminal state or max polls exceeded
Sourcepub async fn perform_oauth_interactive(&self) -> Result<String>
pub async fn perform_oauth_interactive(&self) -> Result<String>
Perform interactive OAuth flow (prompts user to visit URL and paste callback)
Sourcepub async fn start_oauth_flow(&self) -> Result<(String, String)>
pub async fn start_oauth_flow(&self) -> Result<(String, String)>
Start OAuth flow and return authorization URL (for programmatic use)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for A2aClient
impl !RefUnwindSafe for A2aClient
impl Send for A2aClient
impl Sync for A2aClient
impl Unpin 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