SQL Agent CLI Documentation
Complete command reference and user guide
Getting Started
After downloading and installing SQL Agent CLI, open your terminal and follow these steps:
- Verify installation:
sql-agent --help - Login with your license key:
sql-agent login YOUR-API-KEY - Configure your AI provider:
sql-agent setup-ai - Connect to a database:
sql-agent connect --url "postgresql://user:pass@host/db"
Authentication
sql-agent login <api-key>
Authenticate with your API key to enable SQL Agent features.
Your API key can be found in your cabinet after purchasing a license.
sql-agent logout
Remove stored API key and log out of SQL Agent.
AI Provider Configuration
sql-agent setup-ai
Interactive wizard to configure your AI provider and model.
# Follow the prompts to select provider and model
Supported Providers:
- OpenAI — GPT-4o, GPT-4, GPT-3.5-turbo
- Anthropic — Claude Opus, Claude Sonnet, Claude Haiku
- DeepSeek — DeepSeek Chat, DeepSeek Coder
- Groq — Llama 3.3 70B, Llama 3.1 8B
- Ollama — Local models (no API key required)
Manual Configuration
You can also configure the AI provider manually:
Database Connection
sql-agent connect --url <database-url>
Connect to a database and start an interactive session.
Options:
--url, -u— Database connection URL (required)--profile, -p— Save connection as a named profile--read-only— Connect in read-only mode (default)--write— Enable write operations
Examples:
sql-agent use-profile <name>
Connect to a database using a previously saved profile.
Profile Management
sql-agent profiles
List all saved database connection profiles.
sql-agent delete-profile <name>
Remove a saved database profile.
sql-agent export-profiles
Export all saved profiles to a JSON file.
Configuration Settings
sql-agent configuration [key] [--value value]
View and update configuration settings.
Common Settings:
History Modes:
short— ~5 message exchangesmedium— ~10 message exchanges (default)long— ~15 message exchangesunlimited— No message limit
Interactive Session Commands
These commands are available after connecting to a database:
| Command | Description |
|---|---|
help |
Show available interactive commands |
schema |
Display complete database schema with all tables and columns |
/insights <table> |
Get AI-powered insights about a specific table |
/explain <query> |
Show query execution plan with optimization recommendations |
/analyze <query> |
AI-powered query performance analysis with suggestions |
history |
Show recent query history |
clear |
Clear conversation history and start fresh |
exit |
Quit the interactive session |
Natural Language Queries
Simply type your question in plain English:
Query History
sql-agent history
View or clear query execution history.
Options:
--limit, -n— Number of entries to show (default: 20)--clear— Clear all query history
Security Features
Read-Only Mode
By default, SQL Agent connects in read-only mode to protect your data. The following operations are blocked:
- INSERT, UPDATE, DELETE
- DROP, TRUNCATE, CREATE, ALTER
To enable write operations, use the --write flag when connecting.
Encrypted Storage
All sensitive data (API keys, database credentials) is encrypted using Fernet encryption and stored locally on your machine. Your data is never transmitted to our servers.
Query Timeout
Queries are automatically terminated after 30 seconds (configurable) to prevent runaway queries.