AI assistant
When the workspace sets AI_ENABLED=true, three helpers are available; otherwise their buttons are hidden. Requests go through Vercel AI Gateway, which falls back to a second model if the first is unavailable.
| Helper | Where | Who |
|---|---|---|
| Generate SQL | Editor toolbar, AI | Developers and above |
| Explain / optimise SQL | Editor toolbar, AI | Developers and above |
| Triage | Full report of a failed or flagged run | Everyone |
The AI sees your question, the SQL and the table structure of the database, never the data rows.
Triage
Triage with AI on a run's full report says whether the rows look like a real data problem or a mistake in the check, the likely causes, and what to do next; for a broken query it suggests a corrected one. It describes the returned rows to the model only by column: type, how many are empty, how many distinct values. The values themselves are not sent. Each run is triaged once; opening it again shows the saved answer without another request.
How Generate SQL checks its work
Generate SQL drafts a whole check, not just a query. Before the query reaches the editor, Assay:
- validates it like any other check, so it cannot write;
- dry-runs it once in a read-only transaction with a 10-second timeout, counting the rows it would flag today;
- if the dry run fails, sends the database error back to the model for one repair attempt.
The notification tells you how many rows the check flags now, or why its dry run still failed.
Limits
To keep costs predictable, each person can make 30 AI requests per hour. A description can be up to 2,000 characters, SQL up to 20,000 and an error message up to 4,000.
See also
- Writing checks
- Environment variables —
AI_ENABLED,AI_GATEWAY_API_KEY.