aws / aws/bedrock-agentcore-sdk-python

Add SSE event type and id support to _convert_to_sse

Offen
#265 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
761
Forks
147
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
7

Beschreibung

**Is your feature request related to a problem? Please describe.**
`convert_to_sse` only emits data: lines. Consumers can't distinguish event types without parsing the JSON
payload, and there's no support for resumable streams via the SSE id field.

**Describe the solution you'd like**
Add an SseEvent dataclass with data, event, and id fields. When `_convert_to_sse` receives an SseEvent, it
emits the appropriate event: and id: lines. Plain values still produce data:-only frames — fully
backward-compatible.

**Describe alternatives you've considered**
- Tuple convention ((event_type, data)) — ambiguous since tuples could be legitimate data, and doesn't
support optional fields like id.
- Structured envelope dicts ({"event": "...", "data": ...}) — breaking change that moves SSE framing into
the application layer.

**Additional context**
The SSE spec defines three frame fields: event, data, and id. Supporting event lets consumers route on
event type directly. Supporting id enables resumable streams via Last-Event-ID on reconnect. Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#fields

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Locate _convert_to_sse and inspect how it currently formats plain values into data: frames. Define the requested SseEvent shape with data, event, and id, and verify that event and id lines are emitted while plain values remain data-only and backward-compatible.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, backend
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.