Open History to see the last commit
Function: maxIterations()#
function maxIterations(max): AgentLoopStrategy;
Defined in: packages/typescript/ai/src/activities/chat/agent-loop-strategies.ts:20
Creates a strategy that continues for a maximum number of iterations
Parameters#
max#
number
Maximum number of iterations to allow
Returns#
AgentLoopStrategy that stops after max iterations
Example#
const stream = chat({
adapter: openaiText(),
model: "gpt-4o",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: maxIterations(3), // Max 3 iterations
});