Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Streaming

examples/refund_stream/main.rs does the same task with "stream": true: it reads the server-sent events itself, prints text as it arrives, and rebuilds each assistant message from the events. Its take, examples/refund_stream/_main.take, holds one event record per event. Replay serves the events instantly by default; --pacing realtime serves them at the recorded offsets, so the text appears at the speed it was generated:

env -u ANTHROPIC_API_KEY ANTHROPIC_MODEL=claude-haiku-5-5 \
  retake replay --pacing realtime --takes-dir examples/refund_stream \
  -- cargo run -q --example refund_stream

Replay pacing

Recorded events are sent in order. --pacing (or RETAKE_PACING) sets the timing: instant (the default), realtime (at the recorded offsets), or a speed-up factor such as 4. A stream that the client closed during recording ends the same way on replay.

While recording, streamed ("stream": true) responses reach the command as they arrive, and each event is appended to the take as it completes. How a secret split across events is redacted is described in Redaction: Streams.