Skip to content

Answers that need review

When no certified saved query or semantic metric answers a question, Ask can write SQL from your tables with AI. That answer may well be right, but nobody has checked it yet, so ZLens labels it and keeps it as a draft for review.

An answer that needs review No certified block answers average order value by store, so Ask writes the SQL itself: the answer is labelled AI-generated, is saved as a draft block that is not certified, and opens in Block Studio for review.
  1. Open Ask from the left rail.
  2. Ask "What is the average order value at each store?".
  3. The answer is labelled AI-generated answer and shows the two stores by name, Philadelphia and Brooklyn, with their average order value.
  4. Below the result, Ask notes it saved the query for review as a draft block, not certified.
  5. Open draft to review opens the draft block in Block Studio, where it can be reviewed and certified.

What you see

For a question such as How many orders were placed at each store location? in the sample project:

  1. The trust line reads AI-generated answer, with the checks it passed, for example 4 checks passed.
  2. The summary says where the answer came from, for example Source: SQL written by AI from the schema (review before relying on it).
  3. The result card says AI-generated.
  4. Under the result, a line reads Saved for review as a draft saved query (not certified): and the draft's path, such as domains/commerce/blocks/_drafts/many_orders_placed_each_store_location.dql.
  5. Open draft to review opens that draft in the saved query editor.

The draft is named after its file, here many_orders_placed_each_store_location. When every table the answer reads is listed in one Domain's Source systems (in the sample, orders and locations are both in commerce), the draft is saved in that Domain and its Domain is already set. When the tables belong to more than one Domain, or to none, the draft is saved in blocks/_drafts/ with no Domain, and you pick one when you certify.

If the same question is asked again, ZLens reuses the same draft and counts the repeats (asked N times). A question many people ask is a good one to certify first.

Review and certify the draft

Video · 0:50From AI answer to certifiedRecorded on 0.2.2: "Governed answer" is now "Answer from Metrics", and "block" is now "saved query".
  1. Click Open draft to review, or find it in Saved queries in the Drafts folder.
  2. Check the SQL and click Run to look at the rows.
  3. Check the Saved query name and Domain, set an Owner and a clear description. Add a test if you can. To change the Saved query name, Domain or Owner, click Open in builder. These fields are in the Details box.
  4. Click Certify. If the draft has no Domain yet and your project has Domains, the saved query editor asks for one first: a Domain, or Global / cross-domain for an answer that spans Domains.

When it passes, the saved query is Certified and is saved in its Domain under its name. A certified saved query is available to Apps because it is certified, so it carries no app-source tag. Ask uses it from then on: the same question now gets a Certified answer. See Save and certify.

Optional: a second look at the result

AI-written SQL can run cleanly and still compute something else: one row per country where the question asked for one number, or a date column that came back empty because the text did not parse. With the result review on, Ask checks each AI-drafted result before it answers:

  1. One more AI call sees the question, the SQL and the result's shape: how many rows, how many distinct and empty values each column has, and whether rows repeat. It never sees a value from the result.
  2. If it names a concrete defect, Ask revises the SQL once, with that reason. The revision is the answer only if it runs and returns rows; otherwise the first answer stands.
  3. The run's details list the check as Checked the result against the question, with Answers it or Asked for a revision.

It applies to every AI-drafted answer, including one drafted straight from the question; certified and governed answers are not checked. It costs about one AI call per AI-drafted answer (median 3.6 seconds on Claude), so it is off by default. Turn it on in dql.config.json; Ask reads it at every question:

{ "agent": { "resultReview": { "mode": "on" } } }

ZLENS_ASK_RESULT_REVIEW=1 turns it on and =0 off for one server or command, whatever the project says.

When no draft is saved

ZLens saves a review draft only when the answer actually ran and produced SQL. It does not save one for a refusal, a cancelled run, or a Research report. Evaluation runs (zlens agent eval) never write drafts.

To keep an answer that was not saved, click Save as saved query on it. Save as saved query opens the Save as saved query dialog; Save draft saved query saves a draft and opens it in the saved query editor.

Other labels you may see

  • Answer from Metrics: built from semantic metrics and dimensions, with no AI-written SQL. If ZLens had to guess how to group a dimension, the note says Review required and asks you to check the mapping.
  • Needs review on an App page answer: the answer read an App tile whose data is not certified. See Ask about an App.
  • On the command line, zlens agent ask prints ! AI-generated · review required and the draft path: Review draft saved: <path>.