Repository navigation
Description
Task Summary
Today the agent service and the browser talk over a WebSocket protocol of the service's own (types/ws/client.ts and types/ws/server.ts): a prompt and a stop command one way, and snapshot, step, status and error events the other way. Each step event carries the whole workflow before and after the step, and the chat replaces the canvas with it (agent-chat.component.ts:277). The frontend reads these events untyped, so every new kind of content is written twice, once on each side.
The agent service already runs on the AI SDK, which has its own protocol for this boundary: the UI message stream. The service turns a turn into that stream with toUIMessageStream(), and the browser reads it with the SDK's chat client, @ai-sdk/angular today and @ai-sdk/react once the React frontend lands. I propose using it:
- A prompt is a
POST /api/agents/{id}/chatwith the new message. The answer streams back as server-sent events: text, tool calls with their inputs and outputs, and step boundaries. - The chat keeps its messages as
UIMessages, the SDK's format for showing and storing a conversation, andconvertToModelMessagesturns them into the model's messages. Opening the chat loads them from the message list in Use the AI SDK's native message history in the agent #9455. - A turn keeps going when the browser leaves, as it does today, and a browser that comes back during a turn resumes the stream. Stopping stays its own request.
- Until Let the agent join the workflow's shared editing and execution session #9464, the workflow after each step goes as a typed data part, which the chat applies as it does today. Let the agent join the workflow's shared editing and execution session #9464 removes it, since the agent's edits then reach every canvas through the shared session.
- Approvals, for review mode (Review mode for agent edits: accept, reject, or request changes #9075) and for an execution that would replace another, can later use the SDK's tool approvals, which both chat clients support.
I compared it with AG-UI, the open protocol the Texera 2.0 prototype uses:
| AI SDK UI message stream | AG-UI | |
|---|---|---|
| Weekly npm downloads (Nov 9 to 15) | ai 45.8M, @ai-sdk/react 13.4M |
@ag-ui/core 6.3M, @ag-ui/client 2.3M |
| Code to map the AI SDK's stream | None | Ours to write and keep (about 460 lines in the prototype), since no adapter for the AI SDK exists |
| Browser clients | @ai-sdk/angular, @ai-sdk/react (Apache-2.0) |
@ag-ui/client, CopilotKit, assistant-ui (MIT) |
| Agents from other frameworks | Through @ai-sdk/langchain, @ai-sdk/llamaindex, or the documented protocol |
Built into many frameworks |
The UI message stream needs no code of ours on either side, and it is by far the more used. The trade-off is that it is the AI SDK's own format rather than a neutral standard, so an agent from a framework without an adapter needs one.
This does not wait for the React frontend. In the Angular app, agent.service.ts reads the stream with @ai-sdk/angular and keeps today's chat, and the React chat later uses useChat on the same endpoint, so it is built once, against a protocol that is already settled.
Done when the chat works over the UI message stream as it does today, and the WebSocket protocol and its types are deleted.
Task Type
- Refactor / Cleanup
- DevOps / Deployment / CI
- Testing / QA
- Documentation
- Performance
- Other
Activity
[-]Use the AG-UI protocol between the agent service and the browser[/-][+]Use the AI SDK's UI message stream between the agent service and the browser[/+]bobbai00 commentedon Nov 16, 2026
Changed from AG-UI to the AI SDK's own UI message stream. The agent service already runs on the AI SDK, so this needs no mapping code on either side, it has maintained clients for Angular and React, and it is used several times more than AG-UI (45.8M weekly downloads of
aiagainst 6.3M of@ag-ui/core). The comparison is in the description.bobbai00 commentedon Nov 16, 2026
/take