modellerUpdated 2026-10-13

Query shapes

What this covers

A query shape describes how the agent answers one type of question: which fields the planner should choose, which chart is used, which quality checks run, and how the answer is narrated. The built-in shapes cover totals, breakdowns, rankings, compositions, trends, matrices, and detail tables. This page explains how to choose built-in shapes or customise them for a project.

For an example question of each kind, see the section "Kinds of questions, with examples" in Agent Chat.

Where to find it

Tenant Administration, Projects, your project, Project settings, Conversational agent, Query shapes.

How it works

Rules

Question templates

Question templates teach the agent to recognise more kinds of questions and how to answer them. Each template has:

The built-in set covers totals, snapshots, latest entity, rankings, breakdowns, trends, period comparisons, targets, shares, exception lists, entity details, contributions, distributions, matrices, funnels, retention, forecasts and definitions, plus thresholds ("which merchants sold more than 50,000"), ratios such as average order value, distinct counts, comparisons of named members, change per group between two periods, change in share, day-of-week and month-of-year patterns, first and last dates, data coverage, actual versus plan, and averages per day, week or month.

Analytic templates use statistics and window calculations that the query router computes: running totals, moving averages, rank positions, top N within each group, 80/20 concentration, outliers (values far from the average, measured in standard deviations), quartiles and deciles, averages of period or entity totals (a typical month, sales per customer), and cohorts by first purchase date. Planner instructions may use these building blocks: stddev, variance, median, percentile, rank, dense_rank, row_number, ntile, running_sum, moving_avg, a result_filter on a calculated column, and an outer level that aggregates the query's own results.

To change or add templates, choose a custom registry, edit the Question templates section and save. A template never blocks a question: without a matching template the agent answers as before. For a definition template the agent relays the model's definition word for word instead of writing its own.

Shapes and templates on a model with several fact groups

A model can hold several lines of figures (fact groups), for example payments and targets. A shape or a question template works on such a model as on any other, with three rules that come from the query router. They apply when the figures of one answer come from different fact groups. Inside one fact group nothing below is restricted.

What a calculation may contain. The query router makes the calculation itself, after it has answered each fact group and lined the results up.

In a template's governed expression Across fact groups
Arithmetic: + - * / Answered
ROUND, ABS, CEIL, FLOOR, COALESCE on numbers Answered
A threshold on the calculation (result above 95) Answered
Text, date and logical functions (CONCAT, EXTRACT, CASE) Declined
Statistics and windows: stddev, median, percentile, rank, running_sum, moving_avg, ratio_to_total, an outer level Declined

A percentage of one figure over another is written as 100 * a / b. Rounding is not part of a percentage: put ROUND(..., 2) in the template when the answer should be rounded. The built-in share template rounds a share of a total to two decimals.

What happens when a calculation is declined. The agent never calculates a figure itself. If the declined calculation was only a column to show, the agent returns the figures it is made of, each with the aggregation the calculation used, under a notice that the calculation was not made, followed by the query router's reason. If the calculation decides which rows are shown or their order (a rank, a top N, a threshold), nothing is returned in its place and the router's reason is the answer.

Which fields a template may group and filter by. Across fact groups a field has to be one that every fact group in the answer reaches: a shared table such as a calendar, or a conformed dimension the modeller declared. A period is a field like any other: "by month" or "in 2025" needs a year and month that all the fact groups reach, not the date field of one of them. When the planner picks a field that only some of the fact groups reach, it is asked once for a plan on the shared fields before the query is sent. A field the user named is always sent as asked. A question the model cannot answer by the asked field is refused with one fixed sentence, which the agent shows unchanged: "The measures [list] are not available by the dimensions [list] in model [name]."

Good practice.

See Questions Across Fact Groups.

Seeing which shape was used

The chat trace drawer shows "Shape: <id>" next to the route. The agent log screen shows "Selected shape" for every turn.

Related