Open Agent Loops
API Reference

maxSteps

@open-agent-loops/core


function maxSteps(n): StopCondition;

Defined in: stop/conditions.ts:28

Build a condition that stops once step reaches n turns.

Parameters

ParameterTypeDescription
nnumberThe turn count at which to stop (uses the 1-based ctx.step).

Returns

StopCondition

A StopCondition that fires when ctx.step >= n.

Example

// Stop after at most 5 model turns.
const stop = maxSteps(5);

See

StopCondition

On this page