Skip to content

fix: add callback_interruption to Conversation/AsyncConversation - #843

Open
SomSamantray wants to merge 3 commits into
elevenlabs:mainfrom
SomSamantray:fix/672-interruption-callback
Open

fix: add callback_interruption to Conversation/AsyncConversation#843
SomSamantray wants to merge 3 commits into
elevenlabs:mainfrom
SomSamantray:fix/672-interruption-callback

Conversation

@SomSamantray

@SomSamantray SomSamantray commented Aug 11, 2026

Copy link
Copy Markdown

Issue

Conversation / AsyncConversation expose a callback for every WebSocket event type the wrapper dispatches — agent_response, user_transcript, audio_alignment, etc. — except interruption. When an interruption event arrived, the wrapper only called audio_interface.interrupt() internally; there was no way for a caller to observe the event, and text-only (no audio_interface) integrations couldn't observe it at all.

Closes #672.

Fix

Added an optional callback_interruption parameter to both Conversation and AsyncConversation, following the same pattern already used for the other callbacks. It fires with a new InterruptionEvent(event_id, reason) dataclass (mirroring the existing AudioEventAlignment pattern) in addition to the existing audio_interface.interrupt() call, in both the sync and async paths.

Added test coverage for both paths.


Note

Low Risk
Backward-compatible optional callback and additive dataclass; existing callers unchanged when the callback is omitted.

Overview
Adds optional callback_interruption on sync Conversation and AsyncConversation so apps can observe WebSocket interruption events, including text-only sessions without an audio interface.

Introduces InterruptionEvent (event_id, optional reason) and wires interruption handling to still call audio_interface.interrupt() when present, then invoke the callback if set. Sync and async message paths share the same behavior.

Adds unit tests for callback invocation with/without audio, default None callback, and missing reason on the wire event.

Reviewed by Cursor Bugbot for commit 795971e. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

Callbacks to match Raw Agent WebSockets API

1 participant