@s2-dev/resumable-stream— drop-in stream resumption for AI chatbots built with the Chat SDK.- TypeScript SDK examples — reference implementations showing agent sessions, chat persistence, and multi-agent patterns using the S2 TypeScript SDK directly.
Chat SDK
S2 can be used as a backend for stream resumption in AI chatbot applications with the@s2-dev/resumable-stream npm package.
This is inspired by Vercel’s take on stream resumption.
Prerequisites
-
Sign up here, generate an access token and set it as
S2_ACCESS_TOKENin your env. -
Create a new basin from the Basins tab with the Create Stream on Append option enabled, and set it as
S2_BASINin your env.
S2_BATCH_SIZE.
Integrating with the Chat SDK
Import the Package
route.ts
Stream Creation
route.ts
Stream Resumption
route.ts

