Chat and queries

SQL approval

Read, edit, or reject the generated query before it touches your database.

When SQL approval is enabled, the agent pauses after drafting a query and shows it to you. Nothing runs until you approve.

The three outcomes

ActionResult
ApproveThe query runs as written
EditYour edited SQL runs instead of the draft
RejectNothing runs; the agent takes the rejection as feedback

Editing is the useful one. A query that is nearly right is faster to fix than to re-prompt, and the correction is a signal you can later curate into golden_queries.

When it appears

Approval applies to queries against a connected database. Uploaded files skip it: those run in DuckDB against a copy, not against your infrastructure, so there is nothing to gate.

Whether approval is required at all is a deployment setting. A team that has scoped its database user to read-only often turns it off for speed; a team querying production usually leaves it on.

Resuming over the API

Programmatically, an approval pause arrives as an interrupt event on the SSE stream. You resume the run by posting the decision back:

POST /api/chat/resume

The run continues from where it paused, with the same thread and context. See the chat API for the full event list.

Approval is not a substitute for permissions

A reviewer approving queries all day will eventually approve a bad one. Scope the database role so that the worst possible approved query is still harmless.

On this page