The problem
Giving an autonomous AI agent direct access to a private key is a bet you can’t take back. A prompt injection, a hallucinated instruction, or a bug in an agent framework can turn into an unbounded transfer the moment the agent can sign for your wallet. A multisig fixes this but defeats the point of autonomy — a human has to click approve every time. A hot wallet with a raw keypair fixes the autonomy problem by reintroducing the first one. Solana’s own Subscriptions & Allowances program, shipped by the Solana Foundation in June 2026, solves the custody half of this: a human delegates a capped, time-limited allowance to another address, and funds never leave the human’s wallet until a pull actually happens. But the base program is deliberately simple. It enforces an amount and an expiry on one delegation — nothing more. It has no concept of a destination allowlist, no way to cap total spend across several delegations held by the same agent, and no single instruction to freeze everything at once.What Shugo adds
Shugo is a thin policy layer that sits between an agent and a real Subscriptions & Allowances delegation. A Policy — an account our program controls — is registered as thedelegatee on the real delegation instead of the agent’s raw keypair. Every time the agent wants to pull funds, it calls our program, not S&A directly; our program checks the policy, and only if every check passes does it forward the call into S&A’s own transfer_fixed instruction via CPI.
Per-call cap
A hard ceiling on how much a single pull can move, independent of what the underlying delegation itself allows.
Velocity cap
A maximum total amount an agent can pull within a fixed time window — measured in seconds, not slots — so a burst of small pulls can’t add up to an unbounded drain inside one window.
Destination allowlist
Up to four receiver token accounts a pull is allowed to pay out to. S&A itself places no constraint on where a pull sends funds; this is the gap that closes.
Instant kill switch
One instruction pauses every future pull against a policy immediately, regardless of how many delegations sit under it. No per-delegation revocation needed.
How it works
- The human — a standard wallet, holds the funds, never hands them to the agent directly.
- The Policy — a PDA our program controls, holding the rules: per-call cap, velocity cap, window length, destination allowlist, paused flag.
- The delegation — a real S&A
FixedDelegation, created by the human, naming the Policy’s own address asdelegatee. - The agent — a lightweight keypair that signs
pullcalls. It never holds an SPL delegate authority of its own; S&A only ever sees the Policy PDA as the thing it trusts.
Every claim on this page was verified during development, not just implemented — a deployed devnet program (
6gHABW3Rn5dsTdXKN2xzRdb4g9v2DjYmc9sKq1Wn8my9), 7 passing integration tests against a real Subscriptions & Allowances CPI, and a Kani proof covering 483 checks on the policy-evaluation logic. See Security for the actual proof, not a description of one.Where to go next
Quickstart
Create a policy and run your first guarded pull against devnet in a few minutes, using the CLI.
Architecture
The full account model, instruction set, and CPI flow.
SDK Reference
Build policy creation and pulls directly into an agent framework with
@shugo/sdk.CLI Reference
Every
shugo command, with the flags it actually takes.(1).png?fit=max&auto=format&n=qzWg2aQwcoMXkrks&q=85&s=7bd9594b6c05a51ce5a41a26f4cb7e42)
(1).png?fit=max&auto=format&n=qzWg2aQwcoMXkrks&q=85&s=f7ad867613529ca7109dfe0b0dabd815)