Skip to content

Exercise 01 — Streaming Chatbot

Timebox: 30-45 minutes

Goal

Turn chatbot.py into a multi-turn streaming chatbot that keeps history and behaves cleanly under transient failures.

Work in

  • chatbot.py

Tasks

  1. Replace the mock stream with a real provider call or keep the mock and improve the architecture first.
  2. Keep conversation history across turns.
  3. Allow a system prompt.
  4. Print token or usage information after each response.
  5. Retry on rate-limit or transient failures.

Done when

  • The CLI supports multiple turns
  • Responses stream instead of arriving all at once
  • History is preserved across turns
  • Failures retry before surfacing