pub struct AgentLoopHarness<M, R> { /* private fields */ }Implementations§
Source§impl<M, R: ToolRuntime> AgentLoopHarness<M, R>
impl<M, R: ToolRuntime> AgentLoopHarness<M, R>
pub fn new(model: M, tools: R) -> Self
Sourcepub fn with_max_steps(self, max_steps: usize) -> Self
pub fn with_max_steps(self, max_steps: usize) -> Self
Cap the number of LLM steps per turn. 0 means unlimited — the
loop only ends when the model stops calling tools (or on
cancel/error), so callers passing 0 should keep their own
liveness backstop (idle/wall-clock) around the turn.
Sourcepub fn with_compaction(self, policy: CompactionPolicy) -> Self
pub fn with_compaction(self, policy: CompactionPolicy) -> Self
Attach a compaction policy. The loop will call
policy.strategy.should_compact before every step and run
policy.strategy.compact when it fires. Without a policy
installed the loop never compacts — fine for short / test
conversations, fatal for long production sessions.
Sourcepub fn with_tool_choice(self, choice: ToolChoice) -> Self
pub fn with_tool_choice(self, choice: ToolChoice) -> Self
Constrain how the model selects tools this turn.
Defaults to Auto. See ToolChoice for variants.
Sourcepub fn with_parallel_tool_calls(self, parallel: Option<bool>) -> Self
pub fn with_parallel_tool_calls(self, parallel: Option<bool>) -> Self
OpenAI-only: whether the model may emit multiple tool_use
blocks in one response. None ⇒ provider default (true on
OpenAI). Ignored by Anthropic (multi tool_use is implicit).
Sourcepub fn with_stream_resilience(
self,
idle_timeout: Duration,
max_attempts: u32,
) -> Self
pub fn with_stream_resilience( self, idle_timeout: Duration, max_attempts: u32, ) -> Self
Override mid-stream resilience knobs. idle_timeout is how long a step
waits for the next model chunk before declaring a stall;
max_attempts is the stream-layer reconnect budget (total stream
attempts, so max_attempts = 1 disables reconnection). Primarily for
tests, which inject a sub-second timeout so a stall surfaces fast
instead of after the 90s production default.
Trait Implementations§
Source§impl<M: Clone, R: Clone> Clone for AgentLoopHarness<M, R>
impl<M: Clone, R: Clone> Clone for AgentLoopHarness<M, R>
Source§fn clone(&self) -> AgentLoopHarness<M, R>
fn clone(&self) -> AgentLoopHarness<M, R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more