Workflows
Blocks
Tools
SQL Toolkit

SQL Toolkit Block

What it does: Give AI agents the ability to query your databases, letting them look up information and answer questions using your actual data.

🗄️

In simple terms: The SQL Toolkit is like giving your AI assistant a key to your database. When someone asks "How many orders did we get last week?" or "What's John's account balance?", the AI can actually look it up and give a real answer.

When to Use This

Use the SQL Toolkit when you need:

  • ✅ AI to answer questions using live database data
  • ✅ Natural language queries against your database
  • ✅ Smart data lookups during conversations
  • ✅ Dynamic reporting through AI assistants
  • ✅ Self-service analytics for non-technical users

Example: Build a chat assistant for your sales team that can answer questions like "Show me our top 10 customers by revenue" by querying your database in real time.

Key Features

  • Natural Language to SQL: AI translates questions into database queries
  • Multiple Databases: Works with PostgreSQL, MySQL, and other SQL databases
  • Safe Querying: Read-only options to protect your data
  • Schema Awareness: AI understands your table structures
  • Result Formatting: Clean, readable responses from raw data

How It Works

  1. User asks a question: "Which products are running low on inventory?"
  2. AI examines your database schema: Sees your tables and columns
  3. AI writes a query: Creates the appropriate SQL to find the answer
  4. Query runs: Executes against your database safely
  5. AI explains results: Formats the data into a helpful response

Setup Guide

Step 1: Connect Your Database

Provide your database connection details:

  • Host address (where your database lives)
  • Port number
  • Database name
  • Username and password

Step 2: Configure Access

SettingWhat It DoesRecommendation
Read OnlyPrevent any data changesAlways enable for safety
Tables to IncludeWhich tables AI can accessOnly include what's needed
Tables to ExcludeTables to hide from AIExclude sensitive tables
SchemaDatabase schema to useDefault is usually "public"

Step 3: Add to AI Agent

Include the SQL Toolkit as a tool for your AI agent. The agent will automatically use it when users ask data-related questions.

Common Use Cases

Business Intelligence Assistant

Let team members ask questions about sales, revenue, inventory, or any business data without needing to know SQL.

Customer Support Data Lookup

AI agents can look up customer order history, account status, or recent transactions during support conversations.

Executive Dashboards via Chat

Executives can ask "What were our sales yesterday?" and get an instant answer without waiting for reports.

Self-Service Analytics

Empower team members to get data insights on demand without bothering data analysts.

Inventory and Operations

Warehouse staff can ask about stock levels, shipping status, or order volumes.

What Gets Shared with AI

The AI agent receives:

  • Table names: What tables exist in your database
  • Column names and types: Structure of each table
  • Sample data: Limited examples to understand content (if enabled)
  • Query results: Data returned from queries

What You Get Back

After the AI queries your database:

  • Query Results: The actual data from your database
  • Formatted Response: AI's explanation of what it found
  • Row Count: How many records matched
  • Query Used: The SQL that was executed (for transparency)

Tips for Success

  1. Enable read-only mode - Never allow write access for safety
  2. Limit table access - Only expose tables the AI needs
  3. Use clear column names - "customer_email" is better than "ce1"
  4. Add descriptions - Help AI understand what tables contain
  5. Test common questions - Verify AI generates correct queries

Troubleshooting

ProblemLikely CauseSolution
Connection failedWrong credentialsVerify host, port, user, and password
No tables foundWrong schema selectedCheck database and schema name
Wrong resultsAI misunderstood schemaAdd table/column descriptions
Query errorsComplex questionSimplify the question or add examples
Slow responsesLarge datasetAdd filters or limit result count

Security Best Practices

  • Use read-only database user - Create a user with SELECT only permissions
  • Limit table exposure - Only include necessary tables
  • Hide sensitive columns - Exclude columns with passwords, tokens, or PII
  • Use connection pooling - Prevent too many open connections
  • Monitor queries - Log what the AI is asking for
  • Set timeouts - Prevent long-running queries from overloading your database
Indite Documentation v1.4.0
PrivacyTermsSupport