Headless in the browser
Or draw every message yourself.
The UI-less client runs the same agent with no Mindset UI. You get events; you render them.
const { createAgentConversation } = await import(
/* @vite-ignore */ "https://eu.mindset.ai/sdk/mindset-agent-uiless.js"
);
const chat = createAgentConversation({
agent: "billing-help",
getSession: () => fetch("/api/session").then((r) => r.json()),
});
let reply = "";
chat.on((event) => {
if (event.type === "text_delta") reply += event.content;
if (event.type === "widget-payload") render(event.kind, event.summary);
if (event.type === "complete") show(reply);
if (event.type === "run_error") console.error(event.message);
});
await chat.send("What does my last invoice cover?");Speaker notes
Create the conversation once (in React, guard it in a ref), because each createAgentConversation asks your backend for a session. Branch widgets on kind: quick_replies and capability_cards are public contract; for anything else, show its summary. Page tools work the same here with chat.setPageTools.