pub struct RemoteAgent { /* private fields */ }target_family=wasm only.Expand description
An A2A agent reached over the network.
Implementations§
Source§impl RemoteAgent
impl RemoteAgent
Sourcepub async fn connect(base_url: &str) -> Result<Self, RemoteError>
pub async fn connect(base_url: &str) -> Result<Self, RemoteError>
Connect to the agent whose card is under base_url, with no
credentials and the DEFAULT_TIMEOUT. The card is read up to 1 MiB;
a larger one is a RemoteError::Card.
Sourcepub fn builder(base_url: impl Into<String>) -> RemoteAgentBuilder
pub fn builder(base_url: impl Into<String>) -> RemoteAgentBuilder
Options for connecting to the agent whose card is under base_url.
Sourcepub fn card(&self) -> &AgentCard
pub fn card(&self) -> &AgentCard
The agent card, in v1.0 shape whatever version the agent speaks.
Sourcepub async fn send(
&self,
text: &str,
context_id: Option<&str>,
) -> Result<Reply, RemoteError>
pub async fn send( &self, text: &str, context_id: Option<&str>, ) -> Result<Reply, RemoteError>
Send text, continuing context_id’s conversation when given, and
wait for the whole answer. An agent that streams is followed event by
event, so a long task that keeps reporting is not cut short; one that
does not must answer within the timeout.
Sourcepub async fn stream(
&self,
text: &str,
context_id: Option<&str>,
) -> Result<WasmBoxedStream<'static, Result<ReplyEvent, RemoteError>>, RemoteError>
pub async fn stream( &self, text: &str, context_id: Option<&str>, ) -> Result<WasmBoxedStream<'static, Result<ReplyEvent, RemoteError>>, RemoteError>
Send text and follow the answer as it is written: state changes,
text as it grows, then ReplyEvent::Done with the whole answer.
Each event must arrive within the timeout of the one before. An agent
that does not stream yields its whole answer as one Done.
Over A2A v0.3, one event may be 16 MiB before its blank line; a longer
one ends the stream with an error. A v0.3 message/send reply, which
an agent that does not stream sends instead, is capped at 16 MiB too.
Sourcepub fn into_tool(self) -> Result<DynamicTool, EmptyToolName>
pub fn into_tool(self) -> Result<DynamicTool, EmptyToolName>
This agent as a tool named after its card, taking a message and an
optional context_id to continue a conversation the tool started.
The model gets the answer as JSON (reply, context_id, state,
and any data and files), followed by any image the agent sent.
Returns EmptyToolName when the tool name is empty, as
Agent::into_tool does; a card whose
name has no usable characters is named remote_agent instead.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RemoteAgent
impl !UnwindSafe for RemoteAgent
impl Forget for RemoteAgent
impl Freeze for RemoteAgentwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<AgentInterface>: Freeze,
PhantomData<AgentExtension>: Freeze,
PhantomData<String>: Freeze,
PhantomData<AgentSkill>: Freeze,
PhantomData<(String, SecurityScheme)>: Freeze,
PhantomData<HashMap<String, Vec<String>>>: Freeze,
PhantomData<AgentCardSignature>: Freeze,
*const ArcInner<A2AClient<Box<dyn Transport>>> is !null: Freeze,
PhantomData<ArcInner<A2AClient<Box<dyn Transport>>>>: Freeze,
*const ArcInner<ClientRef> is !null: Freeze,
PhantomData<ArcInner<ClientRef>>: Freeze,
impl Move for RemoteAgent
impl Send for RemoteAgent
impl Sync for RemoteAgent
impl Unpin for RemoteAgent
impl UnsafeUnpin for RemoteAgentwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<AgentInterface>: UnsafeUnpin,
PhantomData<AgentExtension>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<AgentSkill>: UnsafeUnpin,
PhantomData<(String, SecurityScheme)>: UnsafeUnpin,
PhantomData<HashMap<String, Vec<String>>>: UnsafeUnpin,
PhantomData<AgentCardSignature>: UnsafeUnpin,
*const ArcInner<A2AClient<Box<dyn Transport>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<A2AClient<Box<dyn Transport>>>>: UnsafeUnpin,
*const ArcInner<ClientRef> is !null: UnsafeUnpin,
PhantomData<ArcInner<ClientRef>>: UnsafeUnpin,
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
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> 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> 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 moreSource§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>
T in a tonic::Request