paybondpaybond
Sign in

Recipe · Commerce

Let agents buy groceries—without unbounded checkout spend

Multi-tool shopping agent with the shopping preset — search products, spend-guarded checkout, and automatic evidence for agent commerce.

  1. 1Wire
  2. 2Authorize
  3. 3Smoke

You'll build

A shopping checkout smoke with spend limits and verified completion

A grocery-shopping agent needs two tool classes: read-only search and a side-effecting checkout that moves money. Paybond's shopping preset registers both, caps checkout spend, and requires evidence after a successful order.

Policy reference: /docs/kit/agent-policy.

  • shopping policy preset

    search.products (read-only) plus capped commerce.checkout with required evidence.

  • spend verify before checkout

    Side-effecting checkout authorizes operation and amount before money moves.

  • Auto-evidence

    Middleware submits cost_and_completion digests after a successful order.

  • TypeScript and Python

    Wire with generic instrument() in both Kit languages, or a framework adapter when available.

Why Paybond (not just merchant checkout)?

Merchant checkout APIs move money. They do not enforce a per-agent spend limit, a per-operation permission check (capability token), or a signed completion receipt tied to a spend agreement (intent).

Unguarded agent checkout versus Paybond shopping preset controls
  • Product search

    Checkout alone
    Yes — agent calls search freely
    With Paybond
    Yes — read-only search.products passes through
  • Checkout spend limits

    Checkout alone
    Merchant / card rules only
    With Paybond
    Per-call and intent budgets on commerce.checkout
  • Signed evidence

    Checkout alone
    Order logs / emails only
    With Paybond
    Signed cost_and_completion digests bound to the intent
  • Multi-tool middleware

    Checkout alone
    Hand-rolled evidence per tool
    With Paybond
    paybond.instrument() auto-evidence on checkout
  • Intent binding

    Checkout alone
    No Harbor intent or settlement receipt
    With Paybond
    Capability token + intentId from authenticated bind

How it works

Shopping agents search freely, then Paybond guards checkout: Harbor authorize before spend, then auto-evidence after the order.

Task flow

  1. search.products

    Read-only catalog lookup — no spend guard

  2. commerce.checkout

    Agent requests a paid order

  3. Paybond guard

    Harbor authorize against the shopping preset

    • Verify spend and operation
    • Deny or HITL hold
    • Issue / check capability
  4. Evidence

    Auto-evidence with cost_and_completion

Shopping agents search freely, then Paybond guards checkout: Harbor authorize before spend, then auto-evidence after the order.

3-minute quickstart

Smoke the shopping preset sandbox contract — no merchant credentials required for this check:

Terminal
Terminal commandSwipe to inspect long lines
paybond login
paybond agent sandbox smoke \
  --preset shopping \
  --operation commerce.checkout \
  --requested-spend-cents 2500 \
  --evidence-preset cost_and_completion \
  --result-body '{"status":"completed","cost_cents":2500,"order_id":"ord_smoke"}' \
  --format table

When the smoke succeeds you should see:

  • ✓ Spend approved
  • ✓ Checkout completed
  • ✓ Evidence verified (cost_and_completion)

What success looks like

Example status after a Paybond-guarded shopping agents tool call: approved spend, requested amount, and verified cost_and_completion evidence.

What success looks like

Authorized checkout · illustrative

Sandbox path
Operation
commerce.checkout
Status
Approved
Requested
$25.00
Evidence
Verified
Preset
cost_and_completion

Scaffold

Terminal
Terminal commandSwipe to inspect long lines
paybond init --solution shopping --max-spend-usd 100 --framework generic --non-interactive
paybond policy init --preset shopping --out paybond.policy.yaml
paybond policy presets show shopping

Bundled defaults:

ToolSide effectingCap
commerce.checkoutYes$100 per call / $100 intent budget
search.productsNo

Wire middleware

Multi-tool wiring

Register search and checkout together so Harbor guards only the side-effecting path.

paybond-session.ts

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 } = await paybond.agent({
  policy: "shopping",
  tools: {
    "commerce.checkout": checkout,
    "search.products": searchProducts,
  },
});

// Orchestrator loop:
// 1. Model calls search.products → executes without spend guard
// 2. Model calls commerce.checkout → spend verify → execute → auto-evidence

Framework-specific paths

StackGuide
Vercel AI and Next.jsNext.js agent checkout
OpenAI Agents SDKOpenAI Agents spend controls
LangGraphLangGraph spend controls
MCP coding agentMCP agent spend controls
MastraMastra spend controls
Cloudflare AgentsCloudflare Agents spend controls

Customize the preset

Terminal
Terminal commandSwipe to inspect long lines
paybond policy init --preset shopping --max-spend 250 --out paybond.policy.yaml
paybond policy validate-tools --file paybond.policy.yaml --local-only

Visual trace

After smoke, open the local trace dashboard (same project directory):

Terminal
Terminal commandSwipe to inspect long lines
paybond dev trace

The UI renders a vertical timeline at http://127.0.0.1:9477 using events from .paybond/dev-trace.jsonl. Hosted replay: /demo/agent-trace.

Production checklist

Production checklist for Paybond shopping agent checkout.

Works with

Works with

  • Vercel
  • OpenAI
  • LangGraph
  • MCP

Ready to test?

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