Skip to content
Talk to an engineer

Chat cards

Confirm

Before a change that costs money, reaches other people or can’t be undone, the user sees what changes, before and after, and confirms it. The destructive tone adds an alert, an error-colored button and an optional word to type.

KindInputAgent waitsYes, for confirm or cancelMobileVariant: stacked full-width buttons

Use it when: The agent is about to make a change the user should approve first: billing, permissions, bulk updates, deletes, anything sent to other people. The values are settled; the user only says yes or no.

Use something else when: The user still has values to fill in or correct (form with approval). A choice between options (picker). A change that is cheap to undo and was asked for in so many words (do it and show the result).

The template callsThe agent getsWhen
submit({ confirmed: true, result })FUNCTION_TOOL_SUBMITTED_BY_USERAfter actions.confirm() succeeds. A confirm that throws keeps the card open with the error.
cancel()FUNCTION_TOOL_CANCELLED_BY_USERThe user pressed Cancel. 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 preview loads again in place, after Try again. While execute runs, the SDK shows its own loader.
Errorexecute couldn’t preview the change and returned the failure as data. Try again loads the preview in place. Cancel reports cancel(), so the agent stops waiting.
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
summarystringOne sentence: what happens when the user confirms.
changes (optional)ConfirmChange[]Before and after rows. A row without to shows as removed, one without from as new.
impact (optional)stringOne line on how far the change reaches, e.g. “Affects 42 contacts”.
impactIcon (optional)IconName
tone (optional)"default" | "destructive"”destructive”: alert note, error-colored confirm button with a trash icon, optional type-to-confirm.
warning (optional)stringDestructive: the alert note. Default “This can’t be undone.”
confirmWord (optional)stringDestructive: the user types this word before the confirm button unlocks.
confirmLabel (optional)stringName the action, e.g. “Delete 3 automations”, not “OK”.
busyLabel (optional)string
cancelLabel (optional)string
removedLabel (optional)stringTag on a removed row. Default “Removed”.
done (optional)ConfirmDoneWhat the card shows after the change went through.
cancelledText (optional)string
FieldTypeNotes
fieldstringWhat changes, e.g. “Seats”. For an added or removed item: the item’s name.
from (optional)string | numberThe value now. Omit it for something new.
to (optional)string | numberThe value after. Omit it for something removed.
format (optional)NumberFormatHow a number shows.
FieldTypeNotes
title (optional)string
text (optional)string
link (optional){ label: string; href: string }
FieldTypeNotes
confirm() (optional)() => Promise<{ url?: string } | void>Makes the change. Throw to show the error and keep the card open. Return { url } to link the done state.

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.