Before installing SAM, ensure you have the following:
SAM Framework requires Python 3.11 or higher due to modern async features and type annotations.
git clone https://github.com/prfagit/sam-framework cd sam-framework
# Using uv (recommended) uv sync # Or using pip pip install -r requirements.txt
uv run sam --help
You should see the SAM CLI help output if installation was successful.
Create a .env
file in the project root:
# Required OPENAI_API_KEY=sk-your-openai-api-key-here SAM_FERNET_KEY=your-generated-encryption-key # Optional BRAVE_API_KEY=your-brave-search-api-key SAM_SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
# Generate a new Fernet encryption key uv run sam key generate
# Securely import your Solana private key uv run sam key import
# Check your setup status uv run sam setup
This command will verify:
# Start SAM in interactive mode uv run sam # Or specify a custom session uv run sam --session trading_session
Once started, SAM will display a welcome message and you can begin interacting:
๐ค SAM โข Solana Agent โข
Type /help for commands. Ctrl+C to exit.
๐ค ยป check my balance
# Check your complete wallet balance "check my wallet balance" # View SOL balance only "show my SOL balance" # Transfer SOL to another address "send 0.1 SOL to [recipient_address]"
# Buy on Pump.fun "buy 0.01 SOL worth of BONK" # Sell tokens "sell 50% of my DOGE position" # Get swap quotes "get swap quote for 1 SOL to USDC on Jupiter"
# View trending pairs "show trending pairs on DexScreener" # Search for specific tokens "search for BONK trading pairs" # Get detailed pair information "get detailed info for pair [pair_address]"
# Search for Solana news "search for Solana ecosystem news" # Find information about DEX launches "find information about new DEX launches"
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| OPENAI_API_KEY
| Your OpenAI API key | - | โ
|
| SAM_FERNET_KEY
| Fernet encryption key | - | โ
|
| SAM_WALLET_PRIVATE_KEY
| Solana private key | - | โ |
| BRAVE_API_KEY
| Brave Search API key | - | โ |
| SAM_SOLANA_RPC_URL
| Solana RPC endpoint | https://api.mainnet-beta.solana.com
| โ |
| SAM_DB_PATH
| Database file path | .sam/sam_memory.db
| โ |
| RATE_LIMITING_ENABLED
| Enable rate limiting | false
| โ |
| MAX_TRANSACTION_SOL
| Max transaction size | 1000.0
| โ |
| DEFAULT_SLIPPAGE
| Default slippage % | 1
| โ |
| LOG_LEVEL
| Logging level | INFO
| โ |
Important: Never commit your .env
file or share your private keys. Always use the secure key import feature.
# Enable production security settings export RATE_LIMITING_ENABLED=true export LOG_LEVEL=WARNING export MAX_TRANSACTION_SOL=10.0
# Run comprehensive health diagnostics uv run sam health
# Test wallet connection (no funds required) "get wallet address" # Test market data access "show trending pairs" # Test search functionality (if Brave API configured) "search for Solana news"
Now that you have SAM configured and running, you can:
/tools
command to see all available functions/help
for available commands/help
in SAM CLI/clear-context
to start fresh conversations/config
to see your current settings