Ship Your First Sandbox Agent Payment in 5 Minutes
Follow this guide to create a scoped execution token, run a sandbox payment, and inspect the SpendGuard control-plane evidence.
1. Install the SDK
npm install @spendguard/sdk
2. Mint a short-lived execution token
Use your management credential only in trusted backend setup code. Agent tools should receive a short-lived token scoped to one agent, mandate, action, and audience.
import { SpendGuardClient } from '@spendguard/sdk';
const management = new SpendGuardClient({ apiKey: process.env.SPENDGUARD_MANAGEMENT_KEY });
const capability = await management.mintExecutionToken('agt_procurement_01', {
mandate_id: 'mdt_sandbox_01',
action: 'payment:execute',
audience: 'spendguard-payments',
ttl_seconds: 300,
});
const management = new SpendGuardClient({ apiKey: process.env.SPENDGUARD_MANAGEMENT_KEY });
const capability = await management.mintExecutionToken('agt_procurement_01', {
mandate_id: 'mdt_sandbox_01',
action: 'payment:execute',
audience: 'spendguard-payments',
ttl_seconds: 300,
});
3. Execute a sandbox payment
Run the agent payment with the execution token. The request still passes through mandate limits, risk checks, SpendGuard reservation/capture, wallet controls, and audit evidence.
const agentSpend = new SpendGuardClient({ apiKey: capability.executionToken });
const payment = await agentSpend.executePayment({
mandate_id: 'mdt_sandbox_01',
amount: 4900,
currency: 'usd',
merchant: 'sandbox-demo',
description: 'Sandbox purchase',
idempotency_key: crypto.randomUUID(),
});
const payment = await agentSpend.executePayment({
mandate_id: 'mdt_sandbox_01',
amount: 4900,
currency: 'usd',
merchant: 'sandbox-demo',
description: 'Sandbox purchase',
idempotency_key: crypto.randomUUID(),
});
4. Inspect SpendGuard evidence
Use the sandbox dashboards to review payment spend, token spend, tool spend, reservations, denials, and child-agent budget leases before production-preview access is approved.
/dashboard/usage
/dashboard/reservations
/dashboard/denials
/dashboard/budget-leases
/dashboard/reservations
/dashboard/denials
/dashboard/budget-leases