How to give an AI agent a real spending limit
A prompt is not a budget. The three layers of a real AI agent spending limit, what to do when one is breached, how to pick the numbers, and working code for an on-chain cap on Solana.
Read the guideLearn · agent payments
Guides for engineers putting an AI agent in charge of money: on-chain spending limits, destination allowlists, human approval, x402 pay-per-request, and Solana vault architecture.
5 guides · 6 topic clusters · updated 26 Nov 2026
Caps that live where the money does, not in the prompt.
Allowlists, approvals and a kill switch for the bad days.
Program-derived accounts, an agent key with no balance, sponsored fees.
Pay-per-request APIs where the 402 is settled by the agent.
Wire a wallet into the loop without handing over the vault.
Reconciliation, audit trails and what to check before real money.
A prompt is not a budget. The three layers of a real AI agent spending limit, what to do when one is breached, how to pick the numbers, and working code for an on-chain cap on Solana.
Read the guideHow to structure Solana payments for autonomous agents: a program-derived vault, an agent key with no balance, a sponsored gas tank, and a reconciliation strategy that survives retries.
Read the guidex402 lets an agent settle an HTTP 402 invoice automatically. Here is how the protocol works, why autonomous settlement needs a spending cap, and how to stop a 402 retry loop before it empties a wallet.
Read the guideThe six attacks that actually cost teams money when an AI agent can pay — prompt injection, hallucinated amounts, retry loops, leaked keys — and the control that stops each one.
Read the guideWire a Solana wallet into a Vercel AI SDK agent with PatramTools: tool schemas the model can use, a typed pending-approval state for chat, and spending caps that survive a confused model.
Read the guidePatram is an open source payment platform for autonomous AI agents. Each agent gets a Solana vault (a program-derived account) with on-chain spending limits, a destination allowlist and a human approval step for anything above its budget. The agent holds a key with no money on it, so a leaked key cannot empty the vault.
Use three layers: an instruction in the system prompt, a policy check in your own service, and a cap enforced by the account that actually holds the funds. Only the last one cannot be talked out of a decision. On Solana the limit is stored on the vault account (a u64 in lamports) and the transfer instruction fails with DailyLimitExceeded when the amount would cross it.
Yes. patram-sdk ships PatramTools, a set of AI SDK tool definitions (intraTransfer and fetchPremiumData) with typed schemas, so a model can pay invoices or buy paywalled data without you writing tool wrappers. It also works from plain function calling, LangChain or any framework that can call a TypeScript function.
x402 revives HTTP status 402 so a server can ask for a stablecoin payment before returning a resource, and an agent can settle it and retry automatically. That automation is the risk: a bug or a hostile endpoint can produce an unbounded loop of small payments. A spending cap turns the loop into a bounded, reviewable event.
No. Funds sit in a vault PDA owned by the Anchor program, not in a Patram wallet. The owner signs vault initialization and over-limit approvals from their own wallet. The agent key can only request transfers inside the policy the program enforces.
Solana devnet today, with the Anchor program deployed at DuTvz2VmSRTCPAtA9kLocWUZqEzhjBPqWAZVTzjwNKv7. Mainnet is a configuration and audit step, not a code change, because the program is the same.
Put a limit on the agent, not on your ambition.
Devnet, no card, four credentials to a guarded vault.