Skip to content

Answer questions about data

A request can change the view, run an allowed action, or return a message. A data question needs data evidence: column names alone cannot tell the model your sales total.

Use this guide after choosing read actions. Check data disclosure before sending results to a model.

An interpreter receives an AiViewRequest and AbortSignal, and returns one complete result. Supported results are a filter/sort command, a registered typed action, an answer, a clarification, or unsupported feedback. No partial streamed result executes.

return {
kind: 'clarification',
message: 'Which region should I show?',
choices: [
{ label: 'Europe', prompt: 'Show only Europe' },
{ label: 'Asia', prompt: 'Show only Asia' },
],
};

Choices use the existing suggestion controls; labels and submitted prompts can differ. At most five choices are accepted, with labels up to 100 characters and prompts up to 500. Legacy suggestions: string[] also works. An answer is simply { kind: 'answer', message: '…' }; it does not apply a view or add a step.

Answer data questions with selected evidence The first model call chooses an allowed read. The data owner computes a bounded result locally. If the host explicitly selects evidence, a second model call returns a terminal answer and cannot request another action. No raw records are sent by default. User Asks a data question Assistant Browser Backend + model Your endpoint Data owner Allowed local read Ask a data question Call 1: choose an allowed read action Typed read action Compute a bounded aggregate Scoped result; stays local Call 2: selected JSON evidence only Terminal answer No further actions Answer + original result Optional: host selects evidence 8 KiB default · 16 KiB maximum
Only explicitly selected evidence leaves the browser. The extra call is optional and terminal: it cannot trigger another action. Each model call consumes its own backend quota.

Metadata can answer “Which columns can I sort?”. Answering “What is the total amount?” requires a permitted data operation and evidence. Opt into a single follow-up for aggregates. This example reuses interpret from the API-client setup:

grid.aiAssistant = {
interpret, // Your API-client adapter from the quick start.
gridActions: { readRows: true },
answerFromAction: {
select(action, result) {
return action.name === 'grid.aggregate' ? result.data : undefined;
},
maxBytes: 8192,
},
};

The second request has answerOnly: true, evidence: { action, data } and no available actions. The interpreter may return only terminal answer/clarification/unsupported feedback; it cannot execute another operation. Evidence must be strict JSON, bounded to 8 KiB by default and 16 KiB maximum. Prepared writes never trigger this extra call. Stop and stale-state checks still apply; failed summarization retains the original action result. Evidence is discarded after the turn, although opt-in conversation may retain the visible answer.

Your backend must separately allow the evidence action. The reference service permits grid.aggregate only. Each follow-up is another HTTP/model request and consumes another quota reservation. This is a bounded two-call workflow, with no autonomous action loop or automatic retries.

For your own model adapter, createAiViewResponseSchema(fields, descriptors) supplies structured-output JSON Schema. Runtime validation also checks allowed fields/operators, scalar types, complexity, action inputs and response shape. Application business terms such as “overdue” belong in your interpreter context.

Next: Connect custom actions and products.