Skip to main content
This walkthrough uses the shugo CLI, not the SDK — it’s the fastest way to see the whole system work end to end, no code required. For wiring Shugo into an agent framework programmatically, see the SDK Reference once you understand the flow here.
Every command and every piece of example output on this page is copied from an actual run against live Solana devnet, not written to look plausible. Your addresses and signatures will differ; the shape of the output won’t.

Prerequisites

  • Node.js 18+ and pnpm
  • The Solana CLI tools (solana, solana-keygen, spl-token)
  • A devnet RPC endpoint. The public api.devnet.solana.com rate-limits aggressively under real use — a free endpoint from Helius, QuickNode, or similar is strongly recommended.

1. Install the CLI

If pnpm install reports ignored build scripts, approve esbuild with pnpm approve-builds — the CLI and SDK builds use it. The other packages it lists (bufferutil, utf-8-validate) are optional native speedups and can stay denied.

2. Set up three identities

Shugo separates three roles on purpose: the human who owns the policy and funds pulls, the agent who is the only signer allowed to call pull, and a merchant who receives funds. Keeping agent and merchant separate is what makes the destination allowlist demonstrable — an agent that can only pay a pre-approved merchant can’t redirect funds anywhere else, even if it’s compromised.

3. Create a test token

4. Create the policy

This single command does three things in one transaction: initializes the human’s S&A SubscriptionAuthority for this mint (if one doesn’t already exist), creates the Shugo Policy, and creates the real S&A FixedDelegation naming the policy as delegatee.
Example output
Save the policy and delegation addresses — every command after this needs them.

5. Inspect the policy

Read-only — no keypair needed.
Example output

6. Pull funds — as the agent

This is the command the agent actually runs. Note the keypair: it’s the agent’s, not the human’s.
Example output

7. The kill switch

One instruction pauses the policy — every future pull is denied immediately, regardless of amount or destination.
Example output (the pull is rejected)

What you just proved

The agent could only ever pay $MERCHANT_ATA — a different destination would be denied the same way the paused pull was, by execute_pull’s own checks, before any CPI into S&A happens. Try it: build a second token account for an address that isn’t $MERCHANT_ATA and attempt a pull to it. See Core Concepts → Zero-Custody Architecture for why that matters and what S&A alone does and doesn’t guarantee here.