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

Vercel AI SDK in production: when DefaultChatTransport needs a session layer

Blog post from Ably

Post Details
Company
Date Published
Author
Ably
Word Count
4,251
Company Posts That Month
17
Language
-
Hacker News Points
-
Summary

The development of an AI chat app using the Vercel AI SDK functions smoothly in a development environment but encounters limitations when deployed to production due to the default transport layer, DefaultChatTransport, which is designed for HTTP and Server-Sent Events (SSE). These protocols, while suitable for a stateless serverless platform, present challenges such as ambiguous cancellation signals, lack of multi-device support, and the need for significant infrastructure for stream resumption. DefaultChatTransport's limitations become apparent when production requirements exceed the single-user, single-device model it supports, leading to potential costs like orphaned AI generations and silent failures on additional devices. Vercel's design allows for a pluggable ChatTransport interface, enabling the replacement of DefaultChatTransport with a WebSocket-based transport layer, which offers a more durable session management solution by decoupling sessions from individual connections. This replacement resolves issues like cancellation ambiguity and supports multi-device delivery without altering existing agents, tool calls, or UI elements. The decision to switch transport layers should be based on specific production needs, such as reliable server-side cancellation and multi-user session handling.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Serverless 8 1,011 235 82 -44%