SAM Framework provides a comprehensive command-line interface for all operations. The CLI is designed to be intuitive and handles both interactive agent sessions and administrative tasks.
sam [command] [options]
sam run - Interactive AgentStart the main SAM agent in interactive mode for natural language blockchain operations.
Usage:
sam run [--session SESSION_ID] sam [--session SESSION_ID] # Short form - run is default
Options:
--session, -s: Session ID for conversation context (default: "default")Examples:
# Start with default session sam # Start with custom session sam --session trading_session # Short form sam -s my_session
Interactive Commands: Once in interactive mode, use these slash commands:
| Command | Description |
|---------|-------------|
| /help, /? | Show available commands |
| /tools | List all available tools |
| /config | Show current configuration |
| /provider | Manage LLM providers |
| /settings | Interactive configuration editor |
| /clear, /cls | Clear screen |
| /clear-context | Clear conversation context |
| /compact | Compact conversation history |
| /wallet | Show wallet address |
| /balance [address] | Check balance for address |
| /switch <provider> | Switch LLM provider |
| exit, quit, /exit | Exit interactive mode |
| ESC | Interrupt current operation |
| Ctrl+C | Force exit |
Command Palette:
Type / to access the interactive command menu with picker interface.
sam onboard - Setup WizardRun the interactive setup wizard to configure SAM with optimal defaults.
Usage:
sam onboard
What it configures:
sam key import - Import Private KeySecurely import and encrypt your Solana private key using system keyring.
Usage:
sam key import
Process:
Security Features:
sam key generate - Generate Encryption KeyGenerate a new Fernet encryption key for secure data encryption.
Usage:
sam key generate
What it does:
.env file automaticallysam setup - Setup Status CheckCheck configuration status and validate all required settings.
Usage:
sam setup
Validations Performed:
sam health - System Health CheckComprehensive system health diagnostics and status reporting.
Usage:
sam health
Health Checks:
sam tools - List Available ToolsDisplay all available tools organized by category.
Usage:
sam tools
Output Categories:
sam provider list - List Available ProvidersDisplay all supported LLM providers and their status.
Usage:
sam provider list
Shows:
sam provider current - Show Current ProviderDisplay detailed information about the currently active LLM provider.
Usage:
sam provider current
Information Displayed:
sam provider switch - Switch ProviderSwitch to a different LLM provider with validation.
Usage:
sam provider switch <provider_name>
Parameters:
provider_name: One of openai, anthropic, xai, openai_compat, localProcess:
Examples:
sam provider switch anthropic sam provider switch xai
sam provider test - Test Provider ConnectionTest the connection and functionality of the current or specified provider.
Usage:
sam provider test [--provider PROVIDER_NAME]
Options:
--provider: Specific provider to test (defaults to current)Tests Performed:
sam settings - Configuration EditorLaunch the interactive configuration editor for runtime settings management.
Usage:
sam settings
Configurable Options:
Features:
sam maintenance - Database MaintenanceRun database cleanup and optimization tasks.
Usage:
sam maintenance
Maintenance Tasks:
sam debug - Runtime InspectionInspect loaded plugins, middlewares, and tool configurations.
Usage:
sam debug
Debug Information:
| Command | Description | Category |
|---------|-------------|----------|
| sam | Start interactive agent | Core |
| sam run [--session ID] | Start agent with session | Core |
| sam onboard | Run setup wizard | Setup |
| sam key import | Import private key securely | Security |
| sam key generate | Generate encryption key | Security |
| sam provider list | List available LLM providers | Provider Management |
| sam provider current | Show current provider | Provider Management |
| sam provider switch <name> | Switch to different provider | Provider Management |
| sam provider test [--provider NAME] | Test provider connection | Provider Management |
| sam settings | Interactive configuration editor | Configuration |
| sam setup | Check setup status | Configuration |
| sam health | System health check | Monitoring |
| sam tools | List available tools | Information |
| sam debug | Show plugins and middleware info | Debugging |
| sam maintenance | Database maintenance | Maintenance |
Control logging verbosity across all commands.
Usage:
sam [command] --log-level LEVEL
Available Levels:
DEBUG: Detailed debugging informationINFO: General information (default)WARNING: Warning messages onlyERROR: Error messages onlyExamples:
# Debug mode for troubleshooting sam --log-level DEBUG # Minimal logging for production sam health --log-level WARNING
# Check available providers sam provider list # Switch to different provider sam provider switch anthropic # Test provider connection sam provider test # View current provider details sam provider current
# Initial setup sam onboard # Configure providers and settings sam settings # Development with debug logging sam --log-level DEBUG # Test configuration sam setup # Inspect runtime state sam debug # Check system health sam health
# Health check before deployment sam health # Run with minimal logging sam --log-level WARNING # Regular maintenance sam maintenance # Monitor provider performance sam provider test
# Test plugin loading export SAM_PLUGINS="my_plugin" sam debug # Verify tool registration sam tools # Test plugin functionality sam --log-level DEBUG
# Debug mode for issue investigation sam --log-level DEBUG setup # Check tool availability sam tools # Inspect plugins and middleware sam debug # Test provider connectivity sam provider test # Verify configuration sam setup
| Code | Meaning | Action |
|------|---------|--------|
| 0 | Success | No action needed |
| 1 | General error | Check error message |
| 130 | Keyboard interrupt | User cancelled operation |
Configuration Errors:
ā OPENAI_API_KEY is required # Solution: Run sam onboard or set OPENAI_API_KEY in .env ā SAM_FERNET_KEY is required for secure storage # Solution: Run sam key generate
Connectivity Errors:
ā Failed to connect to Solana RPC # Solution: Check SAM_SOLANA_RPC_URL or network connectivity ā OpenAI API authentication failed # Solution: Verify OPENAI_API_KEY is valid
Security Errors:
ā System keyring not available # Solution: Install keyring dependencies or use environment variables ā Private key decryption failed # Solution: Verify SAM_FERNET_KEY matches encryption key
SAM recognizes various natural language patterns:
# Balance checking "check my balance" "show wallet balance" "get SOL balance" # Trading commands "buy 0.01 SOL of BONK" "sell 50% of my DOGE" "get swap quote for 1 SOL to USDC"
# Start fresh conversation /clear-context # Compact conversation history /compact # Switch sessions sam --session new_session
Context Management Features:
Available in interactive mode via context info:
Context: 15 msgs ⢠Tokens: 2,450 ⢠Requests: 8
model:gpt-4o-mini ⢠ctx:45% (36/80) ⢠wallet:EPjF...TDt1v
Status Display Features:
gpt-4o-mini, claude-3-5-sonnet-latest)sam health
Provides:
# Run with specific session (non-interactive setup required) echo "check balance" | sam run --session automated # Configuration validation in scripts sam setup && echo "Setup OK" || echo "Setup failed"
# Set log level for all commands export SAM_LOG_LEVEL=WARNING # Disable interactive prompts export SAM_NON_INTERACTIVE=true
# General help sam --help # Command-specific help sam run --help sam key --help
# In interactive mode /help # Show all commands /tools # List available tools /config # Show current configuration
sam healthsam --log-level DEBUG for detailed troubleshootingsam health regularly to monitor system status--session for organizationsam onboard) configures everything automatically