How to use manual turn detection with Node.js SDK
# ask-ai
b
How to use manual turn detection with Node.js SDK
t
Thanks for reaching out, Dmytro. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you want to control user turns yourself with the Node.js SDK. Here’s the minimal setup and the key methods. To enable manual turn control: • Set
turn_detection: "manual"
when creating your
AgentSession
docs. Core methods to control turns: •
session.interrupt()
— programmatically interrupt the agent (e.g., when the user starts talking) docs. •
session.clear_user_turn()
— start/continue the user’s turn docs. •
session.commit_user_turn()
— signal end of the user’s turn to let the agent respond docs. Typical Node.js flow: 1. Create an
AgentSession
with
turn_detection: "manual"
. 2. From your UI (e.g., push-to-talk), call backend endpoints that invoke: ◦
clear_user_turn()
when the user begins speaking ◦
commit_user_turn()
when they release the button/end speech ◦
interrupt()
if you need to stop the agent mid-response If you’re mixing with realtime models or STT plugins, ensure turn detection is handled by your agent when using manual mode docs. Would you like a minimal Node.js + frontend push-to-talk example that wires these calls together? Sources: Turn detection and interruptions | LiveKit Docs | Building voice agents | LiveKit Docs | LiveKit turn detector plugin | LiveKit Docs | Text and transcriptions | LiveKit docs | Pipeline nodes and hooks | LiveKit docs