Skip to main content

A2aV1Client

Struct A2aV1Client 

Source
pub struct A2aV1Client { /* private fields */ }
Available on crate features a2a-v1 and server only.
Expand description

A2A v1.0.0 client.

Sends A2A-Version: 1.0 on every request, supports all 11 operations via JSON-RPC (and optionally REST), parses structured error responses, caches agent cards with conditional headers, and retries transient failures.

Implementations§

Source§

impl A2aV1Client

Source

pub fn new(agent_card: AgentCard) -> A2aV1Client

Creates a new v1 client from an already-resolved agent card.

Source

pub fn with_retry( agent_card: AgentCard, retry_config: RetryConfig, ) -> A2aV1Client

Creates a new v1 client with custom retry configuration.

Source

pub fn agent_card(&self) -> &AgentCard

Returns a reference to the agent card.

Source

pub async fn resolve_agent_card( base_url: &str, ) -> Result<AgentCard, V1ClientError>

Resolves an agent card from a base URL, fetching from /.well-known/agent-card.json with A2A-Version: 1.0.

Caches the ETag and Last-Modified headers for subsequent conditional requests.

Source

pub async fn resolve_agent_card_cached( &self, base_url: &str, ) -> Result<Option<AgentCard>, V1ClientError>

Resolves an agent card using conditional headers if a cached version exists. Returns None if the server responds 304.

Source

pub async fn send_message( &self, message: Message, ) -> Result<Task, V1ClientError>

Sends a message to the remote agent (JSON-RPC SendMessage).

Source

pub async fn send_streaming_message( &self, message: Message, ) -> Result<Response, V1ClientError>

Sends a streaming message (JSON-RPC SendStreamingMessage).

Returns the raw response for SSE parsing by the caller.

Source

pub async fn get_task( &self, task_id: &str, history_length: Option<u32>, ) -> Result<Task, V1ClientError>

Retrieves a task by ID (JSON-RPC GetTask).

Source

pub async fn cancel_task(&self, task_id: &str) -> Result<Task, V1ClientError>

Cancels a task (JSON-RPC CancelTask).

Source

pub async fn list_tasks( &self, context_id: Option<&str>, status: Option<TaskState>, page_size: Option<u32>, page_token: Option<&str>, ) -> Result<Vec<Task>, V1ClientError>

Lists tasks with optional filtering (JSON-RPC ListTasks).

Source

pub async fn subscribe_to_task( &self, task_id: &str, ) -> Result<Response, V1ClientError>

Subscribes to task updates (JSON-RPC SubscribeToTask).

Returns the raw response for SSE parsing by the caller.

Source

pub async fn create_push_notification_config( &self, config: TaskPushNotificationConfig, ) -> Result<TaskPushNotificationConfig, V1ClientError>

Creates a push notification config (JSON-RPC CreateTaskPushNotificationConfig).

Source

pub async fn get_push_notification_config( &self, task_id: &str, config_id: &str, ) -> Result<TaskPushNotificationConfig, V1ClientError>

Gets a push notification config (JSON-RPC GetTaskPushNotificationConfig).

Source

pub async fn list_push_notification_configs( &self, task_id: &str, ) -> Result<Vec<TaskPushNotificationConfig>, V1ClientError>

Lists push notification configs (JSON-RPC ListTaskPushNotificationConfigs).

Source

pub async fn delete_push_notification_config( &self, task_id: &str, config_id: &str, ) -> Result<(), V1ClientError>

Deletes a push notification config (JSON-RPC DeleteTaskPushNotificationConfig).

Source

pub async fn get_extended_agent_card(&self) -> Result<AgentCard, V1ClientError>

Gets the extended agent card (JSON-RPC GetExtendedAgentCard).

Source

pub async fn send_message_rest( &self, message: Message, ) -> Result<Task, V1ClientError>

Sends a message via REST (POST /message:send).

Source

pub async fn get_task_rest(&self, task_id: &str) -> Result<Task, V1ClientError>

Gets a task via REST (GET /tasks/{taskId}).

Source

pub async fn cancel_task_rest( &self, task_id: &str, ) -> Result<Task, V1ClientError>

Cancels a task via REST (POST /tasks/{taskId}:cancel).

Source

pub async fn list_tasks_rest(&self) -> Result<Vec<Task>, V1ClientError>

Lists tasks via REST (GET /tasks).

Source

pub async fn create_push_notification_config_rest( &self, task_id: &str, config: TaskPushNotificationConfig, ) -> Result<TaskPushNotificationConfig, V1ClientError>

Creates a push notification config via REST (POST /tasks/{taskId}/pushNotificationConfigs).

Source

pub async fn get_push_notification_config_rest( &self, task_id: &str, config_id: &str, ) -> Result<TaskPushNotificationConfig, V1ClientError>

Gets a push notification config via REST (GET /tasks/{taskId}/pushNotificationConfigs/{configId}).

Source

pub async fn list_push_notification_configs_rest( &self, task_id: &str, ) -> Result<Vec<TaskPushNotificationConfig>, V1ClientError>

Lists push notification configs via REST (GET /tasks/{taskId}/pushNotificationConfigs).

Source

pub async fn delete_push_notification_config_rest( &self, task_id: &str, config_id: &str, ) -> Result<(), V1ClientError>

Deletes a push notification config via REST (DELETE /tasks/{taskId}/pushNotificationConfigs/{configId}).

Source

pub async fn get_extended_agent_card_rest( &self, ) -> Result<AgentCard, V1ClientError>

Gets the extended agent card via REST (GET /extendedAgentCard).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more