Capri AgentPay
Give an AI agent its own wallet and a spending budget, then let it pay for things safely — right from VS Code.
Some web APIs charge a tiny fee per request (using the open x402 "HTTP 402 Payment Required" standard). Capri AgentPay lets an AI agent pay those fees automatically, but only within limits you set, and it keeps a signed receipt for every payment.
Try it in 10 seconds
- Install the extension and open the Capri AgentPay panel (wallet icon in the activity bar).
- Click ▶ Run demo.
That's it. The demo creates a test wallet, gives it a budget, starts a local sample store, and pays it $0.05 for a weather forecast — then saves a signed receipt. You can watch the whole thing happen in the sidebar.
Why is it "sandboxed"?
Sandbox = safe test mode. It uses fake test money on a test network (Base Sepolia), so you can try agent payments without spending a cent of real money. Nothing in sandbox mode can touch real funds. This is the default, and it's the recommended way to explore.
When you're ready for real payments, turn off capri-agentpay.simulateSettlement in settings (and, separately, mainnet signing stays disabled until you explicitly opt in — see Important constraints below).
What is implemented
- VS Code extension with wallet creation, budgets, policy enforcement, x402 handling, receipts, and MCP helpers
- Interactive landing/docs/demo app for Capri AgentPay
- Separate Capri AI parent landing page selected by hostname or
?site=capri-ai
- SQLite-backed waitlist endpoint at
/api/waitlist for first-pass submission storage
- Standalone MCP server and local HTTP bridge for SDK access
Important constraints
- Wallet keys are still local EOA keys in sandbox mode. This is not a production custody model.
- Payments still use native ETH on Base Sepolia as a stand-in for real USDC settlement.
- Mainnet signing is disabled unless
CAPRI_AGENTPAY_ALLOW_MAINNET_PAYMENTS=1 is set explicitly.
- The HTTP bridge binds to localhost by default and uses
CAPRI_AGENTPAY_HTTP_TOKEN.
- The waitlist endpoint is suitable for local dev and Node-style deployments. If you deploy fully serverless, move that SQLite persistence to a managed database.
Run the extension
npm install
Open the folder in VS Code and press F5. The bundled Run Capri AgentPay Extension launch config compiles the extension and helper servers, then opens an Extension Development Host.
Everything below can be driven from the Capri Wallet panel in the activity bar (no command palette required) — or from the Capri AgentPay: commands if you prefer:
- In the sidebar's Local runtime panel, click Start next to Sandbox merchant
- Click Create Agent Wallet
- Fund the new address from a Base Sepolia faucet if you want a real on-chain test payment
- On the agent card, click Set budget
- Click Pay endpoint and point it at
http://localhost:4021/v1/weather
- Watch the balance, recent payments, and signature status update in place; click All receipts for the full ledger
The sidebar also exposes Verify receipt, Generate SDK code, Revoke access, and one-click Start/Stop toggles for the MCP payment server and sandbox merchant, with live running/stopped status.
Build a shareable VSIX
npm run package
vscode:prepublish bundles the extension and all three helper servers with esbuild, so the resulting .vsix is self-contained and ships without node_modules.
Publish to the VS Code Marketplace
The extension is packaging-clean (bundled output, MIT license, changelog, icon, no vsce errors). To publish it you need a publisher account and a Personal Access Token:
- Create a publisher at https://marketplace.visualstudio.com/manage and put its id in
package.json under "publisher" (currently capri-ai).
- Create an Azure DevOps PAT with the Marketplace → Manage scope: https://dev.azure.com.
- Publish:
npx @vscode/vsce login <your-publisher-id>
npx @vscode/vsce publish --no-dependencies --allow-missing-repository
Optional but recommended before publishing: add a "repository" field to package.json pointing at your git repo, then you can drop --allow-missing-repository.
Run the landing app
npm run dev
npm run build
Local preview defaults to the Capri AgentPay product surface. Use these URLs to preview both sites:
http://127.0.0.1:5173/?site=capri-agentpay
http://127.0.0.1:5173/?site=capri-ai
Run the MCP server and bridge
npm run mcp-server
npm run http-bridge
npm run mock-merchant
The HTTP bridge binds to 127.0.0.1:4022 by default and prints the active token on startup. Pass that token as:
Authorization: Bearer <token>
You can also set CAPRI_AGENTPAY_HTTP_TOKEN ahead of time to make the token stable across restarts.
SDK example
import { CapriAgentPayClient } from "@capriai/agentpay-sdk";
const client = new CapriAgentPayClient({
agentId: "agent_772b",
authToken: process.env.CAPRI_AGENTPAY_HTTP_TOKEN,
});
const result = await client.x402.payAndFetch("http://localhost:4021/v1/weather", {
maxAmountUsd: 0.25,
});
Security notes
- Dynamic receipt and sidebar content is sanitized before it is rendered.
- Every payment passes through policy evaluation before signing.
- The x402 client validates amount, asset, recipient, and chain before attempting settlement.
- Receipts are signed locally and can be verified from the extension.
- The mock merchant rejects proof-token replay.
agentpay-blueprint.md still describes the longer-term production design, including MPC custody, stronger settlement paths, and fuller audit tooling.