SafeFlow Solana Agent Skill
Operate this as a payment skill for AI agents on Solana with on-chain rate limiting.
Default program ID (devnet):
DwYEDn6xRpSbnNA7mkszQgDAUoHGfgdBNSi6pwy4qJKy
Quick Start (Owner-Handoff)
- Bootstrap agent keypair and print owner handoff instructions:
cd safe-flow-solana-skill/scripts
chmod +x ./*.sh
./bootstrap.sh \
--program-id DwYEDn6xRpSbnNA7mkszQgDAUoHGfgdBNSi6pwy4qJKy \
--cluster devnet
-
Ask owner to:
- Fund the agent address with SOL for gas (~0.01 SOL)
- Open the SafeFlow dashboard and create a wallet + session for the agent address
- Return with
walletOwnerpublic key
-
Save owner-provided config:
./save_config.sh \
--wallet-owner <OWNER_PUBKEY>
- Execute payment:
./execute_payment.sh \
--recipient <RECIPIENT_ADDRESS> \
--amount 500000000 \
--evidence-id "reasoning:task_completed"
How It Works
- Agent generates a Solana keypair (stored locally in
.safeflow/agent-keypair.json) - Owner creates an AgentWallet PDA + deposits SOL + creates a SessionCap for the agent
- Agent uses the SessionCap to execute rate-limited payments autonomously
- All payments are enforced on-chain: rate limit, total cap, expiration, and revocation
Session Query
Check remaining budget before attempting payment:
./execute_payment.sh --query --wallet-owner <OWNER_PUBKEY>
Error Handling
The skill classifies payment failures:
| Error | Meaning | Agent Action |
|---|---|---|
ExceedsRateLimit | Too fast | Wait, retry with smaller amount |
ExceedsTotalLimit | Budget exhausted | Stop, notify owner |
SessionExpired | Time's up | Ask owner for new session |
SessionRevoked | Owner killed it | Stop immediately |