Query
The Query agent is a streamlined SQL assistant for querying databases associated with data products. It translates natural language questions into SQL queries and returns data-driven answers.
How it works
Section titled “How it works”The agent follows this workflow:
- Receives a natural language question from the user
- Uses the Get Data Schema tool to understand available tables and columns
- Generates and executes SQL queries using the SQL Execution tool
- Analyzes results and may refine queries as needed
- Returns the final consolidated results in a single table
Input parameters
Section titled “Input parameters”Required:
message(string): The natural language question or request to send to the agentdata_product_id(string): The ID of the data product to query
Output format
Section titled “Output format”The agent produces a series of thinking, tool call, tool return, and text blocks as it works through the user request.
The final message, assuming no errors, is a string which addresses the user’s request.
Available tools
Section titled “Available tools”The agent has access to two tools:
Get data schema
Section titled “Get data schema”Retrieves the schema for tables in the data product. Optionally supports semantic search of sample values.
Key parameters:
data_product_id: The data product to get schema forquery: Optional semantic search query for sample values
SQL execution
Section titled “SQL execution”Executes SQL queries against the data product’s database. The tool automatically handles result serialization and may limit rows/columns for very large results.
Key parameters:
data_product_id: The data product to querysql: The SQL query to executeresult_table_name: A semantic name for the result table
Behavior notes
Section titled “Behavior notes”- The agent always uses result tables from executed queries to answer questions (never synthesizes data)
- For complex questions, it executes a final consolidated query to return all results in a single table
- Results are returned as tables, not markdown formatted text
- This agent is optimized for query execution without visualization capabilities
Comparison with Data Product Query
Section titled “Comparison with Data Product Query”The Query agent is similar to the Data Product Query agent but:
- Does not include chart generation capabilities
- Focuses purely on SQL execution and data retrieval
- Lighter weight for straightforward querying tasks
For visualization needs, use the Data Product Query agent instead.