Optional predicate controlling whether to interrupt for a given tool call.
Receives a ToolCallRequest and returns True to interrupt or False to
auto-approve. Works in both "batch" and "per_call" modes.
In "batch" mode the request is constructed with tool=None and
runtime set to the node-level Runtime (not a ToolRuntime), so
request.runtime.tool_call_id and request.runtime.tools are not available.
In "per_call" mode the full ToolCallRequest from wrap_tool_call is passed.
Example:
# Only interrupt delete_file calls targeting /etc
config = InterruptOnConfig(
allowed_decisions=["approve", "reject"],
when=lambda req: req.tool_call["args"].get("path", "").startswith("/etc"),
)