Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Comprehensive guide for building AI agents that interact with Solana blockchain using SendAI's Solana Agent Kit. Covers 60+ actions, LangChain/Vercel AI integration, MCP server setup, and autonomous agent patterns.
.claude/skills/majiayu000-solana-agent-kit/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 326% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 112% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 125% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 146% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 231% | 0% |
Build AI agents that autonomously execute 60+ Solana blockchain operations using SendAI's open-source toolkit. Compatible with LangChain, Vercel AI SDK, and Claude via MCP.
The Solana Agent Kit enables any AI model to:
| Feature | Description | |---------|-------------| | 60+ Actions | Token, NFT, DeFi, staking, bridging operations | | Plugin Architecture | Modular - use only what you need | | Multi-Framework | LangChain, Vercel AI SDK, MCP, Eliza | | Model Agnostic | Works with OpenAI, Claude, Llama, Gemini | | Autonomous Mode | Hands-off execution with error recovery |
bash# Core package npm install solana-agent-kit # With plugins (recommended) npm install solana-agent-kit \ @solana-agent-kit/plugin-token \ @solana-agent-kit/plugin-nft \ @solana-agent-kit/plugin-defi \ @solana-agent-kit/plugin-misc \ @solana-agent-kit/plugin-blinks
bash# .env file OPENAI_API_KEY=your_openai_api_key RPC_URL=https://api.mainnet-beta.solana.com # or devnet SOLANA_PRIVATE_KEY=your_base58_private_key # Optional API keys for enhanced features COINGECKO_API_KEY=your_coingecko_key HELIUS_API_KEY=your_helius_key
typescriptimport { SolanaAgentKit, createVercelAITools, KeypairWallet, } from "solana-agent-kit"; import { Keypair } from "@solana/web3.js"; import bs58 from "bs58"; // Import plugins import TokenPlugin from "@solana-agent-kit/plugin-token"; import NFTPlugin from "@solana-agent-kit/plugin-nft"; import DefiPlugin from "@solana-agent-kit/plugin-defi"; import MiscPlugin from "@solana-agent-kit/plugin-misc"; import BlinksPlugin from "@solana-agent-kit/plugin-blinks"; // Create wallet from private key const privateKey = bs58.decode(process.env.SOLANA_PRIVATE_KEY!); const keypair = Keypair.fromSecretKey(privateKey); const wallet = new KeypairWallet(keypair); // Initialize agent with plugins const agent = new SolanaAgentKit( wallet, process.env.RPC_URL!, { OPENAI_API_KEY: process.env.OPENAI_API_KEY!, } ) .use(TokenPlugin) .use(NFTPlugin) .use(DefiPlugin) .use(MiscPlugin) .use(BlinksPlugin); // Create tools for AI framework const tools = createVercelAITools(agent, agent.actions);
@solana-agent-kit/plugin-token)| Action | Description | |--------|-------------| | deployToken | Deploy new SPL token or Token-2022 | | transfer | Transfer SOL or SPL tokens | | getBalance | Check token balances | | stake | Stake SOL via Jupiter/Solayer | | bridge | Bridge tokens via Wormhole | | rugCheck | Analyze token safety |
typescript// Deploy a new token const result = await agent.methods.deployToken({ name: "My Token", symbol: "MTK", decimals: 9, initialSupply: 1000000, }); // Transfer tokens await agent.methods.transfer({ to: "recipient_address", amount: 100, mint: "token_mint_address", // optional, defaults to SOL }); // Check balance const balance = await agent.methods.getBalance({ tokenAddress: "token_mint_address", // optional });
@solana-agent-kit/plugin-nft)| Action | Description | |--------|-------------| | createCollection | Create NFT collection via Metaplex | | mintNFT | Mint NFT to collection | | listNFT | List NFT on marketplaces | | updateMetadata | Update NFT metadata |
typescript// Create collection const collection = await agent.methods.createCollection({ name: "My Collection", symbol: "MYCOL", uri: "https://arweave.net/metadata.json", }); // Mint NFT to collection const nft = await agent.methods.mintNFT({ collectionMint: collection.collectionAddress, name: "NFT #1", uri: "https://arweave.net/nft1.json", });
@solana-agent-kit/plugin-defi)| Action | Description | |--------|-------------| | trade | Swap tokens via Jupiter | | createRaydiumPool | Create Raydium AMM pool | | createOrcaPool | Create Orca Whirlpool | | createMeteoraPool | Create Meteora DLMM pool | | limitOrder | Place limit order via Manifest | | lend | Lend assets via Lulo | | perpetualTrade | Trade perps via Adrena/Drift |
typescript// Swap tokens via Jupiter const swap = await agent.methods.trade({ outputMint: "target_token_mint", inputAmount: 1.0, inputMint: "So11111111111111111111111111111111111111112", // SOL slippageBps: 50, // 0.5% }); // Create Raydium CPMM pool const pool = await agent.methods.createRaydiumCpmm({ mintA: "token_a_mint", mintB: "token_b_mint", configId: "config_id", mintAAmount: 1000, mintBAmount: 1000, });
@solana-agent-kit/plugin-misc)| Action | Description | |--------|-------------| | airdrop | ZK-compressed airdrop via Helius | | getPrice | Get token price via CoinGecko | | registerDomain | Register .sol domain | | resolveDomain | Resolve domain to address | | getTPS | Get network TPS |
typescript// Compressed airdrop (cost-efficient) const airdrop = await agent.methods.sendCompressedAirdrop({ mintAddress: "token_mint", amount: 100, recipients: ["addr1", "addr2", "addr3"], priorityFeeInLamports: 10000, }); // Get token price const price = await agent.methods.getPrice({ tokenId: "solana", // CoinGecko ID });
@solana-agent-kit/plugin-blinks)Execute Solana Actions/Blinks directly:
typescript// Execute a Blink const result = await agent.methods.executeBlink({ blinkUrl: "https://example.com/blink", params: { /* blink-specific params */ }, });
typescriptimport { SolanaAgentKit, createSolanaTools } from "solana-agent-kit"; import { ChatOpenAI } from "@langchain/openai"; import { createReactAgent } from "@langchain/langgraph/prebuilt"; import { MemorySaver } from "@langchain/langgraph"; import { HumanMessage } from "@langchain/core/messages"; async function createLangChainAgent() { // Initialize LLM const llm = new ChatOpenAI({ modelName: "gpt-4-turbo-preview", temperature: 0.7, }); // Initialize Solana Agent Kit const solanaKit = new SolanaAgentKit( wallet, process.env.RPC_URL!, { OPENAI_API_KEY: process.env.OPENAI_API_KEY! } ) .use(TokenPlugin) .use(DefiPlugin); // Create LangChain tools const tools = createSolanaTools(solanaKit); // Create agent with memory const memory = new MemorySaver(); const agent = createReactAgent({ llm, tools, checkpointSaver: memory, }); return agent; } // Run agent async function chat(agent: any, message: string) { const config = { configurable: { thread_id: "solana-agent" } }; const stream = await agent.stream( { messages: [new HumanMessage(message)] }, config ); for await (const chunk of stream) { if ("agent" in chunk) { console.log(chunk.agent.messages[0].content); } } }
typescriptimport { SolanaAgentKit, createVercelAITools } from "solana-agent-kit"; import { openai } from "@ai-sdk/openai"; import { generateText } from "ai"; async function runVercelAgent(prompt: string) { const agent = new SolanaAgentKit(wallet, rpcUrl, options) .use(TokenPlugin) .use(DefiPlugin); const tools = createVercelAITools(agent, agent.actions); const result = await generateText({ model: openai("gpt-4-turbo"), tools, maxSteps: 10, prompt, }); return result.text; } // Usage const response = await runVercelAgent( "Swap 0.1 SOL for USDC using the best rate" );
Install and configure the MCP server for Claude Desktop:
bash# Install globally npm install -g solana-mcp # Or run directly npx solana-mcp
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
json{ "mcpServers": { "solana": { "command": "npx", "args": ["solana-mcp"], "env": { "RPC_URL": "https://api.mainnet-beta.solana.com", "SOLANA_PRIVATE_KEY": "your_base58_private_key", "OPENAI_API_KEY": "your_openai_key" } } } }
Available MCP tools:
GET_ASSET - Get token/asset infoDEPLOY_TOKEN - Create new tokenGET_PRICE - Fetch token priceWALLET_ADDRESS - Get wallet addressBALANCE - Check balanceTRANSFER - Send tokensMINT_NFT - Create NFTTRADE - Execute swapREQUEST_FUNDS - Get devnet SOLRESOLVE_DOMAIN - Lookup .sol domainGET_TPS - Network throughputRun agent in fully autonomous mode:
typescriptimport { SolanaAgentKit } from "solana-agent-kit"; const agent = new SolanaAgentKit(wallet, rpcUrl, options) .use(TokenPlugin) .use(DefiPlugin); // Configure autonomous behavior const autonomousConfig = { intervalMs: 60000, // Check every minute maxActions: 100, // Max actions per session errorRecovery: true, // Auto-retry on failures dryRun: false, // Set true for testing }; // Start autonomous loop async function runAutonomous() { while (true) { try { // Agent decides what to do based on market conditions const decision = await agent.analyze({ context: "Monitor my portfolio and rebalance if needed", constraints: [ "Keep at least 1 SOL for gas", "Max 10% allocation per token", ], }); if (decision.shouldAct) { await agent.execute(decision.action); } await sleep(autonomousConfig.intervalMs); } catch (error) { if (autonomousConfig.errorRecovery) { console.error("Error, recovering:", error); await sleep(5000); } else { throw error; } } } }
Extend the agent with custom actions:
typescriptimport { Action, Tool, SolanaAgentKit } from "solana-agent-kit"; // Define the Tool (tells LLM HOW to use it) const myCustomTool: Tool = { name: "my_custom_action", description: "Does something custom on Solana", parameters: { type: "object", properties: { param1: { type: "string", description: "First parameter", }, param2: { type: "number", description: "Second parameter", }, }, required: ["param1"], }, }; // Define the Action (tells agent WHEN and WHY to use it) const myCustomAction: Action = { name: "my_custom_action", description: "Use this when you need to do something custom", similes: ["custom thing", "special operation"], examples: [ { input: "Do the custom thing with value X", output: "Custom action executed with param1=X", }, ], handler: async (agent: SolanaAgentKit, params: any) => { const { param1, param2 } = params; // Your custom logic here const connection = agent.connection; const wallet = agent.wallet; // Execute Solana operations... return { success: true, result: `Executed with ${param1}`, }; }, }; // Register custom action agent.registerAction(myCustomAction); agent.registerTool(myCustomTool);
solana-agent-kit/
├── SKILL.md # This file
├── resources/
│ ├── actions-reference.md # Complete actions list
│ ├── plugins-guide.md # Plugin deep dive
│ └── security-checklist.md # Security best practices
├── examples/
│ ├── langchain/ # LangChain integration
│ ├── vercel-ai/ # Vercel AI SDK
│ ├── mcp-server/ # Claude MCP setup
│ └── autonomous-agent/ # Autonomous patterns
├── templates/
│ └── agent-template.ts # Starter template
└── docs/
├── custom-actions.md # Creating custom actions
└── troubleshooting.md # Common issuesVersion 2 represents a complete evolution of the toolkit with key improvements:
V2 directly addresses two major V1 challenges:
The modular plugin system lets you install only what you need, reducing context bloat and hallucinations.
V2 integrates with secure wallet providers for enhanced security:
typescriptimport { TurnkeyWallet, PrivyWallet } from "solana-agent-kit/wallets"; // Turnkey - fine-grained rules and policies const turnkeyWallet = new TurnkeyWallet({ organizationId: process.env.TURNKEY_ORG_ID, privateKeyId: process.env.TURNKEY_PRIVATE_KEY_ID, }); // Privy - human-in-the-loop confirmation const privyWallet = new PrivyWallet({ appId: process.env.PRIVY_APP_ID, requireConfirmation: true, }); // Initialize agent with secure wallet const agent = new SolanaAgentKit(turnkeyWallet, rpcUrl, options) .use(TokenPlugin) .use(DefiPlugin);
| Feature | V1 | V2 | |---------|----|----| | Wallet Security | Private key input | Embedded wallets (Turnkey, Privy) | | Tool Loading | All 100+ tools | Plugin-based, load what you need | | LLM Context | Large, caused hallucinations | Minimal, focused context | | Human-in-loop | Not supported | Native with Privy |
solana-agent-kit-py| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 19,409 | 17,114 | -12% | 1 | 1 | 0% | 3,011 | 6,597 | +119% | 0 | 0 | — |
case-02 | fail→pass | 12,425 | 6,991 | -44% | 1 | 1 | 0% | 1,298 | 5,529 | +326% | 0 | 0 | — |
case-03 | fail→pass | 18,015 | 32,806 | +82% | 1 | 1 | 0% | 3,450 | 7,328 | +112% | 0 | 0 | — |
case-04 | pass→pass | 5,769 | 9,486 | +64% | 1 | 1 | 0% | 1,112 | 5,212 | +369% | 0 | 0 | — |
case-05 | fail→pass | 11,686 | 3,082 | -74% | 1 | 1 | 0% | 2,206 | 4,969 | +125% | 0 | 0 | — |
case-06 | fail→pass | 11,203 | 5,331 | -52% | 1 | 1 | 0% | 2,242 | 5,511 | +146% | 0 | 0 | — |
case-07 | fail→pass | 17,563 | 9,017 | -49% | 1 | 1 | 0% | 1,539 | 5,088 | +231% | 0 | 0 | — |
case-08 | fail→pass | 17,639 | 8,266 | -53% | 1 | 1 | 0% | 3,337 | 5,035 | +51% | 0 | 0 | — |
case-09 | fail→pass | 21,311 | 11,387 | -47% | 1 | 1 | 0% | 2,779 | 5,566 | +100% | 0 | 0 | — |
case-10 | fail→pass | 16,383 | 9,334 | -43% | 1 | 1 | 0% | 2,010 | 5,255 | +161% | 0 | 0 | — |
case-11 | fail→pass | 7,529 | 2,886 | -62% | 1 | 1 | 0% | 1,303 | 4,927 | +278% | 0 | 0 | — |
case-12 | fail→pass | 11,579 | 2,581 | -78% | 1 | 1 | 0% | 2,116 | 4,885 | +131% | 0 | 0 | — |
case-13 | fail→pass | 41,133 | 8,950 | -78% | 1 | 1 | 0% | 6,614 | 4,780 | -28% | 0 | 0 | — |
case-14 | fail→pass | 24,820 | 2,545 | -90% | 1 | 1 | 0% | 3,497 | 4,770 | +36% | 0 | 0 | — |
case-15 | fail→pass | 16,490 | 11,717 | -29% | 1 | 1 | 0% | 2,800 | 5,665 | +102% | 0 | 0 | — |
case-16 | pass→pass | 6,942 | 2,277 | -67% | 1 | 1 | 0% | 1,070 | 4,779 | +347% | 0 | 0 | — |
case-17 | fail→pass | 10,791 | 7,640 | -29% | 1 | 1 | 0% | 1,771 | 4,831 | +173% | 0 | 0 | — |
case-18 | fail→pass | 14,993 | 7,406 | -51% | 1 | 1 | 0% | 2,596 | 4,786 | +84% | 0 | 0 | — |
case-19 | pass→pass | 13,251 | 8,618 | -35% | 1 | 1 | 0% | 1,478 | 5,013 | +239% | 0 | 0 | — |
case-20 | fail→pass | 11,574 | 7,747 | -33% | 1 | 1 | 0% | 2,071 | 4,821 | +133% | 0 | 0 | — |
case-21 | pass→pass | 15,310 | 13,978 | -9% | 1 | 1 | 0% | 2,975 | 6,091 | +105% | 0 | 0 | — |
case-22 | pass→pass | 16,078 | 10,914 | -32% | 1 | 1 | 0% | 2,101 | 6,387 | +204% | 0 | 0 | — |
case-23 | pass→pass | 16,394 | 23,372 | +43% | 1 | 1 | 0% | 2,690 | 7,803 | +190% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +70 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.