TLDR:Documentation Index
Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
Use this file to discover all available pages before exploring further.
- An AI agent that pays for things shouldn’t hold the keys to your whole wallet. The Solana Subscriptions & Allowances program lets you grant it a fixed delegation — a capped, optionally time-limited budget it can spend against on its own.
- The agent gets its own keypair and draws against the budget without you signing each payment; the program enforces the cap and you can revoke at any time.
- This is the standing-budget complement to x402, which handles stateless pay-per-call payments. Together they cover both sides of agentic commerce: per-request access and a bounded autonomous spend.
- We build it in Python against a Chainstack node — grant an allowance, have the agent spend against it, and watch the program reject an overspend.
Why agents need a budget primitive
Hand an autonomous agent your wallet and you’ve handed it everything. The moment it can sign for one payment, it can sign for all of them. That’s the wrong trust model for software that runs unattended. What you actually want is the model you already use with cards and corporate spend: a capped allowance. The agent can spend up to a limit, on its own, for as long as you allow — and not a token more. On Solana, the Subscriptions & Allowances program gives you exactly that primitive with its fixed delegation.Allowances and x402 are complementary
If you’re building agent payments on Solana, you’ll meet two primitives. They solve different halves of the problem:| x402 | Fixed-delegation allowance | |
|---|---|---|
| Shape | Per-request payment over HTTP 402 | A standing, pre-authorized budget |
| State | Stateless — no account, no standing authorization | An onchain delegation the agent draws against |
| Best for | Pay-per-call API access, metered usage, discovery | A bounded autonomous spend across many actions |
| Authorization | The agent pays for each call as it goes | You authorize once; the agent spends within the cap |
The same idea powers infrastructure billing. An agent that consumes paid services — RPC tiers, data feeds, tool APIs — can be handed a capped allowance and left to pull what it needs, when it needs it, with a hard ceiling you set once.
How a fixed delegation works
The mechanics are the allowance model from the pillar guide: one Subscription Authority (SA) PDA per(user, mint) becomes the single u64::MAX delegate on your token account, and individual delegation PDAs hold the real limits.
For an agent budget, the delegation’s delegatee is the agent’s wallet:
- You (the delegator) create a fixed delegation naming the agent as delegatee, with a total
amountand an optionalexpiry_ts. - The agent (the delegatee) calls
transferFixed, signing with its own key, to move tokens from your account to whoever it’s paying. Each transfer decrements the remaining budget. - When the budget hits zero or the expiry passes, transfers stop. You can also revoke the delegation PDA at any time to cut it off immediately.
Prerequisites
- Python 3.10+
pip install solana solders- A Chainstack Solana devnet node endpoint
- Some devnet SOL from the Chainstack faucet
Run Solana mainnet and devnet nodes on Chainstack
Start for free and get your app to production levels immediately. No credit card required. You can sign up with your GitHub, X, Google, or Microsoft account.Build it in Python
As in the pillar guide, there’s no Python SDK, so we build the instructions by hand. The setup below shares the same foundation; the new pieces are the two fixed-delegation instructions.Set up the wallets and a balance
A
user (you, funding the agent), an agent (the autonomous spender), and a service the agent will pay. Fund the user from the Chainstack faucet, then the script gives the agent a little SOL for its own transaction fees.Grant the agent a budget
Initialize the user’s Subscription Authority, then create a fixed delegation naming the agent as delegatee with a 10-token cap.
nonce lets you create more than one delegation for the same agent later; expiry_ts=0 means no expiry.The agent spends — on its own signature
The agent now pays the service twice, signing each transfer itself. The user is not in the loop. Each draw decrements the remaining budget.
The cap holds
With 4 tokens left, an attempt to pull 10 fails — the program rejects it with To cut the agent off before the budget is spent, the user revokes the delegation PDA (instruction
AmountExceedsLimit. The agent can never spend past what you authorized.revokeDelegation, discriminator 3), which closes it and returns the rent.Where this fits
The fixed delegation is the trust boundary for autonomous spending. Pair it with x402 and you have the full agentic-commerce loop on Solana: the agent discovers and pays for services per call with x402, and the allowance is the bounded pool it spends from — with a ceiling you set once and can revoke any time. The same pattern underpins agent-friendly infrastructure billing. A service that sells RPC tiers, data, or tool access can let an agent pre-authorize a budget and pull against it as it works, instead of demanding a card on file or a prepaid balance. To track that spending as it happens, see indexing subscription events with Geyser — everytransferFixed emits a FixedTransfer event with the amount and remaining budget.
