fierce-answer-55580
08/23/2025, 1:14 PMtall-airline-16756
08/23/2025, 1:14 PMtall-airline-16756
08/23/2025, 1:15 PMAgentSession object doesn’t have a public pause() method. That pause() method actually lives inside the AgentActivity class and isn’t meant to be used directly.
If you’re looking to temporarily stop the agent’s current activity, a good way to do that is by using the interrupt() method instead. This will interrupt the ongoing speech generation and give you an asyncio.Future that finishes once the interruption is fully handled.
Feel free to reach out if you want me to explain anything more or help with something else!
Sources: livekit-agents/livekit/agents/voice/room_io/room_io.pyfierce-answer-55580
08/23/2025, 1:36 PMtall-airline-16756
08/23/2025, 1:37 PMinterrupt() method in AgentSession is a handy way to stop the agent's current speech generation right away. Here’s a quick look at how you can use it:
Basic Usage:
await session.interrupt()
What Happens:
• Any ongoing agent speech stops immediately.
• The chat context gets trimmed to just the speech the user heard before the interruption.
• The agent switches from speaking to listening mode.
Example:
# Interrupt the agent's current response
await session.interrupt()
If you want, I’m here to help with more examples or to clear up anything else!
Sources: Agent speech and audio | LiveKit Docs | livekit-agents/livekit/agents/voice/speech_handle.py | Turn detection and interruptions | LiveKit Docs | Turn detection and interruptions | LiveKit Docs | Agent speech | LiveKit Docsfierce-answer-55580
08/23/2025, 1:40 PMtall-airline-16756
08/23/2025, 1:41 PMfierce-answer-55580
08/23/2025, 1:49 PMtall-airline-16756
08/23/2025, 1:52 PMroom.on(RoomEvent.TrackUnsubscribed, (track) => {
console.log('Track unsubscribed:', track);
});
2. Manage Subscribed Tracks:
setSubscribedTracks(
Array.from(participant.trackPublications.values()).filter((pub) => {
return pub.isSubscribed && pub.track !== undefined;
})
);
3. Detach Audio Renderers:
For audio tracks, just detach the audio renderer or sink to stop the playback:
track.detach();
If you'd like, I can walk you through more details or provide specific examples tailored to your needs—just let me know!
Sources: README.md | pkg/rtc/subscriptionmanager.go