What it does
query_data_store runs a read-only SQL SELECT against a
data store (a structured knowledge base) and returns the
rows. The agent writes the query directly, so it has the full expressive power of
SQL — joins, aggregates, GROUP BY, HAVING, window functions, and CTEs.
For an overview of structured data stores, see Data Stores.
Parameters
Key behaviors
- Read-only and safe. Queries run in a read-only transaction scoped to the store’s own schema; they cannot modify data or reach another store.
- Large results spill to CSV. Up to 10,000 rows are returned inline (subject to a token budget); anything larger is attached as a downloadable CSV so no result is ever lost.
- Aggregate in the database. For totals and rollups over large tables, let
the query do the work (
SELECT count(*), sum(amount) ... GROUP BY ...) rather than pulling rows and reducing them afterward.
Common use cases
Read a table
Aggregate
Related
- Manage Data Store — create tables, columns, views
- Write Data Store — insert, update, delete, upsert
- Data Stores — the feature overview