Skip to content

Conversation

@VaguelySerious
Copy link
Member

@VaguelySerious VaguelySerious commented Jan 16, 2026

This makes multi-turn session the default for the flight booking app. This is an alternative to #26, using a different pattern for user message persistence.

The docs PR vercel/workflow#759 also publishes the page on how to do chat session modeling, which includes example code snippets from this PR.

Critically, this PR also removes all localStorage use for persistence, with the exception of the last run ID. The durable streams serve as the main durability and storage. To do this, we also specifically persist user messages inside the stream, which wasn't done previously

Also see vercel/workflow#739

Difference in variants

Variant A lets useChat natively handle optimistic rendering of user messages, and writes custom data chunks to the stream that the client interprets as user messages.

Variant B writes user messages to the actual stream as user messages, so that the stream is the source of truth and consists of 100% normally interpretable UIMessageChunk chunks.

I prefer variant B, as it's better for later processing with AI SDK, since the user messages are inside the stream as the SDK would expect them to be.

The downside with Variant B is that is requires slightly more optimistic rendering code.

Screenshots

image

Signed-off-by: Peter Wielander <[email protected]>
Signed-off-by: Peter Wielander <[email protected]>
Signed-off-by: Peter Wielander <[email protected]>
@VaguelySerious VaguelySerious changed the title [flight-booking-agent] Multi-turn chat and message injection [flight-booking-agent] Multi-turn chat and message injection (variant A) Jan 16, 2026
@VaguelySerious VaguelySerious marked this pull request as ready for review January 16, 2026 18:46
Signed-off-by: Peter Wielander <[email protected]>
…g added to conversation history in multi-turn conversations

Co-authored-by: VaguelySerious <[email protected]>
Signed-off-by: Peter Wielander <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants