Skip to main content

Interface: LoopConfig<TResult, TCustomState>

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

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:86

Condition to continue looping (returns true to keep going)


maxDuration?

optional maxDuration?: number

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

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


maxIterations

maxIterations: number

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

Maximum number of iterations (use Infinity for unbounded loops)


onIteration?

optional onIteration?: IterationHandler<TCustomState>

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

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:94

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:95

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:93

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:104

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

Deprecated

Legacy response-dispatch surface; slated for trim in a future major.


verbose?

optional verbose?: boolean

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

Enable verbose logging