Chat cards
Wizard
A short guided setup inside one card: two or three small steps, each checked before Next, then a review of every answer with Edit links back. The card keeps one height across steps, so the chat doesn’t jump.
When to use it
Section titled “When to use it”Use it when: A setup needs 5–12 answers that fall into 2–3 natural groups, and later answers make more sense once earlier ones are in: connect an integration, create a webhook, invite a team. The user reviews everything before anything is created.
Use something else when: Up to ~8 fields the agent can mostly draft (form with approval). One choice (picker). A long setup with many sections or dependent screens (onboarding or FORM canvas on desktop).
What the agent receives
Section titled “What the agent receives”| The template calls | The agent gets | When |
|---|---|---|
submit({ values, result }) | FUNCTION_TOOL_SUBMITTED_BY_USER | After actions.save() succeeds on the review step. A save that throws keeps the review open with the error. |
cancel() | FUNCTION_TOOL_CANCELLED_BY_USER | The user closed the card (the × in its header). Nothing was created. |
States
Section titled “States”Besides its data, the template draws these as itself, with mountState(). Pick one on the preview with State.
| State | When it shows |
|---|---|
| Loading | While the setup loads again in place, after Try again. While execute runs, the SDK shows its own loader. |
| Error | execute couldn’t load what the setup needs and returned the failure as data. Try again loads the steps in place. Cancel setup 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.
WizardData
Section titled “WizardData”| Field | Type | Notes |
|---|---|---|
title | string | |
subtitle (optional) | string | |
icon (optional) | IconName | |
steps | WizardStep[] | 1–3 input steps. The review step is added after them. |
reviewTitle (optional) | string | |
reviewDescription (optional) | string | |
submitLabel (optional) | string | |
busyLabel (optional) | string | |
cancelLabel (optional) | string | Accessible name of the close button, which cancels. |
cancelledText (optional) | string | |
receipt (optional) | WizardReceipt | What the card shows after a successful save. |
WizardStep
Section titled “WizardStep”| Field | Type | Notes |
|---|---|---|
id | string | |
title | string | Short name: the step heading and its group on the review step. |
description (optional) | string | |
fields | WizardField[] |
WizardField
Section titled “WizardField”| Field | Type | Notes |
|---|---|---|
id | string | |
label | string | |
type (optional) | "text" | "email" | "url" | "number" | "select" | "textarea" | "choice" | "checks" | "toggle" | ”choice”: one option (segmented, or cards when options have descriptions). “checks”: several. “toggle”: an on/off switch. |
value (optional) | string | number | boolean | string[] | Starting value. An array for “checks”, a boolean for “toggle”. |
required (optional) | boolean | Must be filled in. For “checks”: at least one. |
options (optional) | WizardOption[] | |
placeholder (optional) | string | |
hint (optional) | string | |
pattern (optional) | string | A regular expression the whole value must match. |
patternMessage (optional) | string | Shown when the value doesn’t match pattern. |
rows (optional) | number | |
mono (optional) | boolean | Monospace text, for ids, URLs and event names. |
WizardOption
Section titled “WizardOption”| Field | Type | Notes |
|---|---|---|
value | string | |
label | string | |
description (optional) | string | Second line on option cards. |
WizardReceipt
Section titled “WizardReceipt”| Field | Type | Notes |
|---|---|---|
title (optional) | string | |
subtitle (optional) | string | |
fields (optional) | string[] | Field ids to show. Default: the first three. |
link (optional) | { label: string; href: string } |
WizardActions
Section titled “WizardActions”| Field | Type | Notes |
|---|---|---|
save() (optional) | (values: WizardValues) => Promise<{ url?: string } | void> | Saves everything. Throw to show the error on the review step. Return { url } to link the receipt. |
Install
Section titled “Install”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.
- Hosted action: TypeScript, JavaScript
- In-page handler: TypeScript, JavaScript
- wizard: TypeScript, JavaScript
- fs-kit: TypeScript, JavaScript
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.