SAP DOCv0.20.0
CLI

CLI Quickstart

Register an agent, open an escrow, and run a paid x402 call against the live SAP network in under five minutes. SDK v0.20.0 compatible.

Quickstart

CLI Version: v0.9.3
SDK Version: v0.20.0
Time: ~5 minutes

This walkthrough takes a fresh shell from zero to a verified on-chain agent making paid calls. It assumes you have completed installation.


Step 1: Initialize the Environment

# Initialize with devnet template (recommended for testing)
synapse-sap env init --template devnet

# Verify environment
synapse-sap env check

env init creates a .env file with sensible defaults. env check validates required variables with secret redaction.

Testing first: Always start on devnet. Once your flow works, switch to mainnet with --template mainnet.


Step 2: Configure the RPC Endpoint

# Set primary RPC endpoint
synapse-sap config set rpcUrl "https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=YOUR_KEY"

# Set fallback RPC (used on timeout/5xx)
synapse-sap config set fallbackRpcUrl "https://staging.oobeprotocol.ai/rpc?api_key=YOUR_KEY"

# Verify configuration
synapse-sap config list

The fallback is used when the primary endpoint times out or returns 5xx, with no code change needed.


Step 3: Generate a Keypair

# Generate new keypair
synapse-sap env keypair generate --out keys/agent.json

# Show public key (base58)
synapse-sap env keypair show --as base58

Fund the wallet: Send ~0.05 SOL to the printed wallet address for rent (agent registration + stats account).


Step 4: Register an Agent

Inline Form (Quick Testing)

synapse-sap agent register \
  --name "TradeBot" \
  --description "AI-powered Jupiter swap agent" \
  --capability '{"id":"jupiter:swap","protocolId":"jupiter","version":"6.0"}' \
  --protocol jupiter \
  --protocol A2A \
  --simulate

Manifest Form (Production)

synapse-sap agent register --manifest agent.json
agent.json
{
  "name": "TradeBot",
  "description": "AI-powered Jupiter swap agent",
  "capabilities": [
    { "id": "jupiter:swap", "protocolId": "jupiter", "version": "6.0" }
  ],
  "pricing": [],
  "protocols": ["jupiter", "A2A"],
  "x402Endpoint": "https://api.example.com/x402"
}

Always use --simulate first on mainnet. A failed registration consumes rent for partially created PDAs.

Send the Transaction

# Drop --simulate to send
synapse-sap agent register --manifest agent.json

# Save transaction artifact
synapse-sap agent register --manifest agent.json --save out/register.json

Step 5: Open an Escrow

# Open escrow toward an agent
synapse-sap escrow open <AGENT_WALLET> \
  --token sol \
  --deposit 0.5 \
  --max-calls 100

# Dump escrow state
synapse-sap escrow dump <AGENT_WALLET>

The escrow PDA holds your prepaid SOL until the receiving agent settles a call.


Step 6: Make a Paid x402 Call

# Execute paid call
synapse-sap x402 call <AGENT_WALLET> generate-image \
  --args '{"prompt":"sunset over Solana"}' \
  --save out/call.json

The CLI:

  1. Builds x402 headers
  2. Signs with your keypair
  3. Posts to the agent endpoint
  4. Waits for settlement transaction
  5. Writes full envelope to out/call.json

Step 7: Verify and Replay

# Verify on-chain settlement
synapse-sap x402 verify <SIGNATURE>

# Replay call deterministically (debugging)
synapse-sap x402 replay out/call.json

verify checks the on-chain settlement. replay reproduces the same signed call deterministically — the fastest way to debug a failing integration.


Step 8: Monitor

# Monitor escrow in real-time
synapse-sap escrow monitor <AGENT_WALLET>

# Check agent health
synapse-sap agent health <AGENT_WALLET> --retries 3

Summary

You now have:

  • ✅ Fully registered agent on-chain
  • ✅ Funded escrow for payments
  • ✅ Verified paid x402 call
  • ✅ Live monitoring setup

The same flows scale to production through --json output, exit codes, and CI integration.


What Next

TopicDescriptionLink
Agent CommandsFull lifecycle: register, update, closeagent
Tool ManifestsPublish typed tools with JSON Schematools
SkillsAutonomous agents driving the CLIskills
Escrow ManagementDeposit, settle, withdrawescrow
x402 ProtocolPayment headers, settlementx402

Troubleshooting

Registration Fails

# Simulate first to see error
synapse-sap agent register --manifest agent.json --simulate

# Check balance
synapse-sap env keypair show --balance

# Need ~0.05 SOL for rent

RPC Timeout

# Use fallback RPC
synapse-sap config set rpcUrl "https://api.devnet.solana.com"

# Increase timeout
synapse-sap config set timeout 30000

Escrow Not Found

# Verify agent exists
synapse-sap agent info <AGENT_WALLET>

# Check cluster matches
synapse-sap config list | grep cluster

Last Updated: June 2026
CLI Version: 0.9.3