kind-sunset-1403
08/29/2025, 2:44 AMtall-airline-16756
08/29/2025, 2:44 AMtall-airline-16756
08/29/2025, 2:45 AMaudio_enabled=False
in RoomOutputOptions
when you set up the agent session. This way, the agent won’t send any audio to the room. Here’s a quick example:
session = AgentSession(
room_output_options=RoomOutputOptions(audio_enabled=False),
)
• Turn off transcription output: Set transcription_enabled=False
in RoomOutputOptions
if you want to stop transcriptions from being sent.
• Turn off text input: To stop the agent from replying to text messages, set text_enabled=False
in RoomInputOptions
.
• Change controls during the session: You can switch audio input/output on or off anytime while the session is running with session.input.set_audio_enabled(False)
and session.output.set_audio_enabled(False)
.
• Stop responses programmatically: If you want the agent to completely hold back responses under certain conditions, you can raise StopResponse()
in your agent’s logic.
If you’d like a hand setting any of this up or want to chat about disabling just certain types of responses (like audio but keeping text), just let me know—I’m here to help!
Sources: basics/interrupts_user.py | Text and transcriptions | LiveKit Docs | How to Set Up Speech-to-Text Input with Text-Only Output in LiveKit Agents | Agents Playground | LiveKit Docskind-sunset-1403
08/29/2025, 2:59 AMtall-airline-16756
08/29/2025, 2:59 AMAgentSession
level, and you can pick whichever method fits your needs best—VAD, semantic models, or manual control. If you want, I’m here to help you get any of these set up!
Sources: AI voice agents | LiveKit Docs | livekit-plugins/livekit-plugins-turn-detector/README.md | complex-agents/role-playing/prompts/combat_prompt.yaml | How does end-of-utterance detection work in conversations? | Turn detection and interruptions | LiveKit Docskind-sunset-1403
08/29/2025, 3:00 AMtall-airline-16756
08/29/2025, 3:00 AMget_current_turn()
to check the current turn state directly. But no worries—you can keep track of turn state using a few handy events and hooks:
• Lifecycle Hooks: The on_user_turn_completed
hook is great for knowing when a user finishes their turn.
• Speech Events: You can listen for input_speech_started
and input_speech_stopped
events to see when someone’s speaking.
• Manual Turn Control: If you want more control, you can turn off automatic turn detection and handle turns yourself with methods like session.commit_user_turn()
and session.clear_user_turn()
.
These options should help you keep track of turn state smoothly in your app. If you want, I’m here to help you set it up!
Sources: livekit-agents/livekit/agents/voice/agent_session.py | AI voice agents | LiveKit Docs | Turn detection and interruptions | LiveKit Docs | Pipeline nodes and hooks | LiveKit Docskind-sunset-1403
08/29/2025, 3:30 AMtall-airline-16756
08/29/2025, 3:30 AMsession.interrupt()
to immediately pause what the agent is saying.
• Prevent New Responses: You can raise the StopResponse
exception inside the on_user_turn_completed
callback to stop the agent from replying further.
• Disconnect the Agent: Use ctx.shutdown()
to completely stop the agent and remove it from the room.
• Graceful Session End: Try session.drain()
followed by session.aclose()
to wrap things up nicely and close the session.
• End Entire Room: If you want to end the session for everyone, use the delete_room
API.
If you want a hand with any of these, just let me know—I’m here to help!
Sources: basics/interrupts_user.py | Agents telephony integration | LiveKit Docs | agents/src/pipeline/pipeline_agent.ts | livekit-agents/livekit/agents/voice/agent_activity.py | Job lifecycle | LiveKit Docskind-sunset-1403
08/29/2025, 3:44 AMtall-airline-16756
08/29/2025, 3:44 AMsession.drain()
method is super handy because it makes sure all the pending stuff—like audio from text-to-speech or any queued-up responses—gets fully processed and delivered before the agent session ends. It’s usually used when you want to shut things down smoothly without any sudden cut-offs.
For example, if your agent is wrapping up with a goodbye message, session.drain()
makes sure that message finishes playing before you call session.aclose()
to close the session. Just a heads-up: if the session isn’t running, it’ll throw an error.
If you want me to walk you through it or need a hand setting this up, just let me know—I’m here to help!
Sources: agents/src/worker.ts | Distributed Setup | LiveKit Docs | Worker lifecycle | LiveKit Docs | Deploy and scale agents on LiveKit Cloud | livekit-agents/livekit/agents/worker.py