Loading component…
Loading component…
What agents actually say to each other – a quiet chat showing who each message is from and for, handoffs and questions for you tagged, files as chips and a composer with @
To reuse this local React demo, copy all files from the Code tab into the same folder, then import CollaborationStream from ./collaboration-stream.
import { CollaborationStream, type StreamAgent, type StreamMessage } from "@/components/ui/collaboration-stream";
const agents: StreamAgent[] = [
{ id: "orch", name: "Orchestrator", model: "Opus 5.5" },
{ id: "research", name: "Researcher", model: "Gemini 3.8 Flash" },
];
const messages: StreamMessage[] = [
{ id: "m1", from: "you", to: "orch", kind: "ask", text: "Launch the new pricing page by Friday.", at: "14:02" },
{ id: "m2", from: "orch", to: "research", kind: "spawn", text: "Find out what the others charge per seat." },
{ id: "m3", from: "research", to: "orch", kind: "share", text: "Linear $10, Notion $12, Figma $15 per seat.", at: "14:04",
replyTo: "m2", attachments: [{ label: "pricing-table.csv" }] },
];
export function RunChat() {
return <CollaborationStream agents={agents} messages={messages} task="Launch the new pricing page" live />;
}| Name | Type | Default | Description |
|---|---|---|---|
| agents | StreamAgent[] | { id, name, model?, avatar? } – every agent gets its own pixel mark and color in this order; avatar swaps the mark for a logo | |
| messages | StreamMessage[] | { id, from, to, kind, text, at?, replyTo?, typing?, attachments?, details? } – in the order they were sent; from and to are agent ids, "you" or (to) "all" | |
| kind | "ask" \| "reply" \| "handoff" \| "share" \| "question" \| "spawn" | Per message – a handoff is tagged, a question to you says Needs you, a spawn is a quiet line "X started Y" | |
| replyTo | string | Per message – the id it answers; it shows as a quote unless that message is right above, and a click on the quote jumps there | |
| typing | boolean | Per message – still being written: Writing… shimmers and the sender's mark twinkles | |
| attachments | StreamAttachment[] | Per message – { label, kind?, preview?, meta? } as small white chips; a click opens the preview window. kind is told from the label when left out: "…/" a folder, .csv a table | |
| details | StreamDetails | Per message – { facts?, items? } shown in a card under the message when it's clicked | |
| task | string | What the run is about – part of the stream's label | |
| live | boolean | false | The run is still going – a Live dot, and the stream follows new messages unless you scrolled up |
| selected | string \| null | Controlled id of the picked message – its details open, the rest fades | |
| onSelectedChange | (id: string \| null) => void | A message was picked or let go | |
| focusAgent | string \| null | Controlled id of the agent whose messages stay – the tabs on top | |
| onFocusAgentChange | (id: string \| null) => void | A tab was picked | |
| onSend | ({ text, to, replyTo? }) => void | Shows the composer. to holds the agents named with @ or the one answered, else ["all"] | |
| placeholder | string | "Message the agents – @ to name one" | The composer's placeholder |
| logos | Record<string, ReactNode> | Names that get their logo in the text, e.g. { Notion: <NotionLogo /> } | |
| maxHeight | number | 520 | The stream scrolls past this height in px – with a composer it's the fixed height, so the composer never moves |
| title | string | "Agent chat" | Label of the stream for assistive tech |
| className | string | Extra class on the root |
Built on a container query – bubbles hug their words up to 560px and wrap on narrow screens
The tabs scroll sideways when there are more agents than room
The preview window fits the component, its content scrolls
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"