chilly-spring-61928
12/15/2025, 7:52 PMtall-airline-16756
12/15/2025, 7:52 PMtall-airline-16756
12/15/2025, 7:53 PMhandle.interrupted after playback (or when the handle resolves) to know if it was interrupted.
◦ Examples:
▪︎ Python:
handle = session.say("Hello")
await handle # waits for playback to complete
if handle.interrupted:
print("Speech was interrupted")
• TypeScript:
const handle = session.say("Hello");
await handle; // waits for completion
if (handle.interrupted) console.log("Speech was interrupted");
• Listen for agent state changes (agent_state_changed)
◦ Monitor the event and check for new_state == "speaking" to detect when speaking starts.
◦ Examples:
▪︎ Python:
@session.on("agent_state_changed")
def on_agent_state_changed(ev):
if ev.new_state == "speaking":
print("Agent started speaking")
• TypeScript:
session.on(voice.AgentSessionEventTypes.AgentStateChanged, (ev) => {
if (ev.newState === "speaking") console.log("Agent started speaking");
});
Notes:
• Interruptions occur when the user starts speaking and allow_interruptions=True (default), which stops playback and marks the SpeechHandle as interrupted.
• If you want, tell me which SDK/language you’re using and whether you prefer event-driven checks or polling, and I’ll provide a short copy-paste snippet for that environment. Sources: Agent speech and audio | LiveKit docs | Turn detection and interruptions | LiveKit Docschilly-spring-61928
12/15/2025, 7:57 PMtall-airline-16756
12/15/2025, 7:58 PMtranscription_node, you can tell if a given transcription chunk is (a) already being spoken or (b) was interrupted.
Short answer: you cannot reliably get real-time speaking or interruption status from inside transcription_node. It only receives transcription text (or TimedString when TTS-aligned transcripts are enabled) for processing; it does not expose the runtime playback state or the SpeechHandle interruption flag.
What you can do instead (recommended):
• Use TimedString with use_tts_aligned_transcript=True to get word-level `start_time`/`end_time` metadata for when words are scheduled to be spoken. This tells you when words are planned to play, not whether playback actually completed.
• Track the actual runtime state and interruptions outside the `transcription_node`:
◦ Monitor agent_state_changed events to detect when the agent enters speaking.
◦ Track the SpeechHandle returned by session.say() / session.generate_reply() and check handle.interrupted after playback or when the handle resolves.
◦ Use the speech_created event to get and store the SpeechHandle for the current utterance so you can correlate it with transcription output.
If helpful, tell me:
• Which SDK/language you’re using (Python/TypeScript), and
• Whether you want examples showing how to correlate TimedString timestamps with a SpeechHandle and agent_state_changed events — I can provide a short copy-paste snippet. Sources: Pipeline nodes and hooks | LiveKit docs | Text and transcriptions | LiveKit docs | Agent speech and audio | LiveKit docs | Turn detection and interruptions | LiveKit Docs