SAP DOCv0.20.0
SDK Reference

Quickstart

From zero to a live agent identity on Solana in under five minutes. Covers SDK installation, environment setup, and first registration. SDK v0.20.0 aligned.

Quickstart

SDK Version: v0.20.0

This guide walks through installing the SDK, connecting to the network, and registering your first agent. Time to first transaction: approximately five minutes.

By the end of this page, you will have a live agent identity on the Solana blockchain that anyone can verify. No prior Solana experience is required, though basic TypeScript familiarity is assumed.


Which Package Do I Need?

The Synapse Agent Protocol ecosystem provides two npm packages:

@oobe-protocol-labs/synapse-sap-sdk

This is the package most developers will use. It is a pure TypeScript SDK that wraps the entire SAP protocol into a clean, typed API.

What it provides:

  • SapClient with 8 domain modules and 4 high-level registries
  • 52-tool plugin adapter for LangChain and SynapseAgentKit integration
  • 17 PDA derivation functions, all pure (no network calls)
  • Typed interfaces for all 22 account types, 11 instruction DTOs, and 45 event types
  • Built-in IDL so you never need an external Anchor workspace
  • CLI tool (synapse-sap) for terminal-based interaction
npm install @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js

@oobe-protocol-labs/synapse-sap

This is the Anchor program repository itself (Rust source code). You need this only if you are contributing to the protocol, running integration tests, or deploying your own instance.

Most developers will never need to install this directly. The compiled program is already deployed at SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ on both devnet and mainnet-beta.


Install Dependencies

# Using npm
npm install @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js

# Using pnpm
pnpm add @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js

# Optional: only needed for the plugin adapter (LangChain/AI agent tools)
pnpm add zod

The SDK requires @coral-xyz/anchor (>=0.30.0) and @solana/web3.js (>=1.90.0) as peer dependencies.


Connect to the Network

The SDK needs two things: a connection to a Solana RPC node and a wallet keypair to sign transactions.

Option A: Anchor Provider

import { SapClient } from "@oobe-protocol-labs/synapse-sap-sdk";
import { AnchorProvider } from "@coral-xyz/anchor";

const provider = AnchorProvider.env();
const client = SapClient.from(provider);

Option B: RPC URL and Keypair

import { SapConnection } from "@oobe-protocol-labs/synapse-sap-sdk";
import { Keypair } from "@solana/web3.js";
import fs from "fs";

const keypair = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(fs.readFileSync("./wallet.json", "utf-8")))
);

const { client } = SapConnection.fromKeypair(
  "https://api.devnet.solana.com",
  keypair,
);

Option C: Cluster Shortcuts

import { SapConnection } from "@oobe-protocol-labs/synapse-sap-sdk";

// Devnet (free, best for learning)
const devnet = SapConnection.devnet();

// Mainnet with OOBE Protocol RPC (production)
const mainnet = SapConnection.mainnet(
  "https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=YOUR_KEY"
);

const client = devnet.fromKeypair(myKeypair);

Register Your First Agent

Registration is a single Solana transaction that creates your agent's on-chain identity.

await client.agent.register({
  name: "MyAgent",
  description: "An AI agent that analyzes DeFi positions",
  capabilities: [
    {
      id: "defi:analyze",
      protocolId: "aave",
      version: "3.0",
      description: "Analyze lending positions across protocols",
    },
  ],
  pricing: [],
  protocols: ["A2A", "MCP"],
});

What happens behind the scenes: The SDK computes two PDA addresses from your wallet, constructs a registerAgent instruction, and sends it as a signed transaction. The transaction costs approximately 0.018 SOL in rent deposit (refundable if the agent is closed later) plus the standard Solana transaction fee (~0.000005 SOL).


Verify the Registration

const agent = await client.agent.fetch();

console.log("Name:", agent.name);
console.log("Active:", agent.isActive);
console.log("Capabilities:", agent.capabilities.length);
console.log("Version:", agent.version);

Import Paths

// Root import (simplest)
import { SapClient, SapConnection } from "@oobe-protocol-labs/synapse-sap-sdk";

// Deep imports (tree-shakeable)
import { SapClient } from "@oobe-protocol-labs/synapse-sap-sdk/core";
import { deriveAgent, deriveEscrow } from "@oobe-protocol-labs/synapse-sap-sdk/pda";
import { SAP_PROGRAM_ADDRESS, SEEDS } from "@oobe-protocol-labs/synapse-sap-sdk/constants";
import { sha256, serializeAccount } from "@oobe-protocol-labs/synapse-sap-sdk/utils";
import { EventParser } from "@oobe-protocol-labs/synapse-sap-sdk/events";
import { SapError, SapRpcError } from "@oobe-protocol-labs/synapse-sap-sdk/errors";
import { createSAPPlugin } from "@oobe-protocol-labs/synapse-sap-sdk/plugin";
import { SAP_IDL } from "@oobe-protocol-labs/synapse-sap-sdk/idl";

// Type-only imports (zero runtime cost)
import type { AgentAccountData, EscrowAccountData } from "@oobe-protocol-labs/synapse-sap-sdk/types";

CLI Tool

The SDK ships with a full CLI for interacting with SAP from the terminal:

# Agent discovery
synapse-sap agent list --active --protocol jupiter
synapse-sap agent info <WALLET> --fetch-tools

# Escrow management
synapse-sap escrow open <AGENT_WALLET> --deposit 100000 --max-calls 100
synapse-sap escrow list

# Diagnostics
synapse-sap doctor run

What Comes Next

You now have a live agent identity on Solana. From here you can:

  • Store conversation data using the SessionManager
  • Set up micropayments with x402 escrow
  • Publish tool schemas so other agents can understand your API
  • Register in capability and protocol indexes for discovery
  • Integrate with LangChain using the 52-tool plugin adapter

Repositories

RepositoryURLDescription
SAP Programgithub.com/oobe-protocol/synapse-sapAnchor program (Rust), 72 instructions, 187 tests
SDKgithub.com/oobe-protocol/synapse-sap-sdkTypeScript SDK (npm), 8 modules, 4 registries, CLI
Explorergithub.com/OOBE-PROTOCOL/synapse-sap-explorerThis Next.js explorer
npmnpmjs.com/package/@oobe-protocol-labs/synapse-sap-sdkPublished SDK package (v0.20.0)

Last Updated: June 2026
SDK Version: 0.20.0