Developer quickstart
Get from zero to a gated tool call in about ten minutes.
Two paths (same as peers like HITL / gotoHuman):
| Path | Do this |
|---|---|
| Agent-assisted | Open Inbox → Get started → Copy setup for Claude Code (includes base URL). Paste into Claude Code / Cursor. Details: Agent setup. |
| DIY | Follow the steps below — run Gate, wrap a tool, clear in Inbox. |
What you’re building
Agent / SDK / MCP
│
▼
POST /v1/evaluate → policy: allow | require_approval | deny
│
├─ allow → run tool, then optional /complete
├─ deny → stop (fail closed)
└─ pause → human clears in Inbox → /decide → agent /complete with fingerprint
Humans decide in the Inbox. Agents never skip the bound fingerprint.
1. Run ToolFence Gate
pip install "toolfence[server]"
toolfence-server
# → http://127.0.0.1:8000/
Open / for the Inbox. On hosted (app.toolfence.ai), create a Free account (forever, capped) or sign in. Locally: create an account under Team, or sign in if you already have one.
Install with pip install toolfence / npm install toolfence.
2. Protect a tool (Python)
pip install toolfence
from toolfence import protected_tool
@protected_tool(
risk="high",
backend_url="http://127.0.0.1:8000",
api_key="YOUR_KEY", # Settings → Rotate API key when auth is on
agent_id="billing-agent",
)
def send_refund(customer_id: str, amount: float) -> dict:
return {"status": "refunded", "customer_id": customer_id, "amount": amount}
send_refund("cust_42", 49.99) # pauses until Inbox Approves
TypeScript: npm install toolfence — see SDK.
3. Clear the call in Inbox
- Open http://127.0.0.1:8000/
- Select the pending item
- Approve, Edit args then approve, Deny, or Respond (answer as the tool — no execute)
- The agent resumes; only the bound arguments can complete
4. Prove binding
See the bake-off demo: evaluate → fingerprint → wrong fingerprint rejected → complete.
5. Configure policy
In the UI under Rules:
| Control | Effect |
|---|---|
| Risk levels | Default allow / pause / deny |
| Allow / deny lists | Tool names and tags |
| Per-tool overrides | Force decision for one tool |
| Routing | Assignee by tag / risk / agent |
| MCP gateway | Catalog for coding agents |
Use Try before you ship to dry-run a call without creating an approval.
Auth for agents
| Header | When |
|---|---|
Authorization: Bearer <session> |
Logged-in operator |
X-API-Key: <key> |
Service / agent key from Settings → Rotate API key |
Set TOOLFENCE_REQUIRE_AUTH=1 to require auth on all /v1/* routes.
Next reads
| Doc | Why |
|---|---|
| Scan then Gate | Free Scan → emit rules → import → enforce |
| SDK | Decorator, HTTP client, framework wrappers |
| API reference | evaluate → decide → complete contract |
| MCP | Claude Code / MCP |
| Channels | Human clearance — Inbox / Slack / email / webhooks |
| Bake-off | Prove fingerprint binding |
| SaaS | Free / Pro / Business + Radar |
| Security | Fingerprints, fail-closed, reject codes |
Common mistakes
- Completing with a different fingerprint than decide →
409 - Assuming timeout auto-approves → it denies (fail closed)
- Putting human review only inside one agent loop → other clients can bypass it; gate at ToolFence Gate instead