solana-agent-kit

作者 davidpc007已验证

solana ai agent toolkit for modular monorepo with plugin architecture, first-class support for langchain, vercel ai sdk, openai agents and claude

130
Stars
1,054
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/davidpc007/solana-agent-kit

快速入门

使用 solana-agent-kit 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Solana Agent Kit

Production-ready TypeScript toolkit for connecting AI agents to Solana blockchain protocols. Built as a modular monorepo with plugin architecture, optional Redis persistence, and first-class support for LangChain, Vercel AI SDK, OpenAI Agents, and Claude.


Overview

Solana Agent Kit provides a unified interface for AI agents to perform on-chain operations — token transfers, DeFi interactions, NFT management, cross-chain bridging, and more — through a composable plugin system.

CapabilityDescription
Plugin architectureInstall only the protocol bundles you need
Multi-AI supportLangChain, Vercel AI, OpenAI, Claude, MCP adapters
Wallet flexibilityKeypair, Open Wallet Standard, embedded wallet providers
Optional Redis cachePersistent caching with graceful in-memory fallback
Strict TypeScriptFull type safety across core and plugin APIs

Architecture

graph TB
    subgraph AI Layer
        LC[LangChain Tools]
        VA[Vercel AI Tools]
        OA[OpenAI Tools]
        CL[Claude Tools]
        MCP[MCP Server]
    end

    subgraph Core
        SAK[SolanaAgentKit]
        WAL[Wallet Adapter]
        CFG[Config / Env]
        LOG[Logger]
        PERS[Persistence Layer]
    end

    subgraph Plugins
        PT[plugin-token]
        PN[plugin-nft]
        PD[plugin-defi]
        PM[plugin-misc]
        PB[plugin-blinks]
    end

    subgraph Infrastructure
        RPC[Solana RPC]
        REDIS[(Redis Cache)]
    end

    LC --> SAK
    VA --> SAK
    OA --> SAK
    CL --> SAK
    MCP --> SAK

    SAK --> WAL
    SAK --> CFG
    SAK --> LOG
    SAK --> PERS
    SAK --> PT
    SAK --> PN
    SAK --> PD
    SAK --> PM
    SAK --> PB

    WAL --> RPC
    PERS --> REDIS

Agent Workflow

sequenceDiagram
    participant User
    participant AI as AI Framework
    participant Agent as SolanaAgentKit
    participant Plugin
    participant Chain as Solana RPC

    User->>AI: Natural language request
    AI->>Agent: Invoke action tool
    Agent->>Plugin: Execute handler
    Plugin->>Chain: Build & sign transaction
    Chain-->>Plugin: Confirmation
    Plugin-->>Agent: Result
    Agent-->>AI: Structured response
    AI-->>User: Human-readable output

Feature Highlights

  • 60+ protocol actions across token, DeFi, NFT, and misc categories
  • Composable plugins — chain .use() calls to build your agent
  • Dual API surface — programmatic methods and AI-facing actions
  • Redis persistence — optional caching layer with retry, graceful shutdown, and memory fallback
  • Structured logging — configurable log levels via LOG_LEVEL
  • Cross-platform builds — Windows-compatible clean scripts via rimraf
  • Automated validation — typecheck, lint, test, and build in a single command

Installation

Prerequisites

  • Node.js >= 22
  • pnpm >= 8

Setup

git clone https://github.com/sendaifun/solana-agent-kit.git
cd solana-agent-kit
pnpm install
pnpm build

Package Installation (consumers)

pnpm add solana-agent-kit @solana-agent-kit/plugin-token

Quick Start

import { Keypair } from "@solana/web3.js";
import bs58 from "bs58";
import { SolanaAgentKit, KeypairWallet, createVercelAITools } from "solana-agent-kit";
import TokenPlugin from "@solana-agent-kit/plugin-token";

const keypair = Keypair.fromSecretKey(bs58.decode(process.env.SOLANA_PRIVATE_KEY!));

const agent = new SolanaAgentKit(
  new KeypairWallet(keypair, process.env.RPC_URL!),
  process.env.RPC_URL!,
  { OPENAI_API_KEY: process.env.OPENAI_API_KEY },
).use(TokenPlugin);

const tools = createVercelAITools(agent);

Configuration

Copy the example environment file and fill in your values:

cp .env.example .env

Required Variables

VariableDescription
RPC_URLSolana RPC endpoint
SOLANA_PRIVATE_KEYBase58-encoded secret key
OPENAI_API_KEYOpenAI API key (for AI integrations)

Optional — Redis Persistence

VariableDefaultDescription
REDIS_ENABLEDfalseEnable Redis caching
REDIS_URLFull Redis connection URL (overrides host/port)
REDIS_HOST127.0.0.1Redis host
REDIS_PORT6379Redis port
REDIS_PASSWORDRedis password
REDIS_DB0Redis database index
REDIS_KEY_PREFIXsolana-agent-kit:Key namespace prefix
REDIS_CACHE_TTL_SECONDS60Fresh cache TTL
REDIS_STALE_TTL_SECONDS21600Stale-while-revalidate TTL

Logging

VariableDefaultDescription
LOG_LEVELinfoOne of debug, info, warn, error

Using Redis Persistence

import { createPersistenceLayer } from "solana-agent-kit";

const persistence = await createPersistenceLayer();
await persistence.cache.set("wallet:balance", { sol: 1.5 });
const balance = await persistence.cache.get("wallet:balance");

// Graceful shutdown
await persistence.shutdown();

Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Type check
pnpm typecheck

# Lint
pnpm lint

# Run unit tests
pnpm test

# Full validation pipeline
pnpm validate

# Generate a new Solana keypair
pnpm generate

# Interactive integration tests (requires .env)
pnpm test:integration

Per-Package Builds

pnpm build:core
pnpm build:plugin-token
pnpm build:plugin-defi
pnpm build:plugin-nft
pnpm build:plugin-misc
pnpm build:plugin-blinks
pnpm build:adapter-mcp

Testing

Unit tests use Vitest and cover configuration parsing, cache store behavior, and Redis connection manager state.

# Run all tests
pnpm test

# Watch mode
pnpm test:watch

# Integration tests (manual, requires configured .env)
pnpm test:integration

Project Structure

solana-agent-kit/
├── packages/
│   ├── core/                  # SolanaAgentKit, wallets, AI adapters, persistence
│   │   ├── src/
│   │   │   ├── agent/         # Core agent class
│   │   │   ├── config/        # Environment configuration
│   │   │   ├── errors/        # Typed error hierarchy
│   │   │   ├── persistence/   # Redis connection manager & cache store
│   │   │   ├── utils/         # Logger, wallet helpers, tx utilities
│   │   │   ├── langchain/     # LangChain tool adapter
│   │   │   ├── vercel-ai/     # Vercel AI SDK adapter
│   │   │   ├── openai/        # OpenAI Agents adapter
│   │   │   └── claude/        # Claude adapter
│   │   └── tests/             # Unit tests
│   ├── plugin-token/          # SPL, Jupiter, Pump.fun, Pyth, etc.
│   ├── plugin-nft/            # Metaplex, 3Land, Magic Eden, Tensor
│   ├── plugin-defi/           # Drift, Raydium, Orca, OKX, deBridge
│   ├── plugin-misc/           # CoinGecko, Helius, Allora, SNS
│   ├── plugin-blinks/         # Solana Blinks actions
│   └── adapter-mcp/           # MCP server wrapper
├── test/                      # Interactive integration test harness
├── examples/                  # Standalone demo applications
├── scripts/                   # Developer utilities
├── docs/                      # Generated API docs + internal notes
├── vitest.config.ts           # Test runner configuration
├── turbo.json                 # Monorepo build orchestration
└── biome.json                 # Linter and formatter

Design Decisions

  • Plugins over monolith — each protocol bundle is independently installable and versioned
  • Actions + Tools splittools/ for low-level Solana calls, actions/ for AI-facing wrappers with Zod schemas
  • Persistence in core — Redis integration lives in packages/core so all plugins benefit from shared caching
  • Examples excluded from workspace — demo apps manage their own dependencies to avoid version conflicts

Troubleshooting

Build fails on Windows

Ensure you are using the updated clean scripts (rimraf instead of rm -rf). Run pnpm install to pick up the latest scripts.

Redis connection refused

Set REDIS_ENABLED=false to use in-memory caching only. The agent kit degrades gracefully when Redis is unavailable.

Type errors after plugin install

Ensure peer dependency versions match. Run pnpm typecheck to identify mismatches.

pnpm test vs pnpm test:integration

  • pnpm test — automated Vitest unit tests (no network required)
  • pnpm test:integration — interactive harness requiring .env with RPC URL and private key

Action limit warning

AI adapters truncate at 128 actions when many plugins are loaded. Install only the plugins you need.


FAQ

Q: Do I need Redis? No. Redis is optional. When disabled or unreachable, the cache store operates entirely in memory.

Q: Which AI framework should I use? All four adapters (LangChain, Vercel AI, OpenAI, Claude) expose the same underlying actions. Choose based on your existing stack.

Q: Can I create custom plugins? Yes. Implement the Plugin interface with name, methods, actions, and initialize.

Q: Is this safe for production? The toolkit handles private keys and transaction signing. Never commit secrets, use environment variables, and audit plugin actions before deploying.

Q: How do I migrate from v1? See MIGRATING.md for the v1 → v2 plugin architecture migration guide.


Contributing

See CONTRIBUTING.md for development setup, code style, and pull request guidelines.

License

Apache-2.0 — see LICENSE.

常见问题

What is solana-agent-kit?

solana-agent-kit is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by davidpc007. solana ai agent toolkit for modular monorepo with plugin architecture, first-class support for langchain, vercel ai sdk, openai agents and claude. It has 130 GitHub stars.

Is solana-agent-kit safe to use?

Yes. solana-agent-kit passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install solana-agent-kit?

Clone the repository with "git clone https://github.com/davidpc007/solana-agent-kit" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is solana-agent-kit written in?

solana-agent-kit is primarily written in TypeScript. It is open-source under davidpc007 on GitHub, so you can review or fork the full source.

Are there alternatives to solana-agent-kit?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh solana-agent-kit against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情
solana-agent-kit — Claude Code AI Skill | SkillTip