Skip to content

feat(events)!: make session id explicit in event stream#61

Merged
galuszkm merged 3 commits into
mainfrom
fix/mg/extend-event-content
Jun 22, 2026
Merged

feat(events)!: make session id explicit in event stream#61
galuszkm merged 3 commits into
mainfrom
fix/mg/extend-event-content

Conversation

@galuszkm

Copy link
Copy Markdown
Member

Description

Give callers explicit control over the session id in the event stream instead of inferring it from manifest ordering. The SESSION_START payload is restructured into a stable envelope so consumers can access both the session id and the manifest topology in a predictable way. close() gains an optional data parameter so end-of-stream metadata can be attached at call time rather than being fixed at wiring time. The redundant "type": "agent" field is removed from AGENT_START and agent-stop payloads since it duplicated information already on the event envelope.

Related Issues

N/A

Type of Change

  • Breaking change

YAML / API Impact

Yes — breaking changes to the public Python API and the event stream contract.

  • ResolvedConfig.wire_event_queue() now accepts an explicit session_id: str | None = None keyword argument. Previously the session id was derived automatically from the first session manager found in the manifest. Callers that relied on implicit derivation now receive None unless they pass session_id explicitly.
  • first_session_id(manifest) has been removed from strands_compose.manifest. Any code importing it will break.
  • SESSION_START event data shape changed from the raw SessionManifest.model_dump() dict to {"session_id": <str | null>, "manifest": <SessionManifest dict>}. Consumers reading event.data["agents"] directly must update to event.data["manifest"]["agents"].
  • EventQueue.close() now accepts an optional data: dict parameter.
  • AGENT_START and AGENT_COMPLETE event payloads no longer include the "type": "agent" field.

Config YAML schema is unchanged.

Testing

How have you tested the change?

  • I ran uv run just check (lint + type check)
  • I ran uv run just test for overall testing
  • I added or updated tests that prove my fix is effective or my feature works
  • I verified existing examples in examples/ still work

Checklist

  • I have read the CONTRIBUTING document
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

galuszkm added 3 commits June 22, 2026 12:01
Let callers pass the session id into wire_event_queue instead of inferring it from manifest ordering, and give SESSION_START/SESSION_END a stable, predictable shape.

BREAKING CHANGE: first_session_id() removed; wire_event_queue no longer auto-derives the session id. SESSION_START data is now {session_id, manifest} and AGENT_START/agent-stop payloads drop the "type" field.
- Update AnsiRenderer to access manifest from event.data["manifest"] instead of directly from event.data
- Aligns with explicit session id structure in event stream
@galuszkm galuszkm merged commit 4ba70d6 into main Jun 22, 2026
8 checks passed
@galuszkm galuszkm deleted the fix/mg/extend-event-content branch June 22, 2026 10:21
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