Skip to main content

AgentLoopBuilder

Struct AgentLoopBuilder 

Source
pub struct AgentLoopBuilder<P: Provider, C: ContextStrategy> { /* private fields */ }
Expand description

Builder for constructing an AgentLoop with optional configuration.

Created via AgentLoop::builder. Only provider and context are required; everything else has sensible defaults.

§Example

let agent = AgentLoop::builder(provider, context)
    .tools(tools)
    .system_prompt("You are a helpful assistant.")
    .max_turns(10)
    .build();

Implementations§

Source§

impl<P: Provider, C: ContextStrategy> AgentLoopBuilder<P, C>

Source

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

Set the tool registry.

Source

pub fn config(self, config: LoopConfig) -> Self

Set the full loop configuration.

Source

pub fn system_prompt(self, prompt: impl Into<SystemPrompt>) -> Self

Set the system prompt (convenience for setting config.system_prompt).

Source

pub fn max_turns(self, max: usize) -> Self

Set the maximum number of turns (convenience for setting config.max_turns).

Source

pub fn parallel_tool_execution(self, parallel: bool) -> Self

Enable parallel tool execution (convenience for setting config.parallel_tool_execution).

Source

pub fn usage_limits(self, limits: UsageLimits) -> Self

Set usage limits for the loop (token budgets, request/tool call caps).

Source

pub fn hook<H: ObservabilityHook + 'static>(self, hook: H) -> Self

Add an observability hook.

Source

pub fn durability<D: DurableContext + 'static>(self, durable: D) -> Self

Set the durable context for crash-recoverable execution.

Source

pub fn build(self) -> AgentLoop<P, C>

Build the AgentLoop.

Auto Trait Implementations§

§

impl<P, C> Freeze for AgentLoopBuilder<P, C>
where P: Freeze, C: Freeze,

§

impl<P, C> !RefUnwindSafe for AgentLoopBuilder<P, C>

§

impl<P, C> Send for AgentLoopBuilder<P, C>

§

impl<P, C> Sync for AgentLoopBuilder<P, C>

§

impl<P, C> Unpin for AgentLoopBuilder<P, C>
where P: Unpin, C: Unpin,

§

impl<P, C> UnsafeUnpin for AgentLoopBuilder<P, C>
where P: UnsafeUnpin, C: UnsafeUnpin,

§

impl<P, C> !UnwindSafe for AgentLoopBuilder<P, C>

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> 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, 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.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,