pub struct LoopDetectionConfig {
pub threshold: u32,
pub action: LoopAction,
}Expand description
Configuration for detecting repeated tool calls (stuck agents).
When an agent repeatedly makes the same tool call with identical arguments, it’s usually stuck in a loop. This configuration detects that pattern and takes action to break the cycle.
§Example
use llm_stack::tool::{LoopDetectionConfig, LoopAction};
let config = LoopDetectionConfig {
threshold: 3, // Trigger after 3 consecutive identical calls
action: LoopAction::InjectWarning, // Tell the agent it's looping
};Fields§
§threshold: u32Number of consecutive identical tool calls before triggering.
A tool call is “identical” if it has the same name and arguments (compared via JSON equality). Default: 3.
action: LoopActionAction to take when a loop is detected.
Trait Implementations§
Source§impl Clone for LoopDetectionConfig
impl Clone for LoopDetectionConfig
Source§fn clone(&self) -> LoopDetectionConfig
fn clone(&self) -> LoopDetectionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LoopDetectionConfig
impl Debug for LoopDetectionConfig
Source§impl Default for LoopDetectionConfig
impl Default for LoopDetectionConfig
impl Copy for LoopDetectionConfig
Auto Trait Implementations§
impl Freeze for LoopDetectionConfig
impl RefUnwindSafe for LoopDetectionConfig
impl Send for LoopDetectionConfig
impl Sync for LoopDetectionConfig
impl Unpin for LoopDetectionConfig
impl UnwindSafe for LoopDetectionConfig
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