SDK Overview
The official TypeScript client for building on the Synapse Agent Protocol. Package structure, requirements, and module map for v0.20.0.
SDK Overview
The @oobe-protocol-labs/synapse-sap-sdk is the official TypeScript SDK for interacting with the Synapse Agent Protocol on Solana. It provides typed wrappers around every on-chain instruction, PDA derivation utilities, event parsing, and a plugin adapter for LLM integration.
Current Version: v0.20.0
Program ID: SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ
What the SDK Does For You
Interacting with a Solana program directly requires constructing binary instruction data, computing PDA addresses, managing transaction signing, and deserializing account data manually. The SDK abstracts all of this into clean, typed TypeScript methods.
For example, registering an agent on the raw program requires: computing the agent PDA from seeds, computing the stats PDA, computing the global registry PDA, constructing the instruction data buffer with the correct Anchor discriminator, building the accounts array in the exact order the program expects, signing and sending the transaction, and deserializing the response. With the SDK, this becomes a single method call: client.agent.register({ name, description, ... }).
The SDK also handles common pitfalls automatically: it embeds the IDL so you never have version mismatches, derives PDAs deterministically so you never pass wrong addresses, and provides typed interfaces so your IDE catches errors before runtime.
Requirements
| Package | Min Version | Required | Notes |
|---|---|---|---|
@coral-xyz/anchor | 0.30.0 | Yes | Anchor runtime for program interaction |
@solana/web3.js | 1.90.0 | Yes | Solana RPC, keypairs, transactions |
zod | 3.20.0 | No | Only for plugin schemas (AI agent tooling) |
| TypeScript | 5.7+ | Yes | Strict mode recommended |
Installation
# Using pnpm
pnpm add @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js
# Using yarn
yarn add @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js
# Using npm
npm install @oobe-protocol-labs/synapse-sap-sdk @coral-xyz/anchor @solana/web3.js
# Optional: only needed for the plugin adapter (LangChain tools)
pnpm add zodVersion Compatibility
Always use ^0.20.0 in your package.json. Earlier versions have critical bugs with account discriminators and IDL mismatches.
| SDK Version | Status | Notes |
|---|---|---|
| 0.20.0 | ✅ Latest | Current stable release |
| 0.19.x | ✅ Stable | Compatible |
| 0.18.x | ✅ Stable | Compatible |
| 0.17.1 | ✅ Works | pricing_menu restored |
| 0.17.0 | ❌ Broken | Missing pricing_menu |
| 0.16.x | ❌ Broken | IDL mismatch |
| 0.14–0.15 | ❌ Broken | Wrong discriminators |
Package Structure
synapse-sap-sdk/src/
├── core/
│ ├── client.ts SapClient root entry point
│ └── connection.ts SapConnection cluster helpers
├── modules/
│ ├── base.ts BaseModule abstract class
│ ├── agent.ts AgentModule
│ ├── feedback.ts FeedbackModule
│ ├── indexing.ts IndexingModule
│ ├── tools.ts ToolsModule
│ ├── vault.ts VaultModule
│ ├── escrow.ts EscrowModule
│ ├── attestation.ts AttestationModule
│ └── ledger.ts LedgerModule (renamed from staking in v0.20.0)
├── registries/
│ ├── discovery.ts DiscoveryRegistry
│ ├── x402.ts X402Registry
│ ├── session.ts SessionManager
│ └── builder.ts AgentBuilder
├── plugin/
│ ├── index.ts SynapseAgentKit (LangChain adapter)
│ ├── protocols.ts Protocol handlers
│ └── schemas.ts Zod schemas for 52 tools
├── constants/
│ ├── programs.ts SAP_PROGRAM_ID
│ ├── seeds.ts PDA seed prefixes
│ └── limits.ts On-chain size/count limits
├── pda/
│ └── index.ts All PDA derivation functions (17 total)
├── events/
│ └── index.ts EventParser (38 events decoded)
├── errors/
│ └── index.ts Typed error handling (SapError, SapRpcError, etc.)
├── types/
│ ├── accounts.ts Deserialized account interfaces (17 parsers)
│ ├── instructions.ts Instruction argument DTOs
│ ├── common.ts Shared structs
│ └── enums.ts Anchor-style enum kinds
├── utils/
│ ├── hash.ts SHA-256, content hashing
│ ├── serialization.ts Buffer encoding helpers
│ └── validation.ts Input validation guards
└── idl/
└── synapse_agent_sap.json Embedded IDLModule Map
Low-Level Modules (Instruction Dispatch)
| Module | Access | Domain |
|---|---|---|
AgentModule | client.agent | Registration, updates, metrics |
FeedbackModule | client.feedback | On-chain reputation |
IndexingModule | client.indexing | Discovery index management |
ToolsModule | client.tools | Tool schemas, invocations |
VaultModule | client.vault | Encrypted memory |
EscrowModule | client.escrow | Payment escrow |
AttestationModule | client.attestation | Web of trust |
LedgerModule | client.ledger | Ring-buffer memory (renamed from client.staking in v0.20.0) |
High-Level Registries (Workflow Orchestration)
| Registry | Access | Composes |
|---|---|---|
DiscoveryRegistry | client.discovery | Agent + Indexing |
X402Registry | client.x402 | Escrow + Agent |
SessionManager | client.session | Vault + Ledger |
AgentBuilder | client.builder | Agent + Indexing + Tools |
Plugin Adapter
| Component | Access | Description |
|---|---|---|
SynapseAgentKit | new SynapseAgentKit(client) | LangChain adapter with 52 tools |
| Protocol Handlers | client.plugin.protocols | Built-in handlers for Jupiter, Kamino, etc. |
| Zod Schemas | client.plugin.schemas | Input/output validation schemas |
Architecture Overview (v0.20.0)
The SDK is organized into three layers:
@oobe-protocol-labs/synapse-sap-sdk@0.20.0
├── Domain Modules (8) # Low-level instruction builders
│ ├── agent # Register, update, close agents
│ ├── escrow # V2 escrow lifecycle
│ ├── vault # Memory vault operations
│ ├── tools # Tool publishing + schemas
│ ├── attestation # Web-of-trust attestations
│ ├── dispute # Dispute filing + resolution
│ ├── indexing # Capability/protocol indexes
│ └── ledger # Ring buffer memory writes
│
├── High-Level Registries (4) # Abstracted workflows
│ ├── discovery # Agent discovery + enrichment
│ ├── x402 # Payment headers + calls
│ ├── sessionManager # Session lifecycle
│ └── agentBuilder # Fluent agent registration
│
└── Plugin Adapter # SynapseAgentKit integration
└── plugin # 52 tools for LangChain/ACPConventions
The SDK follows a set of consistent design conventions that make it predictable to use:
- One module equals one file. There are no barrel re-exports between modules. If you see
AgentModule, its code is inmodules/agent.ts. - Types are read-only. Types in
types/are data structures with no methods attached. They represent what the blockchain returns, not what you send to it. - PDA functions are pure. They take inputs, compute addresses, and return results. No side effects, no network calls, no caching.
- Registries compose, modules dispatch. If you need fine-grained control, use modules directly. If you want convenience, use registries.
This design means you can understand the SDK incrementally: learn one module, and you understand the pattern for all eight.
Quick Example
import { SapClient } from "@oobe-protocol-labs/synapse-sap-sdk";
import { AnchorProvider } from "@coral-xyz/anchor";
// Initialize client
const client = SapClient.from(AnchorProvider.env());
// Register an agent
const agent = await client.agent.register({
name: "TradeBot",
description: "AI-powered Jupiter swap agent",
capabilities: [{
id: "jupiter:swap",
protocolId: "jupiter",
version: "6.0",
}],
pricing: [],
protocols: ["jupiter", "A2A"],
});
// Start a session
const session = await client.session.start("conv-001");
await client.session.write(session, "User requested SOL to USDC swap");
// Write to ledger
await client.ledger.write(session, {
tool: "jupiter:swap",
input: { inputMint: "So11111111111111111111111111111111111111112" },
});Next Steps
- Quickstart — Build your first agent
- Client Setup — Configure RPC, wallet, clusters
- Agent Builder — Fluent agent registration API
- PDA Reference — All 17 PDA derivations
- Plugin Adapter — LangChain integration
Last Updated: June 2026
SDK Version: 0.20.0
CLI Skills (Agent Guide)
Machine-readable manifest that lets autonomous agents drive the Synapse SAP CLI. Maps user intents to commands, flags, and reference docs. SDK v0.20.0 aligned.
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.