Skip to content
Talk to an engineer

Chat cards

Form with approval

The agent drafts a record and the user checks it, edits it and approves it. Nothing is written until they do. Fields the agent filled in are marked until the user edits them.

KindInputAgent waitsYes, for approve or cancelMobileVariant: one column, 44px targets

Use it when: The agent is about to create or change a record and has drafted most values (from the conversation, the page or an API). The user checks, edits and approves; only then is anything written.

Use something else when: A single yes/no (confirm card). Choosing one of a few options (picker or ask_user_question). More than ~8 fields or dependent sections (wizard, or a FORM canvas on desktop).

The template callsThe agent getsWhen
submit({ approved, values, result })FUNCTION_TOOL_SUBMITTED_BY_USERAfter actions.save() succeeds. A save that throws keeps the form open.
cancel()FUNCTION_TOOL_CANCELLED_BY_USERThe user pressed Cancel. Nothing was saved.

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

StateWhen it shows
LoadingWhile the form loads again in place, after Try again. While execute runs, the SDK shows its own loader.
Errorexecute couldn’t load what the form needs and returned the failure as data. Try again loads the form 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
note (optional)stringThe agent’s one-line note above the fields.
fieldsFormField[]
submitLabel (optional)string
busyLabel (optional)string
cancelLabel (optional)string
cancelledText (optional)string
receipt (optional){ title?: string; subtitle?: string; fields?: string[]; link?: { label: string; href: string } }What the card shows after a successful save.
FieldTypeNotes
idstring
labelstring
type (optional)"text" | "email" | "number" | "date" | "select" | "textarea"
value (optional)string | number
required (optional)boolean
aiFilled (optional)booleanThe agent filled this in: dashed border and a “Suggested” mark until the user edits it.
wide (optional)booleanFull row in the two-column layout (textareas always are).
options (optional)(string | { value: string; label: string })[]
placeholder (optional)string
hint (optional)string
prefix (optional)stringShown inside the input, e.g. ”$”.
rows (optional)number
format (optional)NumberFormatHow a number shows on the receipt.
FieldTypeNotes
save() (optional)(values: FormValues) => Promise<{ url?: string } | void>Writes the record. Throw to show the error and keep the form open. Return { url } to link the receipt.

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.