SDK Reference
Plugin Adapter
Bridge 52 SAP tools into LangChain, Vercel AI, or any LLM framework through the SynapseAgentKit plugin. SDK v0.20.0 aligned.
Plugin Adapter
SDK Version: v0.20.0
The plugin adapter bridges the full SAP protocol surface into the SynapseAgentKit ecosystem. Every on-chain instruction is exposed as a LangChain-compatible StructuredTool with Zod-validated inputs, LLM-friendly descriptions, and automatic type serialization.
Prerequisites
The plugin adapter requires two npm packages:
| Package | Purpose |
|---|---|
@oobe-protocol-labs/synapse-sap-sdk | SAP protocol SDK (provides createSAPPlugin) |
@oobe-protocol-labs/synapse-client-sdk | Synapse AI toolkit (provides SynapseAgentKit) |
pnpm add @oobe-protocol-labs/synapse-sap-sdk @oobe-protocol-labs/synapse-client-sdkQuick Start
import { SynapseAgentKit } from "@oobe-protocol-labs/synapse-client-sdk/ai/plugins";
import { createSAPPlugin } from "@oobe-protocol-labs/synapse-sap-sdk/plugin";
import { AnchorProvider } from "@coral-xyz/anchor";
const provider = AnchorProvider.env();
// createSAPPlugin returns a SynapsePlugin exposing 52 on-chain tools
const sapPlugin = createSAPPlugin({
provider, // required: Anchor provider with wallet signer
// programId, // optional: override SAP program ID (default: mainnet)
});
// SynapseAgentKit orchestrates plugins and converts tools to LangChain format
const kit = new SynapseAgentKit({
rpcUrl: "https://api.mainnet-beta.solana.com",
})
.use(sapPlugin); // register the SAP plugin
const tools = kit.getTools(); // 52 StructuredTool instancesHow It Works
The plugin follows a four-layer pipeline:
- Schemas (Zod): Runtime validation plus LLM-friendly
.describe()strings - Protocols (8 domains): Method registries mapping tool names to schema pairs
- Executor: Dispatches to SapClient module methods with automatic serialization
- Solana RPC: Transaction submitted, confirmed, signature returned
The 8 Protocol Domains
| Domain | ID | Tools | Description |
|---|---|---|---|
| Agent Identity | sap-agent | 8 | Registration, lifecycle, reputation |
| Trustless Reputation | sap-feedback | 4 | On-chain feedback |
| Web of Trust | sap-attestation | 3 | Cross-agent attestations |
| x402 Escrow | sap-escrow | 6 | Micropayments |
| Tool Registry | sap-tools | 7 | Tool schemas, versioning |
| Encrypted Memory | sap-vault | 10 | Vault, sessions, delegation |
| Discovery Indexes | sap-indexing | 8 | Capability and protocol indexes |
| Memory Ledger | sap-ledger | 6 | Ring buffer, sealed pages |
| Total | 52 |
Serialization Bridge
The executor handles all type conversions automatically:
| Direction | Conversion |
|---|---|
| LLM to Chain | Base58 string to PublicKey |
| LLM to Chain | Numeric string to BN |
| LLM to Chain | Hex string to Buffer |
| LLM to Chain | Enum string to Anchor variant |
| Chain to LLM | PublicKey to Base58 string |
| Chain to LLM | BN to numeric string |
Zod Schema Conventions
| Solana Type | Zod Representation |
|---|---|
PublicKey | z.string().min(32).max(44) |
BN / u64 | z.string() (numeric) |
[u8; 32] hash | z.array(z.number()).length(32) |
| Anchor enum | z.enum(["sol", "usdc", "spl"]) |
All write operations return { txSignature: string } in the output schema.
Configuration
import { createSAPPlugin } from "@oobe-protocol-labs/synapse-sap-sdk/plugin";
// Minimal: uses canonical program ID
const plugin = createSAPPlugin({ provider });
// Custom program ID (e.g. localnet)
const plugin = createSAPPlugin({
provider,
programId: new PublicKey("YourCustomProgramId"),
});Full LangChain Integration
import { ChatOpenAI } from "@langchain/openai";
import { AgentExecutor, createStructuredChatAgent } from "langchain/agents";
const llm = new ChatOpenAI({ model: "gpt-4o" });
const agent = await createStructuredChatAgent({ llm, tools, prompt });
const executor = AgentExecutor.fromAgentAndTools({ agent, tools });
const result = await executor.invoke({
input: "Register a new agent called SwapBot with Jupiter swap capability",
});Next Steps
- Quickstart — First agent registration
- Tools and Schemas — Tool publication
- Zod Schemas — Runtime validation
Last Updated: June 2026
SDK Version: 0.20.0