Skip to main content

Overview

The Tool Policy Hooks endpoint lets you enforce your organization’s tool policies on agent tool calls. Before your agent executes a tool — whether it’s a terminal command, an MCP tool, or any other action — your agent sends an inbound request to this endpoint and the gateway returns a decision. This is a request the agent makes to Unbound; Unbound does not call out to your agent. Any agent framework or custom application can integrate with it. Policies are configured at gateway.getunbound.ai/policies/tool-policies.

Endpoint

Authentication

Include your API key in the Authorization header:

Request Body

pre_tool_use_data Object

Response

Decision Values

Checking approval status

When a tool call comes back as approval_required, an approver has been asked to allow or deny it in Slack. Hold the call and poll this endpoint until they answer.
Authenticate exactly as you do for the hook itself — Authorization: Bearer <UNBOUND_API_KEY>.

Request

Send back both values you were given in approvalCheck — the requestId and the policyIds:

Response

pending is the safe default. If the request can’t be resolved — a missing requestId, or a transient failure — the endpoint answers pending rather than guessing, so a held tool call is never released by accident.That means pending is not self-terminating. Decide your own limit — a maximum number of polls, or a deadline — and choose what happens when you hit it. Treating a timeout as deny fails closed; treating it as allow fails open. Pick the one that matches your security posture, and surface the wait to your user so the agent doesn’t just look hung.

How It Works

The endpoint handles two types of tools differently: Terminal commands (Bash, Shell, exec): The command is automatically classified and matched against your configured terminal command policies. MCP tools: The mcp_server and mcp_tool from metadata are matched against your MCP tool policies. Other tools: Tools that don’t match a terminal command or MCP tool pattern return allow.

Examples

Terminal Command (Blocked)

Response:

Terminal Command (Allowed)

Response:

MCP Tool

Response (depends on your configured policies):

Error responses

The endpoint returns 200 OK with decision: "allow" for requests that are malformed or unauthenticated — a fail-open posture. The response carries the decision and nothing else: policy_check_failure_action is absent, not set to a default.
When policy evaluation itself fails, the endpoint returns 503:
A 503 does carry policy_check_failure_action, taken from your organization’s configuration. Use it. The field is omitted only when the gateway could not resolve your configuration at all — in that case fall back to the last value you cached from a successful response. If your client needs fail-closed behavior, gate it locally before calling the endpoint (validate the request body, confirm the API key is present) rather than relying on the gateway to reject.
Treat an absent policy_check_failure_action as “no new information”, never as a value. The 200 OK fail-open response omits the field entirely — it does not carry a default. A client that reads the omission as fail-open (for example, right after an API-key rotation) would silently apply fail-open behaviour on a fail-closed org. Keep the last value you received as authoritative, and never infer one from its absence.
This is the current behaviour, not an aspirational contract. Two more things worth knowing:/approval-status is fail-closed: a missing or invalid API key returns 401, the opposite of /pretool. The “pending is the safe default” guidance applies only after authentication succeeds.Ignore response fields you don’t recognise — new ones are added over time, the same rule that already applies to unknown decision values.

Integration Guide

To integrate tool policies into your agent framework:
  1. Before each tool execution, send a POST request to /v1/hooks/pretool with the tool details
  2. Check the decision in the response:
    • allow — execute the tool normally
    • deny — block execution and surface the reason to the user
    • ask — prompt the user for confirmation, or treat as allow if your agent has no interactive UI
    • approval_required — do not execute. Hold the call and poll the approval-status endpoint until the approver decides. See the full contract in Decision Values
  3. Treat an unrecognized decision as deny. New decision values can be added over time; a client that falls through to “execute” on a value it doesn’t know can bypass a guardrail. Default the unknown case to blocking, not allowing
  4. Handle errors gracefully — if the endpoint is unreachable, decide whether to fail open (allow) or fail closed (deny) based on your security requirements
  5. Configure policies at gateway.getunbound.ai/policies/tool-policies