本页还没有译文
本页 11 段还没译成Português (BR),下面显示的是英文原文。AgentLoopStrategy
还没翻译译自英文(tanstack.com)本页 11 段都还没译
type AgentLoopStrategy = (state) => boolean;Defined in: packages/ai/src/types.ts:1234
Strategy function that determines whether the agent loop should continue
Parameters
state
Current state of the agent loop
Returns
boolean
true to continue looping, false to stop
Example
// Continue for up to 5 iterations (model turns, not tool calls)
const strategy: AgentLoopStrategy = ({ iterationCount }) => iterationCount < 5;
// Cap total tool calls across the run (or use middleware onShouldContinue)
const byTools: AgentLoopStrategy = ({ toolCallCount }) => toolCallCount < 20;AI 翻译查看英文原文