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>
impl<P: Provider, C: ContextStrategy> AgentLoopBuilder<P, C>
Sourcepub fn tools(self, tools: ToolRegistry) -> Self
pub fn tools(self, tools: ToolRegistry) -> Self
Set the tool registry.
Sourcepub fn config(self, config: LoopConfig) -> Self
pub fn config(self, config: LoopConfig) -> Self
Set the full loop configuration.
Sourcepub fn system_prompt(self, prompt: impl Into<SystemPrompt>) -> Self
pub fn system_prompt(self, prompt: impl Into<SystemPrompt>) -> Self
Set the system prompt (convenience for setting config.system_prompt).
Sourcepub fn max_turns(self, max: usize) -> Self
pub fn max_turns(self, max: usize) -> Self
Set the maximum number of turns (convenience for setting config.max_turns).
Sourcepub fn parallel_tool_execution(self, parallel: bool) -> Self
pub fn parallel_tool_execution(self, parallel: bool) -> Self
Enable parallel tool execution (convenience for setting config.parallel_tool_execution).
Sourcepub fn usage_limits(self, limits: UsageLimits) -> Self
pub fn usage_limits(self, limits: UsageLimits) -> Self
Set usage limits for the loop (token budgets, request/tool call caps).
Sourcepub fn hook<H: ObservabilityHook + 'static>(self, hook: H) -> Self
pub fn hook<H: ObservabilityHook + 'static>(self, hook: H) -> Self
Add an observability hook.
Sourcepub fn durability<D: DurableContext + 'static>(self, durable: D) -> Self
pub fn durability<D: DurableContext + 'static>(self, durable: D) -> Self
Set the durable context for crash-recoverable execution.
Auto Trait Implementations§
impl<P, C> Freeze for AgentLoopBuilder<P, C>
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>
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> 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
Mutably borrows from an owned value. Read more