function maxIterations(max): AgentLoopStrategy;
function maxIterations(max): AgentLoopStrategy;
Defined in: utilities/agent-loop-strategies.ts:20
Creates a strategy that continues for a maximum number of iterations
number
Maximum number of iterations to allow
AgentLoopStrategy that stops after max iterations
const stream = chat({
adapter: openai(),
model: "gpt-4o",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: maxIterations(3), // Max 3 iterations
});
const stream = chat({
adapter: openai(),
model: "gpt-4o",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: maxIterations(3), // Max 3 iterations
});
