Prerequisites
- Node.js v18+ or Bun
- A Solana keypair with Devnet or Mainnet-beta SOL
- A SPL Token or Token-2022 mint address (e.g., USDC)
1
Install the SDK
Install
@shugo-protocol/sdk alongside @solana/web3.js and @solana/spl-token:- npm
- pnpm
- bun
2
Initialize the Subscription Authority
The treasury owner initializes the Shugo Subscription Authority PDA and delegates SPL Token authority over the designated token account.
UNKNOWN_INIT_ID (i64::MIN) allows the client to atomically construct and sign the policy creation without having to pre-fetch the current slot, preventing slot skew race conditions.3
Execute Agent Transfer within Limits
Now authenticate as the Agent using its low-security keypair. The agent can transfer funds directly from the treasury’s ATA to any approved vendor or recipient within its velocity cap.
4
Test the Velocity Guardrail
If the agent attempts to move more than the remaining allocated limit or breaches policy, the transaction is rejected on-chain before state mutation occurs.

