HomeChallengesRepsProblemsLeaderboardTake a challenge

Stream the Answer

Paint tokens as they arrive, and make a second question cancel the first. This is the whole difference between an AI feature that feels fast and one that feels broken.

Intermediate20 min on the clock6 graded checks · 100 pointsRAG and Model APIsPro

See alsoAI Streaming EndpointThe same streaming concept, graded in a second track.

Graded by reading your code against the checklist below.

What you build

  • Request the stream and read the response body incrementally
  • Parse SSE frames, including ones that arrive split in half
  • Append each text_delta to the UI as it arrives
  • Abort the previous request when a new question is asked
  • Treat an abort as a normal outcome, not an error
  • Handle an error event that arrives mid-stream

Done means

Text appears within a second and keeps growing; asking again mid-answer replaces it cleanly.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Ask for a stream and read it incrementally+20Streaming responses
  2. Buffer partial frames instead of parsing them+20Streaming responses
  3. Render each delta as it arrives+15Streaming responses
  4. Cancel the previous request+20Async and its failure modes
  5. An abort is not an error+15Error handling
  6. Handle a failure that arrives mid-stream+10Rate limiting and cancellation

What it teaches

Async and its failure modesintermediate

Every await can reject; modelling idle, loading, success and error explicitly is what stops a slow network showing a blank screen with no explanation.

The rest of RAG and Model APIs