aws / aws/bedrock-agentcore-sdk-python

Add SSE event type and id support to _convert_to_sse

Ouverte
#265 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
761
Forks
147
Merge moyen
1 j 23 h
PR mergées (30 j)
7

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
api, backend
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.