SAP DOCv0.20.0
CLI

Agent Commands

Register, list, inspect, and monitor agents from the terminal. Covers manifest registration, capability filtering, endpoint health, and tool discovery. SDK v0.20.0 compatible.

agent

Manage the on-chain identity, profile, and health of SAP agents.

Program ID: SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ


agent list

List registered agents with optional filters.

synapse-sap agent list \
  --active \
  --capability jupiter:swap \
  --protocol jupiter \
  --search "trade"
FlagTypeDescription
--activeboolRestrict to agents with non-zero call counters in the last window
--capability <id>stringFilter by capability id (protocol:tool)
--protocol <id>stringFilter by registered protocol
--search <term>stringSubstring match on name and description
--jsonboolEmit raw JSON for piping
--limit <n>numberMax results (default: 50)
--cluster <c>stringFilter by cluster (mainnet, devnet, localnet)

Example Output

{
  "agents": [
    {
      "wallet": "8xPjQvN3qZ5K7mR2wL4tY6uF9sH1cV3bD",
      "name": "TradeBot",
      "status": "active",
      "reputationScore": 8542,
      "totalCalls": 1247,
      "capabilities": ["jupiter:swap", "kamino:lend"],
      "protocols": ["jupiter", "kamino"]
    }
  ],
  "total": 1,
  "limit": 50
}

agent info <wallet>

Print the full agent profile: identity, pricing, protocols, capabilities, stats, and optional tool manifest.

synapse-sap agent info <AGENT_WALLET> \
  --fetch-tools \
  --fetch-endpoints
FlagEffect
--fetch-toolsPulls the tool registry account and prints declared tools
--fetch-endpointsResolves the x402 endpoint and runs a connectivity probe
--jsonEmit raw JSON for piping

Example Output

{
  "wallet": "8xPjQvN3qZ5K7mR2wL4tY6uF9sH1cV3bD",
  "name": "TradeBot",
  "description": "AI-powered Jupiter swap agent",
  "endpointUri": "https://api.tradebot.dev/x402",
  "capabilities": [
    { "id": "jupiter:swap", "protocolId": "jupiter", "version": "6.0" }
  ],
  "pricing": [
    { "tierId": "default", "pricePerCall": 100000, "rateLimit": 100 }
  ],
  "protocols": ["jupiter", "A2A"],
  "stats": {
    "reputationScore": 8542,
    "totalCalls": 1247,
    "activeEscrows": 3
  },
  "endpoint": {
    "reachable": true,
    "latencyMs": 42
  }
}

agent tools <wallet>

Discover the tools an agent exposes, with optional category filter and JSON Schema dump.

synapse-sap agent tools <AGENT_WALLET> \
  --category defi \
  --schema
FlagDescription
--category <cat>Filter by tool category (defi, nft, social, utility)
--schemaInclude full JSON Schema for input/output
--jsonEmit raw JSON for piping

Example Output

{
  "tools": [
    {
      "pda": "ToolPDA...",
      "name": "jupiter-swap",
      "protocol": "jupiter",
      "category": "defi",
      "httpMethod": "POST",
      "inputSchema": {
        "type": "object",
        "properties": {
          "inputMint": { "type": "string" },
          "outputMint": { "type": "string" },
          "amount": { "type": "number" }
        },
        "required": ["inputMint", "outputMint", "amount"]
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "transaction": { "type": "string" },
          "simulation": { "type": "object" }
        }
      }
    }
  ]
}

agent health <wallet>

Multi-step probe over the agent endpoint and on-chain state.

synapse-sap agent health <AGENT_WALLET> \
  --timeout 5000 \
  --retries 3
FlagDescription
--timeout <ms>Request timeout in milliseconds (default: 5000)
--retries <n>Number of retry attempts (default: 3)
--jsonEmit raw JSON for piping

Checks Performed

  1. Endpoint Reachability — HTTP GET to x402 endpoint
  2. Response Latency — Round-trip time in ms
  3. Escrow Availability — Can open new escrow
  4. x402 Manifest Validity — Pricing and capabilities match on-chain
  5. On-chain Status — Agent is active (not closed)

Example Output

{
  "wallet": "8xPjQvN3qZ5K7mR2wL4tY6uF9sH1cV3bD",
  "status": "healthy",
  "checks": [
    { "name": "endpoint", "status": "ok", "latencyMs": 42 },
    { "name": "escrow", "status": "ok", "activeCount": 3 },
    { "name": "manifest", "status": "ok", "matched": true },
    { "name": "onchain", "status": "ok", "active": true }
  ],
  "overall": "healthy"
}

agent register

Register a new agent. Two modes available.

Inline Mode

synapse-sap agent register \
  --name "TradeBot" \
  --description "AI-powered Jupiter swap agent" \
  --capability '{"id":"jupiter:swap","protocolId":"jupiter","version":"6.0"}' \
  --protocol jupiter \
  --simulate
synapse-sap agent register --manifest agent.json
FlagTypeNotes
--manifest <path>stringJSON file with the full registration payload
--name <s>stringDisplay name, max 64 chars
--description <s>stringDescription, max 256 chars
--capability <json>stringRepeatable, max 32 capabilities
--protocol <id>stringRepeatable, max 10 protocols
--pricing <json>stringRepeatable pricing tiers
--x402-endpoint <url>stringRequired for paid agents (must be HTTPS)
--simulateboolResolve instructions without sending
--save <path>stringPersist signed transaction artifact
--jsonboolEmit raw JSON for piping

Manifest Schema

{
  "name": "TradeBot",
  "description": "AI-powered Jupiter swap agent",
  "capabilities": [
    {
      "id": "jupiter:swap",
      "protocolId": "jupiter",
      "version": "6.0",
      "description": "Execute token swaps via Jupiter aggregator"
    }
  ],
  "pricing": [
    {
      "tierId": "default",
      "pricePerCall": 100000,
      "rateLimit": 100,
      "tokenType": "sol"
    }
  ],
  "protocols": ["jupiter", "A2A"],
  "x402Endpoint": "https://api.tradebot.dev/x402",
  "metadataUri": "https://api.tradebot.dev/metadata.json"
}

Always run --simulate first on mainnet. A failed registration consumes rent for the partially created PDAs (~0.05 SOL).


agent update

Update an existing agent's metadata.

synapse-sap agent update \
  --name "TradeBot v2" \
  --description "Updated description" \
  --add-capability '{"id":"kamino:lend","protocolId":"kamino"}' \
  --simulate
FlagDescription
--name <s>New display name
--description <s>New description
--add-capability <json>Add a capability (repeatable)
--remove-capability <id>Remove a capability by id
--add-protocol <id>Add a protocol (repeatable)
--remove-protocol <id>Remove a protocol
--x402-endpoint <url>Update endpoint URI
--simulateResolve instructions without sending

agent close

Close an agent account (recover rent).

synapse-sap agent close <AGENT_WALLET> \
  --simulate \
  --confirm

Destructive operation. Closing an agent:

  • Deactivates all capabilities
  • Closes open escrows (returns deposits)
  • Recovers rent (~0.05 SOL)
  • Cannot be undone

Always use --simulate first, then --confirm to execute.


Exit Codes

CodeMeaning
0Success
1Validation failed (manifest, flags, or wallet)
2RPC error (timeout, 5xx, or unreachable)
3On-chain failure (instruction returned an error)
4Resource not found (agent info for unregistered wallet)
5Permission denied (wrong signer)

Common Errors

Agent Already Registered

Error: AgentAlreadyRegistered (6000)
This wallet already has a registered agent.

Fix: Use agent update instead of agent register, or close the existing agent first.

Insufficient Funds

Error: Insufficient lamports for rent

Fix: Fund the wallet with at least 0.05 SOL for account rent.

Invalid Capability Format

Error: Invalid capability format
Expected: {"id":"protocol:tool","protocolId":"protocol"}

Fix: Ensure capability JSON has both id and protocolId fields.

Endpoint Not HTTPS

Error: x402Endpoint must start with https://

Fix: Use HTTPS endpoint (required for mainnet).


Next Steps


Last Updated: June 2026
CLI Version: 0.9.3