function untilFinishReason(stopReasons): AgentLoopStrategy;Defined in: packages/ai/src/activities/chat/agent-loop-strategies.ts:47
Creates a strategy that continues until a specific finish reason is encountered
string[]
Finish reasons that should stop the loop
AgentLoopStrategy that stops on specific finish reasons
const stream = chat({
adapter: openaiText("gpt-6.1-sol"),
threadId: "thread-1",
messages: [...],
tools: [weatherTool],
agentLoopStrategy: untilFinishReason(["stop", "length"]),
});