pub struct A2AAdapter;Expand description
The A2A provider adapter (DW-114, DP-12 #252). A pure translator,
like the OpenAI/Anthropic/Gemini adapters: it holds no state and
opens no connections. The transport is the agent’s named upstream,
driven from dataplane::ai_proxy.
build_request translates a canonical ChatRequest into an A2A
v0.3 JSON-RPC message/send (or message/stream for streaming)
body: the latest user message is folded into params.message.parts
using the A2A kind-discriminated part shape. parse_response
handles both direct Message results and Task results (extracting
text from status.message or artifacts).
Trait Implementations§
Source§impl ProviderAdapter for A2AAdapter
impl ProviderAdapter for A2AAdapter
Source§fn kind(&self) -> AiProviderKind
fn kind(&self) -> AiProviderKind
The dialect this adapter speaks.
Source§fn build_request(
&self,
req: &ChatRequest,
_provider_model: &str,
) -> Result<ProviderRequest, AiError>
fn build_request( &self, req: &ChatRequest, _provider_model: &str, ) -> Result<ProviderRequest, AiError>
Translate a canonical request into this provider’s HTTP shape.
provider_model is the mapped provider model identifier that
must REPLACE the client’s alias in the outbound body.Source§fn parse_response(&self, body: &Value) -> Result<ChatResponse, AiError>
fn parse_response(&self, body: &Value) -> Result<ChatResponse, AiError>
Translate a provider success body (HTTP 200) into the canonical
ChatResponse.Source§fn parse_error(&self, body: &Value) -> ProviderErrorBody
fn parse_error(&self, body: &Value) -> ProviderErrorBody
Extract the error message/type/code from a provider error body
(any shape the provider uses). Never fails — a best-effort
generic message is produced when the body is not understood.
Source§fn parse_stream_event(&self, data: &Value) -> Result<Vec<StreamEvent>, AiError>
fn parse_stream_event(&self, data: &Value) -> Result<Vec<StreamEvent>, AiError>
Translate ONE provider SSE data payload into zero or more
canonical stream events (DW-077 wires the gateway streaming
path; verified per adapter in DW-075 tests).
Source§fn stream_done_sentinel(&self) -> Option<&'static str>
fn stream_done_sentinel(&self) -> Option<&'static str>
The dialect’s end-of-stream data sentinel, if it has one
(OpenAI
[DONE]; Anthropic/Gemini use typed events instead).Auto Trait Implementations§
impl Freeze for A2AAdapter
impl RefUnwindSafe for A2AAdapter
impl Send for A2AAdapter
impl Sync for A2AAdapter
impl Unpin for A2AAdapter
impl UnwindSafe for A2AAdapter
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
Attempts to downcast this to
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Attempts to downcast owned
Self to T,
useful only in generic context as a workaround for specializationSource§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
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§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>
Converts
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>
Converts
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> Pointable for T
impl<T> Pointable for T
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more