Skip to content
Talk to an engineer

Chat cards

Comparison

Two to four plans, quotes or versions side by side. Rows that match collapse to one quiet line, the best value in a row gets a star, and the agent’s pick is highlighted with its reason. Read-only by default; with selectable, each column gets a Choose button and the agent waits for the choice.

KindRead-only (default), or input with selectableAgent waitsOnly with selectable, for a choice or cancelMobileVariant: 44px targets, label above values

Use it when: The user weighs 2–4 concrete options on the same attributes: plans, vendor quotes, versions, offers. The answer is in how they differ, row by row. Read-only by default; set selectable when the next step is choosing one, and the card waits for that choice.

Use something else when: One option (entity card). Five or more, or options that share few attributes (records list or table). A choice where a line per option is enough to decide (picker). Numbers over time (chart).

The template callsThe agent getsWhen
displayed()FUNCTION_TOOL_DISPLAYEDRead-only (no selectable): as soon as the card shows. The agent goes on.
submit({ chosen, label, result })FUNCTION_TOOL_SUBMITTED_BY_USERselectable: the user chose an item, after actions.choose() succeeds. chosen is the item id.
cancel()FUNCTION_TOOL_CANCELLED_BY_USERselectable: the user pressed the way out (default None of these). Nothing changed.

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 fewer than two items. There’s nothing to set side by side, so the card says so.
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
itemsComparisonItem[]2–4 items, one column each, in this order. More are cut.
rowsComparisonRow[]The attributes, top to bottom. Rows that match across every item draw as one quiet line.
recommended (optional){ id: string; reason: string }The item the agent recommends, and why in one sentence. Its column is highlighted and badged.
recommendedLabel (optional)stringBadge on the recommended column. Default “Recommended”.
onlyDifferences (optional)booleanStart with matching rows hidden. The user can switch them back on.
selectable (optional)booleanA Choose button under each item. The card becomes an input and the agent waits for the choice. Default: read-only.
chooseLabel (optional)stringDefault “Choose”.
busyLabel (optional)string
cancelLabel (optional)stringSelectable: the way out. Default “None of these”.
receiptLabel (optional)stringReceipt lead-in before the chosen name. Default “You chose”.
cancelledText (optional)string
footnote (optional)string
link (optional){ label: string; href: string }
FieldTypeNotes
idstringKey into every row’s values.
namestringColumn heading: the plan, vendor, version or offer.
price (optional)stringHeadline figure under the name, e.g. “$29”.
priceSub (optional)stringSmall line under the price, e.g. “per seat / mo”.
description (optional)stringOne short line under the price. Keep it to a few words: columns are narrow in chat.
disabledReason (optional)stringWith selectable: shown instead of its Choose button, e.g. “Not for 18 seats”.
FieldTypeNotes
labelstringThe attribute, e.g. “Storage”.
valuesRecord<string, CompareValue>One value per item id. A missing id or null shows as not offered.
kind (optional)"text" | "number" | "boolean" | "rating"How values draw. Default: from the value (number, boolean, else text). “rating” draws stars out of max.
format (optional)NumberFormatHow a number shows (currency, percent, compact).
unit (optional)stringAfter a number, e.g. “GB” or “days”.
max (optional)numberRating scale. Default 5.
better (optional)"higher" | "lower"Which value wins the row: it gets a star and “best” for screen readers. Omit when neither is better.
hint (optional)stringA short hint under the label.
group (optional)stringStarts a section above this row, e.g. “Security”.
FieldTypeNotes
choose() (optional)(id: string) => Promise<unknown>Selectable: acts on the choice (switch the plan, accept the quote). Throw to show the error and keep the card open.

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.