Skip to content

Use the AI SDK's UI message stream between the agent service and the browser #9482

Open

Description

@bobbai00

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:

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

  1. added theissue type on Nov 16, 2026
  2. changed the title [-]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[/+] on Nov 16, 2026
  3. bobbai00 commented on Nov 16, 2026

    @bobbai00
    ContributorAuthor

    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 ai against 6.3M of @ag-ui/core). The comparison is in the description.

  4. bobbai00 commented on Nov 16, 2026

    @bobbai00
    ContributorAuthor

    /take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions