pub struct Agent;Expand description
The agent role - typically an LLM that responds to prompts.
Agents receive prompts from clients and respond with answers, potentially invoking tools along the way.
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn builder(self) -> Builder<Agent, NullHandler, NullRun>
pub fn builder(self) -> Builder<Agent, NullHandler, NullRun>
Create a connection builder for an agent.
Sourcepub fn v2(self) -> V2Builder<Agent, NullHandler, NullRun>
Available on crate feature unstable_protocol_v2 only.
pub fn v2(self) -> V2Builder<Agent, NullHandler, NullRun>
unstable_protocol_v2 only.Create an agent builder that uses the ACP protocol v2 API.
This builder selects protocol v2 for clients requesting v2 or a newer
version. A request for exactly v2 must be a valid v2 initialize
request. A request for a newer version is accepted with what parses
under v2: unparsable capabilities and _meta are dropped, and a missing
or malformed info is replaced by an implementation named unknown
with version unknown. Use Self::protocol_router with a v1
implementation for v1 clients.
The client may repeat initialize after the previous one completed
and before it sends any other request. Each repeat is dispatched to
the initialize handler and the latest one is authoritative. A repeat
after any other request, while an initialize is in flight, or
requesting a version below v2 is rejected with -32600. A repeat that
fails keeps the previous initialization in place. Requests with a
null id are rejected with -32600.
Requires the unstable_protocol_v2 crate feature.
Sourcepub fn protocol_router(self) -> AgentProtocolRouter
Available on crate feature unstable_protocol_v2 only.
pub fn protocol_router(self) -> AgentProtocolRouter
unstable_protocol_v2 only.Create a router that chooses between configured protocol implementations.
Add implementations with AgentProtocolRouter::with_v1 and
AgentProtocolRouter::with_v2.
The resulting router reads the initial
initialize request and selects a version-specific implementation. An
endpoint exposing v2 selects the highest configured version at or below
the requested version. A v1-only endpoint retains v1’s fallback-to-latest
rule. The router does not convert traffic after initialization.
The selected implementation owns the connection. A repeated
initialize is forwarded to it and is never re-routed, so it is
evaluated against the selected version: a v2 implementation rejects a
repeat requesting v1 with -32600, and a v1 implementation selects v1
for a repeat requesting a newer version. A first initialize with a
null id that would select v2 is rejected with -32600, like any
other invalid first request.
Requires the unstable_protocol_v2 crate feature while protocol v2
stabilizes.
Trait Implementations§
impl Copy for Agent
impl Eq for Agent
Source§impl HasPeer<Agent> for Agent
impl HasPeer<Agent> for Agent
Source§fn remote_style(&self, _peer: Agent) -> RemoteStyle
fn remote_style(&self, _peer: Agent) -> RemoteStyle
Source§impl HasPeer<Agent> for Conductor
impl HasPeer<Agent> for Conductor
Source§fn remote_style(&self, _peer: Agent) -> RemoteStyle
fn remote_style(&self, _peer: Agent) -> RemoteStyle
Source§impl Ord for Agent
impl Ord for Agent
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Agent
impl PartialOrd for Agent
Source§impl Role for Agent
impl Role for Agent
Source§type Counterpart = Client
type Counterpart = Client
Source§fn counterpart(&self) -> Self::Counterpart
fn counterpart(&self) -> Self::Counterpart
Source§async fn default_handle_dispatch_from(
&self,
message: Dispatch,
connection: ConnectionTo<Agent>,
) -> Result<Handled<Dispatch>, Error>
async fn default_handle_dispatch_from( &self, message: Dispatch, connection: ConnectionTo<Agent>, ) -> Result<Handled<Dispatch>, Error>
impl StructuralPartialEq for Agent
Auto Trait Implementations§
impl Freeze for Agent
impl RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl UnwindSafe for Agent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.