Skip to content

Add ADR-004: streaming/SSE client design - #24

Merged
mehmetkr merged 1 commit into
mainfrom
adr-004-streaming-sse-design
Dec 1, 2026
Merged

mehmetkr merged 1 commit into
mainfrom
adr-004-streaming-sse-design

Conversation

@mehmetkr

@mehmetkr mehmetkr commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds ADR-004 documenting the design decisions for the streaming/SSE client that will wrap Trigger.dev session channels
  • Inline SSE parser (matching anthropic/openai SDK pattern), reconnection via Last-Event-ID, separate _streaming.py and _channels.py modules
  • Informed by Item 17 streaming investigation: channels are SSE + REST POST at /realtime/v1/sessions/, not in OpenAPI spec

Decisions

  • SSE parsing: inline ~100-line parser module (_streaming.py), no httpx-sse dependency
  • Reconnection: Last-Event-ID resume with exponential backoff, 5-attempt default for streams
  • Module layout: _streaming.py (wire format) + _channels.py (transport/reconnection)
  • Stream API: Stream[T]/AsyncStream[T] with __iter__/__aiter__ + context manager
  • New exceptions: StreamingError, SessionClosedError (409), SessionExpiredError (400)
  • Base URL: same host, /realtime/v1/ path prefix (vs /api/v1/ for management API)

Test plan

  • ADR reviewed for correctness against Item 17 investigation findings
  • Design decisions verified against anthropic-sdk-python and openai-python patterns
  • No code changes; CI passes (193 tests, lint, typecheck)

@mehmetkr
mehmetkr merged commit 445830e into main Dec 1, 2026
7 checks passed
@mehmetkr
mehmetkr deleted the adr-004-streaming-sse-design branch December 1, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant