Skip to content

SQL Execution Tool

This tool runs a SQL query against the database behind a data product and returns the result as a table. It is the workhorse behind agents like Query, Data Product Query, and Analytics Agent.

Queries are read-only. Mutating statements (UPDATE, DELETE, INSERT, and so on) are not allowed. The data product must be backed by a SQL-compatible data source.

Add this tool to any agent that needs to answer questions from data by running queries. Pair it with Get Data Schema so the agent can learn the available tables and columns first.

ParameterRequiredTypeSuggested scopeWhat it does
data_product_idYesstringUser inputThe data product to query against.
sqlYesstringAgent determinedThe query to run.
result_table_nameYesstringAgent determinedA short, descriptive name for the result table.
data_product_versionNostringFixed or User inputA specific version of the data product.
pre_exec_sqlNostringFixedSQL to run before the main query, e.g. to set session context.
auth_idNostringFixed or User inputThe authentication credentials to use for the query.
{
"data_product_id": "my-data-product",
"sql": "SELECT region, SUM(amount) FROM sales GROUP BY region;",
"result_table_name": "sales_by_region"
}

The query result as a table. Very large results may have rows or columns trimmed.