AI Engineering
/
AI Application Integration
/

Design a resilient streaming chat

AI Application Integration · 3 to 4 hours

Design a resilient streaming chat

Design a streaming interview-practice chat that keeps one answer correct across reconnects, several open tabs, and cancellation races, checks citations against current access, and never repeats its booking tool during recovery.

Hard
System Design

4 h

Premium

Used in interview rounds:

AI System Design (Hard)

Overview

Design a chat experience that keeps one answer correct across disconnects, reconnects, several tabs, cancellation, and changing source access. The goal is an explicit contract connecting durable server state, client rendering, replay, citations, accessibility, and authorized side effects, backed by fault-injection tests.

Study time: 3 to 4 hours

Interview format: System design discussion with a fault-injection plan

By the end you can

  • Separate runs from connections, and give conversations, messages, attempts, runs, and tool operations their own durable identities
  • Make submission idempotent and bind each run to the conversation revision it accepted
  • Replay persisted events after a client cursor, and hand off from a snapshot to live events without a gap or a duplicate
  • Resolve cancellation races with one authoritative terminal state while keeping completed tool effects recorded
  • Keep citations, authorization, and accessible fallbacks correct across reconnects and access changes
  • Plan fault-injection tests that check each recovery invariant beyond reducer unit tests

Prerequisites

Helpful background: Familiarity with HTTP streaming, client state reducers, database transactions, and access control helps.

This topic covers client and server streaming state, cancellation, reconnects, citations, and accessible UI. Model Serving & Inference covers runtime scheduling, memory, and hardware.

In this guide

  1. Separate execution from connection
  2. Idempotent submission
  3. Event persistence and replay
  4. Snapshot plus replay consistency
  5. Worked replay timeline
  6. Cancellation and competing terminal states
  7. Multi-tab and concurrent conversation edits
  8. Citation lifecycle
  9. Accessible recovery and fallback
  10. Security, privacy, and local persistence
  11. Performance and observability
  12. Scenario: an interview-practice chat
  13. Fault-injection plan

Hard questions are part of Premium: the study guide, reference answer, rubric, and exercises unlock with Premium.

Practice the interview question

Answer it in your own words before you look at the reference answer.