Skip to main content

Agent

Struct Agent 

Source
pub struct Agent { /* private fields */ }
Expand description

A runnable agent, composed by value. Cheap to clone (shared internals).

Implementations§

Source§

impl Agent

Source

pub fn builder() -> AgentBuilder

Start composing an agent.

Source

pub fn definition(&self) -> &AgentDefinition

Portable definition of this agent.

Source

pub fn environment(&self) -> &AgentEnvironment

Host resources used to run this agent.

Source

pub fn name(&self) -> &str

The agent’s name, for logs and diagnostics.

Source

pub fn model(&self) -> &ModelSpec

The agent’s default model. Per-turn overrides go through TurnControls.

Source

pub fn model_profile(&self) -> Option<&ModelProfile>

What the attached catalog says this agent’s model supports, if anything — see AgentBuilder::model_catalog.

Source

pub fn capabilities(&self) -> &[Arc<dyn Capability>]

Everything attached to this agent, in attachment order.

Source

pub fn driver_for_model(&self) -> Option<Arc<dyn ChatDriver>>

The driver that speaks this agent’s model protocol. Guaranteed by build() to exist.

Source

pub fn session(&self) -> Session

Start a session with an in-memory event log.

Source

pub fn session_with_log(&self, log: Arc<dyn EventLog>) -> Session

Start a session writing to the given event log.

Source

pub async fn resume_session( &self, log: Arc<dyn EventLog>, session_id: SessionId, ) -> Result<Session>

Rebuild a session’s message history by replaying its event log.

Source

pub async fn run(&self, input: impl Into<Message>) -> Result<TurnResult>

One-shot convenience: run a single turn in a throwaway session.

Trait Implementations§

Source§

impl Clone for Agent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Agent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Agent

§

impl !UnwindSafe for Agent

§

impl Freeze for Agent

§

impl Send for Agent

§

impl Sync for Agent

§

impl Unpin for Agent

§

impl UnsafeUnpin for Agent

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.