ToolFence
Docs Pricing Suite Open Gate

ToolFence Gate SDKs

Libraries so agents can gate tool calls against a running ToolFence Gate server.

Quick path: developers.md · HTTP contract: api.md

Python

Install (agent apps)

pip install toolfence

Install (server + Inbox UI)

pip install "toolfence[server]"
toolfence-server
# open http://127.0.0.1:8000/

Protect a tool

from toolfence import protected_tool

@protected_tool(
    risk="high",
    backend_url="http://127.0.0.1:8000",
    api_key="YOUR_SERVICE_KEY",  # if auth is enabled
    agent_id="billing-agent",
)
def send_refund(customer_id: str, amount: float) -> dict:
    ...

When the agent calls send_refund, ToolFence Gate evaluates policy, waits for Inbox approval if required, then runs the function.

If the operator uses Respond in Inbox, the decorator returns the human’s text and does not execute the function. Denials may include a structured reject_reason_code (see security.md).

HTTP client (no decorator)

from toolfence import ToolFenceClient, ToolCallRequest, RiskLevel

with ToolFenceClient("http://127.0.0.1:8000", api_key="...") as client:
    clearance = client.gate(
        ToolCallRequest(
            tool_name="send_refund",
            arguments={"customer_id": "c1", "amount": 20},
            risk=RiskLevel.HIGH,
            agent_id="billing-agent",
        )
    )
    # use clearance.arguments (may be edited), then complete after exec

Framework helpers

Wrappers are available for LangChain, CrewAI, OpenAI Agents, and LangGraph via the Python package integrations.


TypeScript / Node

Install

npm install toolfence

Gate a tool call

import { ToolFenceClient, protectedTool } from "toolfence";

const client = new ToolFenceClient({
  baseUrl: "http://127.0.0.1:8000",
  apiKey: process.env.TOOLFENCE_API_KEY, // or ACTIONGATE_API_KEY
});

const sendRefund = protectedTool(
  async (customerId: string, amount: number) => {
    return { status: "refunded", customerId, amount };
  },
  {
    client,
    toolName: "send_refund",
    risk: "high",
    agentId: "billing-agent",
    mapArgs: (customerId, amount) => ({ customer_id: customerId, amount }),
  },
);

await sendRefund("cust_42", 49.99);

What you need

Piece Who How
ToolFence Gate server + UI Operator pip install "toolfence[server]" → toolfence-server
Python SDK Developer pip install toolfence
TypeScript SDK Developer npm install toolfence
API key Operator Settings → Rotate API key

Agents call the SDK; humans clear calls in the Inbox.

ToolFence docs Marketing · Login