Actions

Buttons, forms and side effects — and who decides what runs.

The model can put actions on actions, cards and hero blocks. Forms, templates and email drafts have their own controls. Every action is one of five kinds:

KindWhat happensControlled by
replySends message as the user's next messageonReply on FableProvider
linkOpens an https, http or mailto URL in a new tabURL policy
copyCopies text to the clipboard—
downloadSaves model-written text as a file. Types: txt, md, csv, json, icsMIME allowlist
hostRuns a handler your app registered by nameYour actions map

Host actions

Register side effects explicitly. Anything else the model names renders disabled with an explanation.

<FableProvider
  onReply={(text) => sendMessage({ text })}
  actions={{
    "email.send": {
      confirm: "Send this email?",
      run: async ({ to, subject, body }) => {
        await sendEmail({ to: String(to), subject: String(subject), body: String(body) })
        return "Sent"
      },
    },
  }}
>
  • confirm adds an inline Confirm / Cancel step before run.
  • Throw to show an error; return a string to show a success note.
  • The payload is model-written. Validate it in run and authorize on the server as you would any user input.

Tell the model which actions exist, so it doesn't invent names:

fableSystemPrompt({ hostActions: { "email.send": "sends an email draft; pass to, subject and body" } })

Forms

Submitting a form sends a readable message such as:

Dinner details:
- Guests: 8
- Style: Family style
- Dietary needs: Vegetarian

The model sees exactly what the user sees. To also receive structured data, read the latest user message in your route; the labels and values are stable.

Read-only while streaming

FableChat passes readOnly while a response streams, so a click can't start a second turn mid-answer. Pass it yourself if you build your own chat.