Skip to content

Streaming: chat_stream + SSE endpoint #2

Description

@sagi5060

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions