Adapters
The gate sits between “the model produced something” and “the user’s phone buzzed”. The adapters put it at the point each framework already reserves for that decision. They are typed against the shape of a call, not against the framework package, so nothing else has to be installed.
Vercel AI SDK
Section titled “Vercel AI SDK”import { gateToolApproval } from "proactive-gate/ai-sdk";const approve = gateToolApproval({ gate, toInput: (call) => call.input.gate });const { approved, reason } = await approve(call); // answer the tool's needsApprovalMastra
Section titled “Mastra”import { gateProcessor } from "proactive-gate/mastra";const agent = new Agent({ ..., outputProcessors: [gateProcessor({ gate, toInput })] });LangChain
Section titled “LangChain”import { gateMiddleware } from "proactive-gate/langchain";OpenAI Agents
Section titled “OpenAI Agents”import { gateGuardrail } from "proactive-gate/openai-agents";Each adapter denies with the gate’s reason and, by default, commits the budget on approval.
Claude Code hook
Section titled “Claude Code hook”{ "hooks": { "PreToolUse": [ { "matcher": "send_message", "hooks": [{ "type": "command", "command": "npx proactive-gate hook --policy policy.json --tool send_message" }] } ] }}The hook reads the PreToolUse event on stdin, evaluates tool_input.gate = { user, candidate }
against the policy, and prints a permissionDecision for the matching tool. Other tools print
nothing.