Problem
chat() blocks until the full turn completes. Middle's UX targets (first acknowledgement p95 < 5s) need incremental output; today a customer stares at nothing for the whole turn.
Proposed shape
app.chat_stream(name, session_id, message) → async iterator of text deltas (wraps SDK Runner.run_streamed), same session semantics as chat().
POST /agents/{name}/chat grows ?stream=true (or an SSE sibling endpoint) emitting text/event-stream deltas + a final done event with the full output.
Done when
- Deltas arrive before the turn completes (test with a mocked model or a live key).
- Session history is identical whether the turn was streamed or not.
- Non-streaming path unchanged.
Problem
chat()blocks until the full turn completes. Middle's UX targets (first acknowledgement p95 < 5s) need incremental output; today a customer stares at nothing for the whole turn.Proposed shape
app.chat_stream(name, session_id, message)→ async iterator of text deltas (wraps SDKRunner.run_streamed), same session semantics aschat().POST /agents/{name}/chatgrows?stream=true(or an SSE sibling endpoint) emittingtext/event-streamdeltas + a finaldoneevent with the full output.Done when