Integrations

Add the check to the loop you already have.

Aprve is one HTTP call. Every framework below needs the same schema and the same rule: act only on allow, and treat an unreachable oracle as deny.

01 — compatible

Works with the stack you have.

Nothing here is a plugin that must be installed. Each row is a shape around the same POST.

OpenAI function calling

The tool definition above, unchanged.

Anthropic tool use

Same JSON schema, as an input_schema on the tool.

LangChain / LangGraph

@tool wrapper around the client, decision checked by the graph.

Vercel AI SDK

tool() with an execute that fails closed on a non-200.

CrewAI

A guardrail function that returns False unless the decision is allow.

MCP

Expose the schema as a tool on your server; the model calls it before acting.

Temporal / Inngest

The check is the first activity; a deny ends the workflow.

Plain HTTP

One POST. No SDK, no dependency, no build step.

02 — add to my agent

Pick your framework, paste the block.

Each snippet is complete. The only thing missing is your key, which the client reads from APRVE_KEY.

openai function calling
const tools = [{
  type: "function",
  function: {
    name: "aprve_authorize",
    description: "Ask Aprve whether this action is authorized. Call before any side effect. Deny if the result is not allow.",
    parameters: {
      type: "object",
      required: ["agent_id", "action"],
      properties: {
        agent_id: { type: "string" },
        action: {
          type: "object",
          required: ["tool"],
          properties: {
            tool: { type: "string" },
            amount_usd: { type: "number" },
            data_classes: { type: "array", items: { type: "string" } },
            target: { type: "string" }
          }
        }
      }
    }
  }
}];
mcp tool schema
{
  "name": "aprve_authorize",
  "description": "Ask Aprve for an allow or deny decision before an agent acts. Returns the decision, the rule, and the record hash.",
  "inputSchema": {
    "type": "object",
    "required": ["agent_id", "action"],
    "properties": {
      "agent_id": { "type": "string" },
      "action": {
        "type": "object",
        "required": ["tool"],
        "properties": {
          "tool": { "type": "string" },
          "amount_usd": { "type": "number" },
          "data_classes": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }
}
langchain tool
from langchain_core.tools import tool
from aprve_client import authorize   # copy-paste client, see /docs/sdks

@tool
def aprve_authorize(agent_id: str, tool: str, amount_usd: float = 0) -> dict:
    """Ask Aprve for a decision before acting. Never act on anything but allow."""
    return authorize({
        "agent_id": agent_id,
        "action": {"tool": tool, "amount_usd": amount_usd},
    })
vercel ai sdk
import { generateText, tool } from "ai";
import { z } from "zod";

const aprve = tool({
  description: "Ask Aprve before acting. Deny unless the decision is allow.",
  parameters: z.object({
    agent_id: z.string(),
    tool: z.string(),
    amount_usd: z.number().optional(),
  }),
  execute: async ({ agent_id, tool, amount_usd }) => {
    const res = await fetch("https://aprve-trust.base44.app/api/v1/authorize", {
      method: "POST",
      headers: {
        authorization: `Bearer ${process.env.APRVE_KEY}`,
        "content-type": "application/json",
      },
      body: JSON.stringify({ agent_id, action: { tool, amount_usd } }),
    });
    if (!res.ok) return { decision: "deny", fail_closed: true };
    return res.json();
  },
});

Webhook signatures

Events we send carry X-Aprve-Signature in the same form we accept on requests. Compare in constant time and reject anything older than five minutes.

verify an inbound event
// Verify a webhook we send you. The signature covers the raw body.
import crypto from "node:crypto";

function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${parts.t}.${rawBody}`)
    .digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}

Show the current automation rate on your own site with the badge. It reads the same public metrics endpoint and never invents a number.

<img src="https://aprve-trust.base44.app/badge.svg" alt="Secured by Aprve" />