Skip to content

feat(assemblyai): expose session ID from Begin event#5132

Merged
theomonnom merged 1 commit intolivekit:mainfrom
dlange-aai:assemblyai-update
Mar 18, 2026
Merged

feat(assemblyai): expose session ID from Begin event#5132
theomonnom merged 1 commit intolivekit:mainfrom
dlange-aai:assemblyai-update

Conversation

@dlange-aai
Copy link
Contributor

@dlange-aai dlange-aai commented Mar 17, 2026

Summary

  • Parses the Begin event from the AssemblyAI WebSocket connection, which was previously silently dropped
  • Exposes session_id and expires_at as properties on SpeechStream
  • Logs the session ID at INFO level on connect for easy debugging

Motivation

The AssemblyAI streaming API sends a Begin event when a session starts containing a unique session ID. Exposing this makes it easy for users to share the session ID with the AssemblyAI team when reporting transcription issues.

Usage

stream = stt.stream()

async for event in stream:
    # session_id is set before any speech events arrive
    print(stream.session_id)   # e.g. "676d673c-83fc-4d8a-bd95-bfe23b1c5a50"
    print(stream.expires_at)   # e.g. 1773775624
    ...

The session ID is also automatically logged:

AssemblyAI session started id=676d673c-83fc-4d8a-bd95-bfe23b1c5a50 expires_at=1773775624

Test plan

  • Verify session_id and expires_at are None before connection
  • Verify both properties are populated after the first event from a live stream
  • Verify session ID appears in logs at INFO level on connect

Parse the Begin event from the AssemblyAI WebSocket connection and expose
the session ID and expiry timestamp via `session_id` and `expires_at`
properties on `SpeechStream`. Also logs the session ID at INFO level on
connect, making it easy to share with the AssemblyAI team when reporting issues.
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@theomonnom theomonnom merged commit c1444fa into livekit:main Mar 18, 2026
11 checks passed
@dlange-aai dlange-aai deleted the assemblyai-update branch March 18, 2026 14:13
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.

2 participants