Skip to content
Talk to an engineer

Canvas

Report

A report the agent opens beside the chat: headline numbers, one chart, a breakdown and what stands out. The agent explains it and answers follow-ups from the same state; it can’t change the numbers.

KindCanvas · REPORT · READ_MODEAgent waitsNoMobileNo canvas: a summary card

Use it when: The user asks how something did over a period and the answer needs room: a few headline numbers, a trend, a breakdown and what stands out. The agent explains it beside the chat and answers follow-ups from the same state.

Use something else when: A few numbers that fit in the chat (KPI tiles card). Data the user edits (table or form canvas). Raw exports with hundreds of rows (link to your app). Mobile: the canvas isn’t available; use the summary card (mountMobile).

The template callsThe agent getsWhen
canvas.stateCanvas stateWith every message. READ_MODE: the agent reads the numbers and findings and explains them; any change it tries is refused.
canvas.setTitle(title)Canvas titleWhen the report draws. The header and the chat card show it.
displayed()FUNCTION_TOOL_DISPLAYEDMobile summary card: as soon as it shows.

Besides its data, the template draws these as itself: mountState() on the canvas, mountMobileState() in the mobile card. Pick one on the preview with State.

StateWhen it shows
LoadingThe canvas opens at once while renderCanvas fetches the numbers, and again after Try again. The agent reads the report once it’s in the canvas state.
EmptyThe period has no data yet. The report says so and offers the latest period that has some.
ErrorThe report’s data didn’t load. execute or renderCanvas got the failure; Try again loads it in place.
mountState({ root, head, title: "…", state: { kind: "error", text: "…", retry } });
mountMobileState({ root, head, title: "…", state: { kind: "error", text: "…", retry } });

The hosted action and the in-page handler below show each case. The state types are LoadingState, EmptyState and ErrorState in fs-kit.

FieldTypeNotes
canvasTitle (optional)stringThe canvas header (setTitle, up to 80 characters). Default: the title.
eyebrow (optional)string
titlestring
summary (optional)stringOne or two sentences that answer the user’s question.
period (optional)stringThe period the numbers cover, such as “Oct 1 to Oct 31, 2026”.
updated (optional)stringWhen the data was read, such as “8 min ago”.
kpisReportKpi[]2 to 4 headline numbers; more are cut.
chart (optional)ReportChart
table (optional)ReportTable
insights (optional)ReportInsight[]2 to 4 findings, written by the agent or your backend.
FieldTypeNotes
labelstring
valuenumber | string
format (optional)NumberFormat
delta (optional){ value: number; good?: boolean; vs?: string }Change in percent vs the previous period. good: false when up is bad (costs, churn).
trend (optional)number[]Recent values, oldest first, for the sparkline.
FieldTypeNotes
type"bar" | "line"bar for amounts per period or category, line for a trend.
titlestring
labelsstring[]The x-axis labels, oldest first.
seriesReportSeries[]1 to 3 series; more are cut.
format (optional)NumberFormatHow the axis and the tooltip format values.
FieldTypeNotes
namestring
valuesnumber[]One value per chart label, in the same order.
compare (optional)booleanA comparison series (last period, target): drawn muted, dashed on a line chart.
FieldTypeNotes
titlestring
rowLabelstringThe first column’s header, such as “Plan” or “Region”.
columnsReportColumn[]
rowsReportRow[]Sorted the way you want them shown (biggest first).
limit (optional)numberRows shown (default 6). The rest show as “N more”.
FieldTypeNotes
labelstring
format (optional)NumberFormat
delta (optional)booleanA change column in percent: an arrow, colored by sign.
upIsGood (optional)booleanFor a change column: false when up is bad (costs, churn).
bar (optional)booleanDraws a share bar next to the numbers, scaled to the column’s largest value.
FieldTypeNotes
labelstring
values(number | string)[]One value per column, in the same order.
FieldTypeNotes
tone"positive" | "negative" | "neutral"positive (good news), negative (needs attention) or neutral (context).
titlestringOne short line the user can scan.
detail (optional)string
FieldTypeNotes
openInApp() (optional)() => voidOpens the full report in your app. Adds “Open in app” to the header and the table.

Copy the template and the shared kit into your code: agent/ui/ in an agent repo, or anywhere in your app. The template imports only ./fs-kit.js. Then wire it up from the hosted action or the in-page handler.

The hosted action needs an agent repo with one folder per action (agent/actions/<action_key>/index.ts). If your repo keeps its actions in agent/actions/index.ts, use the in-page handler: it runs the same template in your app.

All templates in machine-readable form: /ui-catalog/catalog.json.