sam-framework

sep 5, 2025

AI agent framework for Solana blockchain operations and memecoin trading

overview

SAM (Solana Agent Middleware) is an AI-powered framework for Solana blockchain operations. It provides 15 production-ready tools for automated trading, portfolio management, market data, and web search capabilities.

key features

• 15 production-ready tools for Solana ecosystem
• Secure key management with Fernet encryption
• Async architecture for high-performance trading
• Persistent memory with conversation context
• Rate limiting and safety protection
• Clean CLI interface with comprehensive commands

supported platforms

• Pump.fun automated trading
• Jupiter DEX aggregator
• DexScreener market data
• Brave Search API integration
• Multi-LLM provider support
• Native Solana operations

architecture

core components

cli.py — Command-line interface
core/agent.py — Main SAMAgent class
core/llm_provider.py — Multi-LLM providers
core/memory.py — Conversation persistence
core/tools.py — Tool registry and execution

integrations

solana/ — Native Solana operations
pump_fun.py — Pump.fun trading
jupiter.py — Jupiter aggregator
dexscreener.py — Market data
search.py — Web search (Brave API)

available tools

trading & wallet

get_balance - Complete wallet overview
transfer_sol - Send SOL between addresses
pump_fun_buy - Buy tokens on pump.fun
pump_fun_sell - Sell tokens on pump.fun
jupiter_swap - Execute token swaps
get_swap_quote - Get swap quotes

market data & search

search_pairs - Find trading pairs
get_trending_pairs - Trending pairs by chain
get_solana_pair - Detailed pair information
search_web - Search internet content
search_news - Search news articles
get_token_data - Token metadata and supply

setup

installation

git clone https://github.com/prfagit/sam-framework
cd sam-framework
uv sync

configuration

# Choose LLM provider
LLM_PROVIDER=openai
OPENAI_API_KEY=your_openai_api_key
# Required for secure storage
SAM_FERNET_KEY=your_generated_key
# Optional integrations
BRAVE_API_KEY=your_brave_api_key

first run

uv run sam onboard

Interactive setup wizard for configuration

usage examples

trading operations

"Buy 0.01 SOL worth of BONK on pump.fun"
"Sell 50% of my DOGE position"
"Get swap quote for 1 SOL to USDC"

market analysis

"Show trending pairs on DexScreener"
"Search for BONK trading pairs"
"Search for Solana ecosystem news"

security & safety

key management

• Fernet encryption for private keys
• OS keyring integration
• Secure credential storage
• Address validation and verification

risk controls

• Transaction validation and limits
• Configurable slippage tolerance
• Rate limiting protection
• Pre-execution safety checks

development

# Run test suite
uv run pytest tests/ -v
# Code quality
uv run ruff format
uv run ruff check --fix
uv run mypy sam/