Skip to content

AskBox

<caos-ask-box>

the Ask capability’s binding: an editable query spec above the result list it produced

May be placed on a page inside an app, an app’s home page and a record page.

Name Attribute Description Type Default Required
spec property only The query the question became: { object, fields, where?, limit? }, exactly the shape the shipped ai_ask prompt declares as its output. A property, because it is structured data. Setting it replaces what is on screen and resets “edited”. Reading it back gives the spec as EDITED on screen, which is what Run would send — not the one that was set json none declared Optional
columns property only The columns of the result list, in the shape <caos-result-grid> takes, so nothing is transliterated. json empty list Optional
rows property only The rows the query returned. Setting it — even to an empty list — is what tells this piece a run has happened, so “no records match” can read differently from “nothing has been asked yet”. json empty list Optional
utterance utterance, markup only The question as it was asked, shown above the query. Absent ⇒ the line is not drawn, for a placement that already shows the question somewhere else. text none declared Optional
running running, markup only The application is running the query. Run reads “Running…” and the inputs are held. boolean false Optional
readonly readonly, markup only Show the query without letting anybody change it — for a saved answer being read back, where the query is evidence rather than a control. boolean false Optional
runLabel run-label, markup only What the run control says. text Run Optional
saveLabel save-label, markup only What the keep-this-question control says. text Save as list view Optional
emptyText empty-text, markup only What to say when the query ran and matched nothing. text No records match this query. Optional
Name When it fires What it carries
caos-ask-run the run control is pressed { spec, edited } — the spec as it is on screen, and whether it differs from the one that arrived
caos-ask-spec-change any part of the query is typed in { spec, edited }
caos-ask-save-view the keep-this-question control is pressed { spec, edited }

Not documented yet — this piece has not said.

Not documented yet — this piece has not said.

Not documented yet — this piece has not said.

Name Type What it tells you
spec CaosAskSpec null
edited boolean Whether what is on screen still matches the query the question produced. Read it to record that a human corrected the translation — which is the signal an eval suite wants.
Part Which piece of it When it is there
::part(ask) The outer column. Always
::part(utterance) The question as it was asked. utterance is set
::part(spec) The query panel. Always
::part(spec-row) One line of the query — object, fields, where, limit. Always
::part(spec-label) The label beside one line. Always
::part(spec-input) The editable box on one line. Always
::part(spec-actions) The row holding the edited notice and the two controls. Always
::part(run) The run control. Always
::part(save) The keep-this-question control. Always
::part(results) The composed result grid. the query returned at least one row
::part(empty) The “no records match” line. the query ran and returned nothing

Where somebody asks a question of the organisation’s own records and needs to trust the answer — because the query that produced it is on screen and editable.

  • QueryEditor — the person writes the query themselves. That is a developer surface with tabs and a language; this one starts from a sentence and shows the query as a form.
  • ResultGrid — there is a result set to show and no question behind it — this piece composes that one.
  • MessageComposer — the question is one turn of a conversation rather than a query with a result set. The assistant capability composes this one inside that surface.

The query is a role="group" labelled as the query the question became, so the relationship between the sentence above it and the form is spoken rather than only laid out. Each line’s label is a real <label> bound to its box. The “no records match” line is a role="status" live region, so a run that returns nothing is announced instead of leaving a reader waiting. That the query has been edited is stated in words beside the run control, not conveyed by colour alone.

The default shape: the sentence, the query under it, the rows under that. The query is a form rather than a sentence, so a reader can see that where is what narrowed the answer.

{
"id": "example",
"section": "A question, and the query it became",
"columns": 1,
"items": [
{
"id": "ask_box_1",
"type": "component",
"key": "ask_box",
"inputs": {
"utterance": "which accounts have no owner?",
"spec": {
"object": "account",
"fields": [
"name",
"owner",
"created_at"
],
"where": "owner = null",
"limit": 50
},
"columns": [
{
"key": "name",
"label": "Name"
},
{
"key": "owner",
"label": "Owner"
},
{
"key": "created_at",
"label": "Created"
}
],
"rows": [
{
"name": "Northwind Trading",
"owner": null,
"created_at": "2026-02-11"
},
{
"name": "Harbour Freight Lines",
"owner": null,
"created_at": "2026-05-03"
}
]
}
}
]
}
<caos-ask-box id="askBox1" utterance="which accounts have no owner?"></caos-ask-box>
// What an attribute cannot hold, set as a property — the same values the preview is drawn with.
const askBox1 = document.getElementById('askBox1');
askBox1.spec = {
"object": "account",
"fields": [
"name",
"owner",
"created_at"
],
"where": "owner = null",
"limit": 50
};
askBox1.columns = [
{
"key": "name",
"label": "Name"
},
{
"key": "owner",
"label": "Owner"
},
{
"key": "created_at",
"label": "Created"
}
];
askBox1.rows = [
{
"name": "Northwind Trading",
"owner": null,
"created_at": "2026-02-11"
},
{
"name": "Harbour Freight Lines",
"owner": null,
"created_at": "2026-05-03"
}
];

Zero rows with the query still on screen. “No records match this query” plus the predicate is information; “nothing found” on its own is not, and hiding the query here would withhold the explanation exactly where it was needed.

{
"id": "example",
"section": "A query that matched nothing",
"columns": 1,
"items": [
{
"id": "ask_box_1",
"type": "component",
"key": "ask_box",
"inputs": {
"utterance": "which contacts opted out last week?",
"spec": {
"object": "contact",
"fields": [
"name",
"email"
],
"where": "opted_out_at > '2026-10-17'"
},
"columns": [
{
"key": "name",
"label": "Name"
},
{
"key": "email",
"label": "Email"
}
],
"rows": []
}
}
]
}
<caos-ask-box id="askBox1" utterance="which contacts opted out last week?"></caos-ask-box>
// What an attribute cannot hold, set as a property — the same values the preview is drawn with.
const askBox1 = document.getElementById('askBox1');
askBox1.spec = {
"object": "contact",
"fields": [
"name",
"email"
],
"where": "opted_out_at > '2026-10-17'"
};
askBox1.columns = [
{
"key": "name",
"label": "Name"
},
{
"key": "email",
"label": "Email"
}
];
askBox1.rows = [];

With readonly, the query is evidence rather than a control: this is the question that was asked and the query it ran. Nothing can be changed, and the query is still legible.

{
"id": "example",
"section": "A saved answer, read back",
"columns": 1,
"items": [
{
"id": "ask_box_1",
"type": "component",
"key": "ask_box",
"inputs": {
"readonly": true,
"utterance": "open cases older than thirty days",
"spec": {
"object": "case",
"fields": [
"subject",
"status",
"opened_at"
],
"where": "status = 'open'",
"limit": 200
},
"columns": [
{
"key": "subject",
"label": "Subject"
},
{
"key": "status",
"label": "Status"
}
],
"rows": [
{
"subject": "Shipment arrived damaged",
"status": "open"
}
]
}
}
]
}
<caos-ask-box id="askBox1" readonly utterance="open cases older than thirty days"></caos-ask-box>
// What an attribute cannot hold, set as a property — the same values the preview is drawn with.
const askBox1 = document.getElementById('askBox1');
askBox1.spec = {
"object": "case",
"fields": [
"subject",
"status",
"opened_at"
],
"where": "status = 'open'",
"limit": 200
};
askBox1.columns = [
{
"key": "subject",
"label": "Subject"
},
{
"key": "status",
"label": "Status"
}
];
askBox1.rows = [
{
"subject": "Shipment arrived damaged",
"status": "open"
}
];