Prerequisites
- Database tools already configured for your database type
- Project with agent building permissions
- Database server accessible via public IP
💡 Setup Required: Ensure you’ve configured your database tools first by following the setup guide for your specific database type.
Supported Database Types
- MySQL - Standard metadata + query pattern
- PostgreSQL - Standard metadata + query pattern
- MS SQL Server - Standard metadata + query pattern
- Snowflake - Standard metadata + query pattern
- MongoDB - Standard pattern with Find + Aggregate tools
- Databricks - Simplified query-only pattern
Agent Patterns
Agent Pattern (MySQL, PostgreSQL, MS SQL, Snowflake, MongoDB)
Most database tools use a two-agent architecture:- Metadata Retrieval Agent - Scheduled agent that extracts database schema
- Query Agent - Interactive agent that answers user questions
- Database-specific SQL Query Tool
- Database-specific Metadata Retrieval Tool
- Memory object (for metadata storage)
- LLM model

Simplified Pattern (Databricks)
Databricks uses a single-agent:- Query Agent - Direct SQL query execution with LLM processing
- Databricks SQL Query Tool
- LLM model
Setting Up Standard Database Agents
Step 1: Create Metadata Retrieval Agent
- Create a new agent in Agent Canvas
-
Add the following components:
- LLM model
- [Database] Metadata Retrieval Tool (e.g., “MySQL Metadata Retrieval Tool”)
- Memory object
-
Configure connections:
- Input → LLM
- LLM → Output
- Memory → Output
- Add the Metadata Retrieval Tool to the LLM
-
Schedule the agent:
- Click the gear icon on the Input block
- Toggle Schedule Execution ON
- Set repeat interval based on how often your database schema changes
💡 Scheduling Tip: Run metadata retrieval daily for frequently changing databases, or weekly for stable schemas.

Step 2: Create Query Agent
- Create a new agent in Agent Canvas
- Add the following components:
- LLM model
- [Database] SQL Query Tool (e.g., “MySQL SQL Query Tool”)
- Memory object (same as metadata agent)
- Configure connections:
- Input → LLM
- LLM → Output
- Memory → LLM

- Add the SQL Query Tool(s) to the LLM
⚠️ Important: Run the Metadata Retrieval Agent at least once before using the Query Agent to populate database schema information.
Setting Up Databricks Agents
Single Query Agent Setup
- Create a new agent in Agent Canvas
-
Add the following components:
- Databricks SQL Query Tool
- LLM model
-
Configure connections:
- Input → Databricks SQL Query Tool
- Tool → LLM
- LLM → Output
-
Configure the SQL Query Tool:
- Click on the Databricks SQL Query Tool
- Set it to receive value from Input Step Result
Using Parameterized Queries
For dynamic queries, use Agent Variables in your SQL statements:- Click on the [Database] SQL Query Tool (e.g. Databricks SQL Query Tool)
- Enter your SQL query with variables:
SELECT * FROM {{table_name}} WHERE date > '{{start_date}}'
- Save the configuration

Using Your Database Agents
Query Examples
Ask your agents natural language questions about your data:MongoDB-Specific Queries
Direct SQL Queries
For SQL Tools, you can pass SQL queries directly:
Best Practices
💡 Tip: Add custom prompts to your LLM with:
- Database schema context
- Common query patterns for your domain
- Output formatting preferences
- Business logic explanations
💡 Memory Management: Use the same Memory object across both agents to ensure consistent metadata access.
⚠️ Connection Requirements: All database servers must be accessible via public IP. Contact support@airia.com for IP whitelisting assistance.