Home / Companies / Upstash / Blog / Post Details
Content Deep Dive

Resumable AI SDK v5 Streams with Upstash Realtime

Blog post from Upstash

Post Details
Company
Date Published
Author
Josh
Word Count
2,281
Language
English
Hacker News Points
-
Summary

Upstash Realtime is a new product designed as an alternative to Pusher/Ably, utilizing Redis Streams to add real-time features to applications, especially those built with Next.js and deployable on Vercel. The product addresses common issues in AI chat applications, such as losing AI generation due to connection drops, by enabling resumable streaming. This involves setting up a structure where the AI response generation is managed as a background job using Upstash Workflow, ensuring it continues even if the user disconnects, and making the stream viewable on multiple devices. The system uses a custom transport layer to handle reconnections and manages chat history through Redis, allowing the user to replay and resume streams seamlessly. The approach contrasts with traditional streaming by decoupling the generation process from direct client connections, providing a more resilient user experience. The setup and integration process is fully open-source, with a focus on handling persistent connections through a separate subscriber, allowing for uninterrupted AI response streaming and history replay upon reconnection.