Skip to main content

Interface: LoopConfig<TResult, TCustomState>

Defined in: packages/core/src/patterns/loop.ts:79

Configuration for Loop

Type Parameters

TResult

TResult = unknown

TCustomState

TCustomState extends Record<string, unknown> = Record<string, unknown>

Properties

condition

condition: LoopCondition<TResult>

Defined in: packages/core/src/patterns/loop.ts:81

Condition to continue looping (returns true to keep going)


maxDuration?

optional maxDuration?: number

Defined in: packages/core/src/patterns/loop.ts:85

Optional time limit in milliseconds (only used when maxIterations is Infinity)


maxIterations

maxIterations: number

Defined in: packages/core/src/patterns/loop.ts:83

Maximum number of iterations (use Infinity for unbounded loops)


onIteration?

optional onIteration?: IterationHandler<TCustomState>

Defined in: packages/core/src/patterns/loop.ts:93

Called after each iteration (runs after type-specific handlers)


onMessage?

optional onMessage?: (result, ctx) => void | Promise<void>

Defined in: packages/core/src/patterns/loop.ts:89

Parameters

result

TResult

ctx

LoopContext<TCustomState>

Returns

void | Promise<void>


onReasoning?

optional onReasoning?: (result, ctx) => void | Promise<void>

Defined in: packages/core/src/patterns/loop.ts:90

Parameters

result

TResult

ctx

LoopContext<TCustomState>

Returns

void | Promise<void>


onToolCall?

optional onToolCall?: (result, ctx) => void | Promise<void>

Defined in: packages/core/src/patterns/loop.ts:88

Response type handlers - called based on bot response type

Parameters

result

TResult

ctx

LoopContext<TCustomState>

Returns

void | Promise<void>


typeField?

optional typeField?: string

Defined in: packages/core/src/patterns/loop.ts:96

Field name to check for response type (default: 'type')


verbose?

optional verbose?: boolean

Defined in: packages/core/src/patterns/loop.ts:99

Enable verbose logging