---
title: "Sidekick’s Improved Streaming Experience"
description: "Sidekick addresses two streaming problems in LLM chatbots: Markdown fragments can render awkwardly before syntax is complete, and tool-driven responses can delay visible output across multiple LLM roundtrips. Its solution combines a buffering Markdown parser with an event emitter that multiplexes the main response and asynchronously resolved content into one stream. A Node.js Transform stream processes Unicode characters through a finite-state machine, buffering ambiguous sequences such as emphasis, list markers, and links until they resolve or are flushed as raw text. The parser also recognizes card links, triggering asynchronous card-resolution tasks while Server-Sent Events carry named streams to the UI, which demultiplexes them into the main response and placeholders. The design uses Markdown as a human-readable transport between the LLM, backend, and frontend, allowing content to appear as it is produced."
---

# Sidekick’s Improved Streaming Experience

[Shopify](https://yomu.fyi/company/shopify) · 2023-10-18 · Aug 1, 2023

**Type:** Explainer

## Summary

Sidekick addresses two streaming problems in LLM chatbots: Markdown fragments can render awkwardly before syntax is complete, and tool-driven responses can delay visible output across multiple LLM roundtrips. Its solution combines a buffering Markdown parser with an event emitter that multiplexes the main response and asynchronously resolved content into one stream. A Node.js Transform stream processes Unicode characters through a finite-state machine, buffering ambiguous sequences such as emphasis, list markers, and links until they resolve or are flushed as raw text. The parser also recognizes card links, triggering asynchronous card-resolution tasks while Server-Sent Events carry named streams to the UI, which demultiplexes them into the main response and placeholders. The design uses Markdown as a human-readable transport between the LLM, backend, and frontend, allowing content to appear as it is produced.

## Context

LLM chatbot streaming can produce Markdown rendering jank when syntax fragments are incomplete, and response delays when multiple LLM roundtrips are needed to consult external data sources and assemble an answer.

## Approach / What changed

A stateful Node.js Transform stream uses a finite-state machine to buffer ambiguous Markdown sequences and flush them when they are either complete or revealed to be false positives. Special card links trigger asynchronous content resolution, while Server-Sent Events multiplex the main response and card streams into one response that the UI demultiplexes into the main output and placeholder areas.

## Takeaways

- The Markdown parser buffers candidate expressions such as emphasis, list markers, and links, rendering complete elements together or flushing false positives as raw text.
- Special Markdown links using the card: protocol let the parser trigger asynchronous card-resolution tasks without requiring a separate tool-invocation syntax parser.
- Server-Sent Events carry multiple named streams in one response; the UI renders the main LLM output immediately and places resolved card content into placeholders.

**Tags:** [Developer Experience](https://yomu.fyi/topic/developer-experience), [LLMs](https://yomu.fyi/topic/llm), [Performance](https://yomu.fyi/topic/performance), [TypeScript](https://yomu.fyi/topic/typescript)

- Source: [Shopify](https://shopify.engineering/sidekicks-improved-streaming)
- Source URL: https://shopify.engineering/sidekicks-improved-streaming
- Ingested by Yomu: 2026-08-30T13:20:58.857Z

[Read original post](https://shopify.engineering/sidekicks-improved-streaming)
