Docs/Using Plugins/SQL Database Reader

SQL Database Reader

The SQL Database Reader plugin connects your agent to a live SQL database, letting users query business data using natural language. Instead of writing SQL, users ask questions in plain language and the agent translates them into queries, executes them, and returns the results.


How It Works

When a user asks a question, the plugin:

  1. Translates the natural language question into a SQL query using AI.
  2. Applies any row-level security policies based on the user's permissions.
  3. Executes the query against the connected database.
  4. Returns a formatted, readable result.

All query executions are logged automatically, giving you full visibility into what data was accessed and when.


Supported Databases

DatabaseProvider key
Microsoft SQL Serversqlserver
PostgreSQLpostgresql
MySQLmysql
Oracleoracle

Key Features

FeatureDescription
Natural language to SQLUsers ask questions in plain language; the plugin generates and executes the SQL.
Schema-aware queriesYou control which tables and columns the agent can access.
Virtual foreign keysDefine relationships between tables even when no FK constraint exists in the database.
Row-Level SecurityRestrict query results based on the user's permissions.
Query testingTranslate and execute queries in a safe testing panel before going live.
Usage logsTrack every query execution with the question, generated SQL, status, and row count.

Setup Flow

Follow these steps in order to configure the plugin:

  1. Set up the database connection — enter credentials and test connectivity.
  2. Configure tables and columns — select what data the agent can see.
  3. Set up virtual foreign keys — define cross-table relationships if needed.
  4. Configure the function tool — define how the plugin appears to the AI.
  5. Test your queries — validate SQL generation before deployment.
  6. Configure row-level security — restrict data access by user permissions.
  7. Monitor usage logs — review query history and download logs.

Prerequisites

Before creating a plugin instance:

  1. A running SQL database accessible from the plugin host.
  2. A read-only database user with access to the target tables.
  3. A list of tables and columns the agent is allowed to query.
  4. A data governance decision on whether row-level security is required.