Skip to content

StallDetectionOptions

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Iterative

StallDetectionOptions Class

Configuration for iterative loop stall detection.

public sealed class StallDetectionOptions

Inheritance System.Object 🡒 StallDetectionOptions

Remarks

A "stall" is detected when ConsecutiveThreshold consecutive iterations produce total token counts within TolerancePercent of each other. This is a strong signal the LLM is repeating the same work because it has no cross-iteration memory of what it already did.

Properties

StallDetectionOptions.ConsecutiveThreshold Property

The number of consecutive iterations with similar token counts before terminating. Defaults to 3. Minimum 2.

public int ConsecutiveThreshold { get; set; }

Property Value

System.Int32

Exceptions

System.ArgumentOutOfRangeException
Value is less than 2.

StallDetectionOptions.TolerancePercent Property

How close token counts must be (as a fraction of the previous iteration's count) to be considered "similar." Defaults to 0.10 (10%).

public double TolerancePercent { get; set; }

Property Value

System.Double

Exceptions

System.ArgumentOutOfRangeException
Value is negative or ≥ 1.0.

Remarks

A tolerance of 0.10 means iterations with 15,000 and 16,200 tokens are considered similar (8% difference), but 15,000 and 18,000 are not (20%).