Next.js Discord

Discord Forum

Is it possible to use Vercel AI's streamUI on an API endpoint?

Unanswered
English Spot posted this in #help-forum
Open in Discord
English SpotOP
Using the Vercel AI SDK and playing around with streamUI. Is it possible to use streamUI on an endpoint like generateText? Currently they only mention server actions on their documentation.

streamUI documentation: https://sdk.vercel.ai/docs/reference/ai-sdk-rsc/stream-ui

3 Replies

Snowshoe
I've been playing around with the same idea for the last couple of days. The use case is pretty powerful - the backend becomes a server that can talk to externally hosted AI tools that are discover-able at runtime, allowing for an extensible system where providers can plug in to customize how an AI Agent UI presents their data.
I can imagine how this could be possible with server rendered components, since pure HTML is streamed back with no additional JS loads necessary. Client components would be trickier I think as they bring a variety of trust issues. They would also be the much more compelling use case (interactive).
If anyone knows of any work or discussion in this direction, please link to it here, thanks