Skip to content
Talk to an engineer

Chat cards

KPI tiles

Two to six headline numbers, each with its change and a sparkline. The agent answers in a sentence; the card carries the numbers.

KindRead-onlyAgent waitsNoMobileSame card

Use it when: The user asks how something is doing and the answer is 2–6 headline numbers (totals, rates, counts), each with a change vs a period.

Use something else when: One number only (answer in text). A trend over time is the point (chart card). Many rows of the same metric (records list / table).

The template callsThe agent getsWhen
displayed()FUNCTION_TOOL_DISPLAYEDAs soon as the card shows. The agent goes on.

Besides its data, the template draws these as itself, with mountState(). Pick one on the preview with State.

StateWhen it shows
LoadingWhile the card loads again in place, for example after Try again. While execute runs, the SDK shows its own loader.
Emptyexecute found nothing to show. The card says so and the agent explains why.
Errorexecute returned the failure as data, so the agent can explain it. Try again loads in place.
mountState({ 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
titlestring
subtitle (optional)string
icon (optional)IconName
metricsKpiMetric[]2–6 tiles; more are cut.
footnote (optional)string
link (optional){ label: string; href: string }
FieldTypeNotes
labelstring
valuenumber | string
format (optional)NumberFormat
delta (optional){ value: number; good?: boolean; vs?: string }Change in percent. good: false when up is bad (costs, churn); default: up is good.
trend (optional)number[]Recent values, oldest first, for the sparkline.

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.