Chat cards
Entity card
One record at a glance: what it is, its status and the 4–6 fields that matter, with a link to open it in your app. The agent answers the question; the card shows the record.
When to use it
Section titled “When to use it”Use it when: The user asks about one record (an account, a contact, an order, a project) and the answer is what it is, its status and 4–6 key fields, with a way to open it in your app.
Use something else when: Several records (records list or table). The user wants to change the record (form with approval). More than ~6 fields or long text (link to the record, or a canvas).
What the agent receives
Section titled “What the agent receives”| The template calls | The agent gets | When |
|---|---|---|
displayed() | FUNCTION_TOOL_DISPLAYED | As soon as the card shows. The agent goes on. |
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 card loads the record again in place, for example after Try again. While execute runs, the SDK shows its own loader. |
| Empty | execute found no record that matches. The card says so and the agent offers the closest match. |
| Error | execute returned the failure as data, so the agent can explain it. Try again loads the record 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.
EntityCardData
Section titled “EntityCardData”| Field | Type | Notes |
|---|---|---|
id (optional) | string | Your record’s id. The card doesn’t show it; your actions.run can use it. |
kind (optional) | string | What the record is, above the name: “Account”, “Contact”, “Order”. |
name | string | |
subtitle (optional) | string | |
avatarUrl (optional) | string | Logo or photo URL. Without it, or if it fails to load, the card shows initials. |
avatarShape (optional) | "square" | "circle" | ”square” (default) for companies and things, “circle” for people. |
status (optional) | EntityStatus | |
fields | EntityField[] | 4–6 key fields. More are cut. |
tags (optional) | string[] | |
owner (optional) | EntityOwner | |
links (optional) | EntityLink[] | At most 2, in the footer. More are cut. |
EntityField
Section titled “EntityField”| Field | Type | Notes |
|---|---|---|
label | string | |
value | string | number | A number is formatted with format; a string is shown as is. |
format (optional) | NumberFormat | |
icon (optional) | IconName | Small icon before the label. |
hint (optional) | string | Short note after the value, e.g. “in 108 days”. |
href (optional) | string | Makes the value a link: a page in your app, mailto: or tel:. |
meter (optional) | number | 0–100: draws a thin bar under the value (seat usage, a health score). |
tone (optional) | EntityTone | Colour of the meter. Default: info (the brand colour). |
wide (optional) | boolean | Full row in the two-column grid. |
EntityStatus
Section titled “EntityStatus”| Field | Type | Notes |
|---|---|---|
label | string | |
tone (optional) | EntityTone | neutral (default), info, success, warning, error. |
EntityOwner
Section titled “EntityOwner”| Field | Type | Notes |
|---|---|---|
name | string | |
role (optional) | string | e.g. “Account owner”. |
avatarUrl (optional) | string | Photo URL. Without it the card shows initials. |
EntityLink
Section titled “EntityLink”| Field | Type | Notes |
|---|---|---|
label | string | |
href (optional) | string | Where the link goes. Without it, the card calls actions.run(link). |
id (optional) | string | Tells your actions.run which link was clicked. |
primary (optional) | boolean | One link can be the primary button (brand colour). The others are then outline buttons. |
icon (optional) | IconName |
EntityCardActions
Section titled “EntityCardActions”| Field | Type | Notes |
|---|---|---|
run() (optional) | (link: EntityLink) => void | A footer link without href was clicked. Open or do it in your app. |
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
- entity-card: 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.