Version 3
Verified queries

Verified queries

Write the queries that matter most once, have a person approve them, and get the same answer, or the same change, every time they run.

Audience: builders

What a verified query is

A verified query is reviewed code that reads or changes data in your attached sources. "What is our DPO this quarter" should not be worked out again each time somebody asks. It should be the query your finance team agreed on, giving everyone the same answer.

  • Same input, same output. The approved version runs exactly as reviewed.
  • Reviewed by a person. It becomes live because someone with the right to approve it did, not because it looked right once.
  • On the record. Every run is recorded, with its inputs and the model version it used.

Verified queries are a kind of verified logic: the same reviewed package, for the narrow job of working with data. A package that only reads or changes data sources, or that is linked to a semantic model, appears under Verified queries in the Data group. Anything with other effects, such as sending email or calling an API, appears under Verified logic in Tools.

Why the agent needs them

Without a verified query, the agent writes new SQL for every question. That is what makes a Project useful on day one, and it is fine for exploring.

Verified queries are for the cases where that is not good enough:

  • Answers that must not drift. A number reported to leadership, a reconciliation, a control.
  • Changes to your data. A table set to change Through verified queries accepts changes only from an approved verified query that contains that exact change. SQL the agent writes on its own is refused. See Changing data.
  • Workflows. A Workflow step can run a verified query, so every run uses the approved logic rather than whatever the agent writes that day.

The agent does not choose a verified query for you. Ask for one by name, or tell the Project when to use it in its Instructions.

Create one

Ask for it in chat

In the Context tree, expand Verified queries under Data and choose Create a verified query in chat. Finish the sentence with what the query should do, such as "returns open invoices for a vendor, with days outstanding."

The agent writes the query as a draft and can try it against your data before you apply it.

Apply the change

When the agent finishes, review its changes and apply them. If you can publish verified queries in this Project, the query goes live. Otherwise it is submitted as a proposal for someone who can.

Approve it

A proposal shows Awaiting publication. A reviewer opens it and selects Approve & publish, or Reject. Approving needs build rights wherever the query lives: the Project, the team, or the workspace.

A live query shows Live. When it was published directly and still needs a second pair of eyes, it also shows Human review pending, and a reviewer can Mark reviewed or Request changes.

To change a live query, select Edit with agent. The live version keeps running until the new one is approved.

Link a query to a semantic model

A verified query linked to a semantic model uses the model's names rather than your tables. That makes it portable: any Project that maps the model can run it against its own data.

Open the model and its Verified queries tab, choose a published query, and select Link, or Write a verified query with agent to create a new one for the model.

Each link pins the query to one version of the model. After you change the model, the link shows Stale until you Relink the query to the new version.

Archive a query

Open the query and select Archive query. It stops being available to the agent and to Workflows.