Skip to content

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

TOOLS extends ToolSet

RUNTIME_CONTEXT extends Context = Context

StepResult<TOOLS, RUNTIME_CONTEXT>[]

PromiseLike<boolean> | boolean