Skip to main content

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 the delegatee 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.
None of this touches token custody. The actual SPL transfer still happens inside S&A’s own audited program; Shugo only decides whether to let that CPI happen at all.

How it works

  1. The human — a standard wallet, holds the funds, never hands them to the agent directly.
  2. The Policy — a PDA our program controls, holding the rules: per-call cap, velocity cap, window length, destination allowlist, paused flag.
  3. The delegation — a real S&A FixedDelegation, created by the human, naming the Policy’s own address as delegatee.
  4. The agent — a lightweight keypair that signs pull calls. 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.