Getting Started

Getting Started with SAM Framework

๐Ÿ“‹ Prerequisites

Before installing SAM, ensure you have the following:

  • Python 3.11+ installed on your system
  • OpenAI API Key with sufficient credits for GPT usage
  • Internet connection for blockchain operations
  • Optional: Brave Search API key for web search functionality

๐Ÿš€ Installation

Step 1: Clone the Repository

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

Step 2: Install Dependencies

# Using uv (recommended)
uv sync

# Or using pip
pip install -r requirements.txt

Step 3: Verify Installation

uv run sam --help

You should see the SAM CLI help output if installation was successful.

โš™๏ธ Configuration

Required Setup

Environment Variables

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 Encryption Key

# Generate a new Fernet encryption key
uv run sam key generate

Import Private Key

# Securely import your Solana private key
uv run sam key import

Configuration Validation

# Check your setup status
uv run sam setup

This command will verify:

  • โœ… OpenAI API key configuration
  • โœ… Encryption key presence
  • โœ… Solana RPC connectivity
  • โœ… Wallet configuration status

๐ŸŽฏ First Run

Start the Interactive Agent

# Start SAM in interactive mode
uv run sam

# Or specify a custom session
uv run sam --session trading_session

Initial Interaction

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

๐Ÿ“– Basic Usage Examples

Wallet Operations

# 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]"

Trading Operations

# 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"

Market Data

# 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]"

Web Search

# Search for Solana news
"search for Solana ecosystem news"

# Find information about DEX launches
"find information about new DEX launches"

๐Ÿ”ง Advanced Configuration

Environment Variables Reference

| 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 | โŒ |

Security Configuration

# Enable production security settings
export RATE_LIMITING_ENABLED=true
export LOG_LEVEL=WARNING
export MAX_TRANSACTION_SOL=10.0

๐Ÿงช Testing Your Setup

Health Check

# Run comprehensive health diagnostics
uv run sam health

Test Commands

# 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"

๐ŸŽ‰ Next Steps

Now that you have SAM configured and running, you can:

  1. Explore the Tools: Use /tools command to see all available functions
  2. Learn the CLI: Check /help for available commands
  3. Configure Advanced Settings: Review the Configuration Guide
  4. Understand Security: Read the Security Guide
  5. View Architecture: Learn about SAM's Architecture

Getting Help


๐ŸŽฏ Quick Tips

  • โ€ข Start with small amounts when testing new tokens
  • โ€ข Use /clear-context to start fresh conversations
  • โ€ข Check /config to see your current settings
  • โ€ข Monitor your balance regularly with wallet operations