The agent is not limited to running only certified queries. When answering a user request, the agent may:
- Use a certified query directly if it matches the request
- Use a certified query as a starting point and adapt it (e.g., add filters, dimensions, or measures) to fit the userβs question
- Generate a new query independently if no certified query is relevant
Defining certified queries
Certified queries are defined as Markdown files underagents/certified_queries/. Each query lives in its own file: the YAML frontmatter holds metadata, and the Markdown body is the SQL query.
certified_queries/, certified-queries/, or queries/ directory are treated as certified queries automatically β no kind property is required. The name is inferred from the file name (e.g., quarterly-revenue.md β quarterly-revenue).
Frontmatter properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | No | Unique identifier. Inferred from the file name if omitted. |
description | string | No | Human-readable description. |
user_request | string | Yes | The user request pattern this query answers. |
sql_query | string | No | The SQL query. Falls back to the Markdown body if omitted. |
Inlining certified queries in YAML
You can also inline certified queries directly inagents/config.yml under a certified_queries key:
name, description, user_request (required), and sql_query (required).
Writing effective certified queries
- Phrase
user_requestlike a real user question. This is what the agent matches against incoming requests. - Keep queries focused. A certified query should answer one well-defined question; the agent will adapt it for variations.
- Use canonical business logic. Certified queries are the reference for βthe right wayβ to compute something β encode the definitions you want the agent to follow.
- Cover common patterns first. Start with the questions users ask most often, and grow the library based on usage.