"run", "deny" or "defer".
OptionalargumentsWith run only: the arguments to run the call with, replacing the model's. The transcript keeps the model's own; the result's toolCalls summary records these.
OptionalreasonWith deny, required: what the model is told, as an error tool result, about why the call was refused.
Return shape for
onToolCall:{action: "run"}runs the call (withargumentsto run it with different arguments than the model wrote),{action: "deny", reason}refuses it and the model is shown the reason as an error result,{action: "defer"}leaves it unanswered so the call ends withoutcome: "STOPPED_BY_HOOK"and lists it underdeferredfor a laterresume. Returning nothing runs the call as requested.B.ai.streamingAgenthonoursrunanddenyand refusesdefer: a live audio session has noresumeto answer a deferred call with, so the turn ends there with an error saying so.Example: ```javascript onToolCall: (call) => { if (call.name === "archive_note") { return { action: "defer" }; } if (call.name === "delete_entry") { return { action: "deny", reason: "not permitted here" }; } return { action: "run", arguments: { ...call.arguments, source: "intake-agent" } }; }, ```