StopCondition
StopCondition<
TOOLS,RUNTIME_CONTEXT> = (options) =>PromiseLike<boolean> |boolean
Defined in: node_modules/.bun/ai@7.0.127+bca6845d7a0cc15a/node_modules/ai/dist/index.d.ts:1948
A predicate that decides whether a tool-calling loop should stop after the current step.
A tool calling loop continues until one of the following conditions is met:
- The model returns a finish reason other than
tool-calls - A tool without an execute function is called
- A tool call needs approval
- One of the provided stop conditions returns
true
Type Parameters
Section titled “Type Parameters”TOOLS extends ToolSet
RUNTIME_CONTEXT
Section titled “RUNTIME_CONTEXT”RUNTIME_CONTEXT extends Context = Context
Parameters
Section titled “Parameters”options
Section titled “options”StepResult<TOOLS, RUNTIME_CONTEXT>[]
Returns
Section titled “Returns”PromiseLike<boolean> | boolean