Skip to main content

Agent

Struct Agent 

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

One configured model-tool agent.

Implementations§

Source§

impl Agent

Source

pub fn run<'a>( &'a self, input: impl Into<String> + Send + 'a, run: &'a RunContext, ) -> AgentFuture<'a, Result<AgentOutcome, AgentError>>

Runs a user text turn inside an existing runtime context.

Source

pub fn stream<'a>( &'a self, input: impl Into<String> + Send + 'a, run: &'a RunContext, ) -> AgentEventStream<'a>

Streams real-time events while driving the canonical Agent loop.

Source

pub fn run_checkpointed<'a>( &'a self, input: impl Into<String> + Send + 'a, run: &'a RunContext, checkpoint: &'a AgentCheckpoint, ) -> AgentFuture<'a, Result<AgentOutcome, AgentError>>

Runs with write-ahead checkpoint persistence.

Source

pub fn resume<'a>( &'a self, checkpoint: &'a AgentCheckpoint, run: &'a RunContext, policy: ResumePolicy, ) -> AgentFuture<'a, Result<AgentOutcome, AgentError>>

Resumes a persisted Agent execution.

Source§

impl Agent

Source

pub fn builder( name: impl Into<String>, model: Arc<dyn Model>, model_ref: ModelRef, ) -> AgentBuilder

Starts a fluent builder for an Agent.

Source

pub fn new( name: impl Into<String>, model: Arc<dyn Model>, model_ref: ModelRef, ) -> Self

Creates an agent without instructions or tools.

Source

pub fn system(self, instruction: impl Into<String>) -> Self

Appends a system instruction.

Source

pub fn tools(self, tools: ToolRegistry) -> Self

Installs the registry whose tools are exposed and executable.

Source

pub fn agents(self, agents: AgentGateway) -> Self

Installs the gateway whose child agents are exposed and callable.

Source

pub fn effect_executor(self, effects: EffectExecutor) -> Self

Replaces the write-ahead effect coordinator shared by callables.

Source

pub const fn effect_recovery_policy(self, policy: EffectRecoveryPolicy) -> Self

Sets recovery behavior for ambiguous callable effects.

Source

pub const fn with_config(self, config: AgentConfig) -> Self

Replaces local execution configuration.

Source

pub fn output_format(self, output_format: OutputFormat) -> Self

Sets the desired format for the terminal model response.

Source

pub fn structured_output<T>(self, name: impl Into<String>) -> Self
where T: JsonSchema,

Requests strict structured output described by the Rust type T.

Source

pub fn into_structured<T>(self, name: impl Into<String>) -> StructuredAgent<T>
where T: JsonSchema,

Binds provider schema generation and local decoding to the same type.

Source

pub fn name(&self) -> &str

Returns the stable local agent name.

Source

pub const fn model_ref(&self) -> &ModelRef

Returns the provider and model identity used by this Agent.

Source

pub fn callable_capabilities(&self) -> CapabilitySet

Returns capabilities for every Tool and child Agent exposed by this Agent.

The returned set is not granted automatically. Applications explicitly decide whether to install it on a root or delegated Run.

Trait Implementations§

Source§

impl Clone for Agent

Source§

fn clone(&self) -> Agent

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, formatter: &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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.