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 gateway currently returns 200 OK with decision: "allow" for requests that are malformed or unauthenticated — a fail-open posture. There is no structured error envelope today.
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.
Only cache policy_check_failure_action from authenticated, policy-evaluated responses — those reflect your organization’s real config. The policy_check_failure_action: "allow" returned in the error response above is a hardcoded fail-open value emitted because the gateway couldn’t evaluate the org’s policies; it does not represent the org’s configured posture. A client that caches the value from an error response (for example, right after an API-key rotation) will silently apply fail-open behavior even on a fail-closed org. Treat the last-known value from a successful authenticated response as authoritative, and refuse to update the cached value from an error-shape response.
This is the current behavior, not an aspirational contract. If you need a structured error response shape, file a request with Unbound support.

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