paybondpaybond
Sign in

Agent-agnostic spend controls

Guard any { name, execute } tool surface — Claude tool-use, Gemini function calls, custom orchestrators — with createPaybondGenericAgentConfig and paybond.instrument().

Paybond's recommended default when you have no agent framework SDK — or when you call Claude/Gemini tool-use, a queue worker, or a custom orchestrator directly. One paybond.instrument() call wraps { name, execute } tools with full middleware.

Default when no framework SDK

Skip framework: on instrument() unless you need a native adapter (Vercel AI, LangGraph, OpenAI Agents, Claude Agents). Generic is the right choice for most custom runtimes.

Try it

terminal

Terminal commandSwipe to inspect long lines
paybond login
paybond agent demo generic smoke \
  --operation paid-tool \
  --requested-spend-cents 100 \
  --evidence-preset cost_and_completion \
  --format table

Scaffold

Terminal
Terminal commandSwipe to inspect long lines
paybond init agent-middleware --framework generic --out paybond-agent.ts
paybond policy init --preset travel --out paybond.policy.yaml

paybond-session.ts

Code exampleSwipe to inspect long lines
import { Paybond } from "@paybond/kit";

const paybond = await Paybond.open({ apiKey: process.env.PAYBOND_API_KEY! });

const { tools, run } = await paybond.agent({
  policy: "travel",
  tools: {
    "travel.book_hotel": bookHotel,
    searchWeb: searchWeb,
  },
});

// Your orchestrator calls tools with PaybondGenericToolCall envelopes:
const bookHotelTool = tools.find((t) => t.name === "travel.book_hotel")!;
const result = await bookHotelTool.execute({
  toolName: "travel.book_hotel",
  toolCallId: "call-1",
  arguments: { city: "Lisbon", estimatedPriceCents: 18_700 },
});

Claude / Gemini tool-use without a framework SDK

Map model function calls to Paybond-wrapped handlers:

  1. Parse the model's tool call (name + arguments + call id).
  2. Find the matching entry in instrumented.tools.
  3. Call execute with the Paybond envelope — authorization and evidence run automatically.

For the Claude Agent SDK specifically, use the Claude Agents adapter guide.

Production bind

const instrumented = await paybond.instrument({
  policy: "./paybond.policy.yaml",
  tools: { /* ... */ },
});
const runtime = await instrumented.bind({ intentId, capabilityToken });
// runtime.tools → pass to your orchestrator

Lazy binding for request-scoped sessions: pass context: () => activeRequest.paybond on instrument().

Developer reference: /docs/kit/agent-agnostic.