pub struct A2AClientFactory { /* private fields */ }Expand description
Factory for creating A2AClient instances with automatic protocol negotiation.
Maintains a registry of TransportFactory implementations indexed by protocol
and major version. When creating a client from an AgentCard, it selects the
best matching transport based on the agent’s declared interfaces and the client’s
preferred bindings.
Implementations§
Source§impl A2AClientFactory
impl A2AClientFactory
Sourcepub fn builder() -> A2AClientFactoryBuilder
pub fn builder() -> A2AClientFactoryBuilder
Create a builder for configuring the factory.
Sourcepub async fn create_from_card(
&self,
card: &AgentCard,
) -> Result<A2AClient<Box<dyn Transport>>, A2AError>
pub async fn create_from_card( &self, card: &AgentCard, ) -> Result<A2AClient<Box<dyn Transport>>, A2AError>
Create a client by negotiating the best transport with the agent card.
Selection algorithm (mirrors Go SDK):
- For each interface in the agent card’s
supported_interfaces - Look up matching factory by (protocol, major_version)
- Rank candidates: client preference order, then newest version
- Try connecting in rank order; first success wins
Auto Trait Implementations§
impl Freeze for A2AClientFactory
impl !RefUnwindSafe for A2AClientFactory
impl Send for A2AClientFactory
impl Sync for A2AClientFactory
impl Unpin for A2AClientFactory
impl UnsafeUnpin for A2AClientFactory
impl !UnwindSafe for A2AClientFactory
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request