Ask RITA provides a command-line interface for running queries, testing configurations, starting interactive sessions, and launching the MCP server.
- Installation
- Commands Overview
- Common Flags
- askrita query
- askrita interactive
- askrita test
- askrita mcp
- Examples
- Troubleshooting
The askrita command is installed automatically with the package:
pip install askritaVerify the installation:
askrita --help| Command | Description |
|---|---|
askrita query |
Run a single natural-language query and print the result |
askrita interactive |
Start an interactive REPL session |
askrita test |
Test your configuration, database, and LLM connections |
askrita mcp |
Start the Model Context Protocol (MCP) server |
These flags are available on all subcommands:
| Flag | Short | Description |
|---|---|---|
--config PATH |
-c PATH |
Path to YAML configuration file |
--verbose |
-v |
Enable debug logging (sets root logger to DEBUG) |
The config path is validated:
- Must end with
.yamlor.yml - Must not contain
..(path traversal) - File must exist
Run a single natural-language question against your database and print the result.
askrita query [OPTIONS] QUESTION
| Argument | Required | Description |
|---|---|---|
QUESTION |
Yes | The natural-language question (positional) |
| Flag | Default | Description |
|---|---|---|
--config PATH |
— | Path to YAML config file |
--format FORMAT |
From config | Output format: json, yaml, or text |
--verbose |
— | Enable debug logging |
json (default) — Full WorkflowState as JSON:
askrita query -c config.yaml "How many orders last month?" --format jsonyaml — Full WorkflowState as YAML:
askrita query -c config.yaml "How many orders last month?" --format yamltext — Human-readable summary (answer, visualization, SQL, chart data):
askrita query -c config.yaml "How many orders last month?" --format text- Loads and validates the configuration
- Tests database and LLM connections
- Runs
SQLAgentWorkflow.query(question) - Prints the result in the specified format
Start an interactive REPL session for running multiple queries.
askrita interactive [OPTIONS]
| Flag | Default | Description |
|---|---|---|
--config PATH |
— | Path to YAML config file |
--verbose |
— | Enable debug logging |
- Loads and validates the configuration
- Tests database and LLM connections
- Enters a loop that prompts for questions via
input() - Each question is run through
SQLAgentWorkflow.query() - Results are printed as text (answer and visualization)
Type any of these to exit the session:
exitquitq
$ askrita interactive -c config.yaml
AskRITA Interactive Mode
Type your questions (exit/quit/q to stop)
========================
Ask a question: How many customers do we have?
Answer: There are 1,247 customers in the database.
Ask a question: What is the average order value?
Answer: The average order value is $85.32.
Ask a question: quit
Goodbye!
Note: The interactive mode uses query() per question, not chat(). Each question is processed independently without conversation history. For multi-turn conversations with context, use the Python API with workflow.chat(messages).
Test your configuration, database connection, and LLM connection.
askrita test [OPTIONS]
| Flag | Default | Description |
|---|---|---|
--config PATH |
— | Path to YAML config file |
--verbose |
— | Enable debug logging |
- Loads and validates the configuration
- Prints a summary of database, LLM, and workflow settings
- Tests the database connection
- Tests the LLM connection
- Reports success or failure for each test
$ askrita test -c config.yaml
Configuration Summary:
Database: postgresql://localhost:5432/mydb
LLM Provider: openai
LLM Model: gpt-4o
Testing database connection... ✓ Connected
Testing LLM connection... ✓ Connected
All tests passed!
Start the Model Context Protocol (MCP) server for integration with AI assistants like Claude Desktop.
askrita mcp [OPTIONS]
| Flag | Default | Description |
|---|---|---|
--config PATH |
— | Path to YAML config file |
--log-level LEVEL |
INFO |
Log level for the MCP server |
--verbose |
— | Enable debug logging |
- Loads the configuration
- Starts the MCP server (communicates over stdio)
- Exposes
askrita_queryandaskrita_testas MCP tools
| Tool | Description |
|---|---|
askrita_query |
Run a natural-language query against the configured database |
askrita_test |
Test the configuration and connections |
The MCP server is designed to be launched by AI assistants. See the MCP Server Guide and Claude Desktop Setup for configuration details.
askrita query -c config.yaml "What are the top 5 products by revenue?"askrita query -c config.yaml --format json "Total sales by month" | jq '.answer'askrita query -c config.yaml -v "Why are sales declining?"# Verify everything is connected
askrita test -c config.yaml
# Then run your query
askrita query -c config.yaml "Show me the dashboard data"# Production database
askrita query -c configs/production.yaml "How many active users?"
# Staging database
askrita query -c configs/staging.yaml "How many active users?"Symptom: askrita: command not found
- Ensure the package is installed:
pip install askrita - If using a virtual environment, make sure it is activated
- Check that the virtual environment's bin directory is in your
PATH
Symptom: Error: Invalid configuration file path
- The config path must end with
.yamlor.yml - The file must exist at the specified path
- Path traversal (
..) is not allowed for security
Symptom: askrita test reports connection failures.
- Database: Check connection string, credentials, and network access
- LLM: Check API key environment variables and network/proxy settings
- Use
--verboseto see detailed error messages
Symptom: No prompt appears in interactive mode.
- The workflow tests DB and LLM connections at startup — this may take a few seconds
- Use
--verboseto see what step is blocking - Test connections first with
askrita test
See also:
- Configuration Guide — Complete YAML configuration reference
- MCP Server Guide — Detailed MCP server setup
- Claude Desktop Setup — Using Ask RITA with Claude Desktop