Skip to main content

Type Alias: ToolFailMode

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

Defined in: packages/core/src/adapters/ai-sdk/tool-adapter.ts:121

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 the tool's execute; AI SDK reports it to the model as a tool error (error-text) and the loop continues.