pub struct GrpcTransport { /* private fields */ }Expand description
gRPC transport for A2A clients.
Connects to a canonical A2A gRPC endpoint and translates A2A method
calls into typed protobuf RPCs. Implements the Transport trait for
use with crate::A2aClient.
Implementations§
Source§impl GrpcTransport
impl GrpcTransport
Sourcepub async fn connect(
endpoint: impl Into<String>,
) -> Result<GrpcTransport, ClientError>
Available on crate feature grpc only.
pub async fn connect( endpoint: impl Into<String>, ) -> Result<GrpcTransport, ClientError>
grpc only.Connects to a gRPC endpoint with default configuration.
endpoint is what an Agent Card’s gRPC interface advertises: a gRPC
target host:port (the form the specification’s proto names), or an
http:///https:// URL. A bare target is dialled per
GrpcBareAddressScheme’s default — TLS unless the host is loopback.
https:// needs the grpc-tls feature and fails with a message
saying so without it.
§Errors
Returns ClientError::InvalidEndpoint for an address in none of
those forms, and ClientError::Transport if the connection fails.
Sourcepub async fn connect_with_config(
endpoint: impl Into<String>,
config: GrpcTransportConfig,
) -> Result<GrpcTransport, ClientError>
Available on crate feature grpc only.
pub async fn connect_with_config( endpoint: impl Into<String>, config: GrpcTransportConfig, ) -> Result<GrpcTransport, ClientError>
grpc only.Connects to a gRPC endpoint with custom configuration.
§Errors
Returns ClientError::Transport if the connection fails.
Sourcepub fn with_stream_connect_timeout(self, timeout: Duration) -> GrpcTransport
Available on crate feature grpc only.
pub fn with_stream_connect_timeout(self, timeout: Duration) -> GrpcTransport
grpc only.Bounds opening a stream — until the server accepts the call —
separately from GrpcTransportConfig::timeout.
ClientBuilder has carried a with_stream_connect_timeout knob since
long before this method, documented as “per-request timeout for
establishing the SSE stream”, and the sync build() path even refuses a
zero value for it. The gRPC path never received it: build_grpc passed
request_timeout and connection_timeout and dropped the third.
Until 2026-09-22 this bounded the stream’s first event instead, as
the HTTP transports’ connect timeout also did; an agent that accepted
the call and then thought for longer than it was cut off. The first
event now has its own bound
(DEFAULT_STREAM_FIRST_EVENT_TIMEOUT,
or ClientConfig::stream_first_event_timeout
through A2aClient), and this knob bounds what its name says.
Unset means config.timeout, which is what opening a stream was
bounded by before, so a caller constructing this transport directly
sees no change there.
Trait Implementations§
Source§impl Clone for GrpcTransport
impl Clone for GrpcTransport
Source§fn clone(&self) -> GrpcTransport
fn clone(&self) -> GrpcTransport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrpcTransport
impl Debug for GrpcTransport
Source§impl Transport for GrpcTransport
impl Transport for GrpcTransport
Source§fn rpc_system(&self) -> Option<&'static str>
fn rpc_system(&self) -> Option<&'static str>
grpc, as the server records the same call. Without it a client
built from this transport with with_custom_transport opened no
CLIENT span and recorded no rpc.client.call.duration.
Source§fn server_url(&self) -> Option<&str>
fn server_url(&self) -> Option<&str>
The endpoint the channel dials, from which each call’s span and
duration take server.address and server.port.
Source§fn send_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
Source§fn send_streaming_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
fn send_streaming_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
EventStream. Read moreSource§fn send_request_with_query<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
query: &'a [(String, String)],
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request_with_query<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, query: &'a [(String, String)], ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
send_request with query appended to the
request URL, as an API key placed in the query string needs (a2a.proto
APIKeySecurityScheme.location: “query”, “header”, or “cookie”; audit
register R67). Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GrpcTransport
impl !UnwindSafe for GrpcTransport
impl Forget for GrpcTransport
impl Freeze for GrpcTransport
impl Move for GrpcTransport
impl Send for GrpcTransport
impl Sync for GrpcTransport
impl Unpin for GrpcTransport
impl UnsafeUnpin for GrpcTransport
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].