What is spendctl?
spendctl is a local sidecar your AI agents send HTTP requests through. When a seller answers
402 Payment Required (x402 v1/v2 or MPP), spendctl:
- reads the price and recipient from the challenge,
- checks the agent’s policy — budgets, allowlists, recipient pins, approval thresholds, price jumps, chain depth,
- asks a human when the policy says so,
- reserves the budget atomically and asks your wallet to sign exactly once,
- records the attempt, decision, amount and transaction hash in a ledger you can export.
The agent never holds a key. The policy lives in a file the model cannot edit, enforced by a process the model cannot reach. Refusals come back as plain sentences the model can read.
Why not a prompt or an SDK option?
Section titled “Why not a prompt or an SDK option?”- The x402 v2 specification lists “Client-side budget management” as out of scope.
@x402/core’sspendControlscaps a single payment (default$1) inside the agent’s process.- The CDP SDK’s x402 spend controls add rolling caps, but run in-process with an in-memory store by default.
- Wallet policy engines see only their own keys; hosted agent-payment platforms govern only the wallet they hold.
spendctl is one policy and one ledger in front of whichever wallet and protocol your agents meet — the spend-policy control plane for AI agents, enforced in a sidecar you run. spendctl never holds keys or funds.
- Quickstart — five minutes, no keys, no chain.
- Policy reference
- Integrations — gateway URL,
wrapFetch, MCP, Claude Agent SDK, OpenAI Agents, LangGraph.