Skip to contents

Set approval callback for human-in-the-loop tool execution

Usage

set_approval_callback(agent, callback_fn)

Arguments

agent

An agent object

callback_fn

A function that takes tool information and returns TRUE/FALSE for approval

Value

The modified agent (invisibly)

Details

The callback function receives a list with the following elements:

  • name: The name of the tool being called

  • arguments: A list of arguments passed to the tool

  • id: The unique identifier for this tool call

The callback should return:

  • TRUE to approve the tool execution

  • FALSE to deny the tool execution

  • A character string to deny with a custom error message