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
paybond login
paybond agent demo generic smoke \
--operation paid-tool \
--requested-spend-cents 100 \
--evidence-preset cost_and_completion \
--format tableScaffold
terminal
paybond init agent-middleware --framework generic --out paybond-agent.ts
paybond policy init --preset travel --out paybond.policy.yamlRecommended wiring
paybond-session.ts
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:
- Parse the model's tool call (name + arguments + call id).
- Find the matching entry in
instrumented.tools. - Call
executewith 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().
Related guides
- Agent middleware — registry, interceptor, evidence
- Express and Fastify agent routes — HTTP servers wrapping instrument()
- Mastra spend controls — planned adapter; use agent-agnostic today
- Cloudflare Agents spend controls — planned adapter; use agent-agnostic today
- Protect Stripe payments from agents — payment tool example
Developer reference: /docs/kit/agent-agnostic.