Skip to content

TerminationReason

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Iterative

TerminationReason Enum

Describes why an IIterativeAgentLoop run terminated.

public enum TerminationReason

Fields

Completed 0

The IsComplete predicate returned true after an iteration — the agent achieved its goal.

NaturalCompletion 1

The model produced a text response without requesting tool calls, signaling natural completion of the task.

MaxIterationsReached 2

The loop exhausted MaxIterations without the IsComplete predicate returning true.

MaxToolCallsReached 3

The cumulative tool call count across all iterations exceeded MaxTotalToolCalls.

BudgetPressure 4

The ITokenBudgetTracker reported usage above the budget pressure threshold, and the loop ran one final finalization iteration before terminating.

Cancelled 5

The loop was cancelled via System.Threading.CancellationToken.

Error 6

An unrecoverable error occurred (prompt factory failure, LLM exception, etc.).