Skip to main content

Type Alias: ToolFailMode

ToolFailMode = "returnToAI" | "returnToUser" | "throw"

Defined in: packages/core/src/types.ts:459

Controls what happens when a tool call fails during execution.

  • 'returnToAI' (default): Error becomes the tool's return value. The LLM continues and can retry/adapt.
  • 'returnToUser': Error becomes the tool result, then one more LLM call with toolChoice: 'none' — forces a text response about the error.
  • 'throw': Error is re-thrown from executeTools, breaking the tool loop entirely. Caller must catch.