Payload renderers
The agent sends a kind and some data. The app decides how it looks and what happens when you click it.
The problem
When the server decides what the assistant can generate, every “AI can draft X” feature means a server change, a new payload type and a one-off viewer in the chat. The preview never quite matches the real page. It has a different grid, no editing, and a Save button that reimplements the real one badly.
What I concluded
The client already knows its own pages. So the client declares what it can render, and the agent only fills in the data.
Each kind is a schema plus what to do with it:
declarePayload({
name: "dashboard",
description: "A dashboard of charts over the account's data.",
input: DashboardSpec, // the model fills this in
open: async (spec, app) => {
// write the draft where the real page already reads from, then go there
app.cache.set(dashboardQuery("draft"), toDraft(spec));
await app.go("/dashboards/draft");
},
});
The agent has one “make” tool, and its list of kinds is exactly what the app declared. It returns a payload, the chat shows it as a card, and clicking the card runs open.
app declares { name, schema }
│
▼
agent: make("dashboard") ──▶ payload { kind, data }
│
▼
the real dashboard page ◀── click ◀── card "Late orders by region"
(its own grid, its own Save)
Open the real thing
The important move is what open does. It doesn’t render a preview. It writes the draft into the real page’s data and navigates there. The page reads its normal query, finds the draft, and renders with its normal components. It doesn’t know the data came from the assistant, and its Save is the real Save.
Rules
- Unknown kind, no card. If the client doesn’t know a kind, or the payload is a newer version than it understands, nothing renders. A newer agent never breaks an older client.
- Drafts open unsaved. The page marks it as a draft, in text and not just color, and nothing is saved until a person presses Save.
- One make path. A “Generate” button on a page and a request in chat hit the same producer. Same output, same card.
- Adding a kind is one declaration next to a page you already have. No server change.
What you get
The server stays generic. Each card, click and save lives in the part of the app that actually understands it. When the dashboard page gets a new feature, the assistant’s dashboards get it too, on the same day, for free.
Part of UI as rendering engine. For forms specifically, see Assisted forms.