aws / aws/bedrock-agentcore-sdk-python

Add SSE event type and id support to _convert_to_sse

Aperta
#265 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
761
Fork
147
Merge medio
1g 23h
PR unite (30g)
7

Descrizione

**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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.