Back to blog
Guide

Streaming and rich cards: what's inside the FluxChat SDK

FluxChat's SDK and web widget look simple from the outside (a chat window), but there's a fair amount happening underneath. Here's a tour.

Streaming replies

Replies stream in over a newline-delimited JSON protocol: begin, item, and end frames. A single response can contain multiple begin/item/end cycles: the main agent's reply is one cycle, and any sub-agent "thinking" frames (like a product search running in the background) are silently dropped so only the top-level agent's text ever reaches the chat window.

Conversation memory

The agent appends a <state>{...}</state> tag to its reply. The client captures it, strips it from what's displayed, and echoes it back on the next turn, so conversation memory persists without you managing sessions yourself.

Rich cards

Product, order, blog, and image cards are embedded in the reply as <products>, <orders>, <blogs>, and <images> tag islands containing JSON. Both the Flutter SDK and the web widget parse these out and render native cards, and both deliberately suppress an incomplete tag (still streaming in) rather than flashing partial JSON on screen.

Image generation

Image generation lives in its own n8n workflow, so the image provider is picked there rather than in the client. That workflow isn't released yet.

Curious how it looks running live? Try the widget designer.