OpenResponses.ToolPolicy
(OpenResponses v0.1.1)
View Source
Validates model-emitted tool calls against tool_choice and allowed_tools.
Called by the agentic loop before dispatching any function call. Returns
:ok when the call is permitted, or an error that causes the loop to
re-sample with an error message instead of executing the tool.
Enforcement rules
tool_choice | Behaviour |
|---|---|
"none" | All tool calls rejected |
%{"type" => "function", "function" => %{"name" => n}} | Only that function is allowed |
"auto" / "required" / nil | Allowed — subject to allowed_tools |
If allowed_tools is a non-empty list, the called tool name must be in
that list regardless of tool_choice.