Skip to content

Approve by rule

A policy decides call by call. For example: refunds of $25 or less run at once, refunds up to $200 go to the support queue, and larger ones go to finance.

A policy is an Apex class that a developer writes. It implements IToolAuthorizationPolicy. See the extension contract.

  1. Ask your developer for the policy class and which tools it covers.
  2. On the agent, pick the class in Tool Authorization Policy Class.
  3. On each tool the policy covers, set Approver Type and leave Always Require Approval unchecked.

Core asks the policy about every tool call, before it runs.

DecisionWhat happens
AllowThe call runs, unless the tool has Always Require Approval checked.
DenyThe call does not run. The agent gets TOOL_AUTHORIZATION_DENIED with the policy’s reason and continues.
Require ApprovalThe call waits for approval. The policy gives the reason, and may set a different deadline (1 minute to 7 days) or a different approver, such as a finance queue for large amounts.

A policy can only narrow what the agent may do. It cannot skip a permission check, and it cannot approve a call.

Error codeCauseFix
TOOL_AUTHORIZATION_POLICY_INVALIDThe policy asked for approval with no reason, or a deadline out of range.Ask the developer to fix the class, then rescue the run.
APPROVAL_ASSIGNMENT_UNRESOLVEDNeither the policy nor the tool named anyone who may approve.Set Approver Type on the tool, then rescue the run.
INITIATING_USER_APPROVAL_UNSUPPORTEDThe policy asked for approval on an agent without an identity.Give the agent an identity, or change the policy to allow or deny.

Pluto is licensed under the GNU Affero General Public License, version 3 only.