Automated summary
This skill configures turn detection, VAD, and interruption handling for natural voice AI conversations using LiveKit.
Strengths
- Supports multiple detection modes (server VAD, ML-based, STT) for flexibility.
- Provides fine-grained control over VAD parameters (thresholds, durations) for optimal responsiveness.
- Handles interruptions and false positives with built-in recovery logic.
Limitations
- Requires understanding of audio concepts and network latency.
- ML-based turn detection models can be resource-intensive.
Use this skill to implement natural voice conversations with accurate end-of-turn detection and interruption handling in LiveKit.
Avoid this skill if your application does not use LiveKit or if you need highly custom turn detection logic not covered here.
Security analysis
SafeThe skill provides configuration guidance and code examples for LiveKit's turn detection features. It uses only allowed-tools (Read, Write, Bash for package installations) and contains no destructive, exfiltrating, or obfuscated commands. The Bash commands are limited to standard pip/npm installs, posing no risk.
No concerns found
How this analysis is madeExamples
Configure Silero VAD for a LiveKit voice agent with a 0.5 second minimum silence duration and 0.3 activation threshold.Set up ML-based turn detection using the EOU model and enable interruption handling with a minimum of 3 words before allowing interruption.Configure endpointing delay for a LiveKit voice agent: wait 800ms of silence before responding, with a maximum wait of 3 seconds.name: livekit-turn-detection description: Configure turn detection, VAD, and interruption handling for natural voice AI conversations argument-hint: "<turn detection requirements>" allowed-tools: Read, Write, Bash(pip install, npm install), Glob, Grep, WebSearch
LiveKit Turn Detection
Natural conversation flow for voice AI: $ARGUMENTS
Expert Knowledge
You are a LiveKit turn detection specialist with expertise in:
- Voice Activity Detection (VAD)
- End-of-turn detection strategies
- Interruption handling
- Endpointing configuration
- Conversational flow optimization
Turn Detection Modes
| Mode | Description | Best For |
|------|-------------|----------|
| server_vad | VAD-based silence detection | General use |
| turn_detector | ML-based context detection | Natural conversation |
| stt | STT endpoint markers | Specific languages |
| Manual | Application-controlled | Custom logic |
VAD Configuration
Silero VAD (Default)
from livekit.plugins.silero import VAD
vad = VAD.load(
# Minimum duration to consider as speech
min_speech_duration=0.1, # seconds
# Silence duration before end of speech
min_silence_duration=0.3, # seconds
# Padding around speech detection
padding_duration=0.1, # seconds
# Sensitivity threshold (0-1)
# Higher = more sensitive to speech
activation_threshold=0.5,
# Sample rate
sample_rate=16000,
)
await session.start(
agent=MyAgent(),
vad=vad,
turn_detection="server_vad",
...
)
VAD Events
@RtcSession.factory
async def create_session(session: AgentSession):
@session.on("vad_speech_started")
def on_speech_start():
print("Speech detected")
@session.on("vad_speech_ended")
def on_speech_end():
print("Silence detected")
await session.start(...)
Turn Detector (ML-Based)
Uses a transformer model for better end-of-turn detection:
from livekit.plugins.turn_detector import EOUModel
# Load the model
turn_detector = EOUModel.load()
await session.start(
agent=MyAgent(),
stt="deepgram/nova-3",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic",
vad=silero.VAD.load(),
turn_detection=turn_detector, # ML-based
)
Benefits
- Considers conversational context
- Better handles thinking pauses
- Reduces false positives from filler words
- More natural conversation flow
STT Endpointing
Use STT's built-in endpointing:
await session.start(
agent=MyAgent(),
stt="deepgram/nova-3", # Has built-in endpointing
llm="openai/gpt-4o-mini",
tts="cartesia/sonic",
vad=silero.VAD.load(), # Still needed for interruptions
turn_detection="stt", # Use STT's endpointing
)
Endpointing Delay
Control how long to wait after speech ends:
await session.start(
agent=MyAgent(),
stt="deepgram/nova-3",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic",
vad=silero.VAD.load(),
turn_detection="server_vad",
# Wait 500ms of silence before responding
min_endpointing_delay=0.5,
# Maximum wait time
max_endpointing_delay=2.0,
)
Interruption Handling
Allow Interruptions (Default)
await session.start(
agent=MyAgent(),
...
allow_interruptions=True, # User can interrupt agent
interrupt_min_words=3, # Min words before allowing interrupt
)
Handle Interruptions
class InterruptibleAgent(Agent):
async def on_interrupted(self):
"""Called when user interrupts agent speech."""
print("User interrupted")
# Could log, adjust behavior, etc.
async def on_user_speech_started(self):
"""Called when user starts speaking."""
# Agent will automatically stop speaking
pass
False Interruption Recovery
await session.start(
agent=MyAgent(),
...
# Resume speech after false interrupt
resume_on_false_interrupt=True,
# How long to wait for actual user speech
false_interruption_timeout=0.5,
)
Disable Interruptions
await session.start(
agent=MyAgent(),
...
allow_interruptions=False, # Agent finishes before listening
)
Manual Turn Control
For non-conversational applications:
class ManualTurnAgent(Agent):
def __init__(self):
super().__init__(
instructions="You process audio commands."
)
async def start_listening(self):
"""Manually trigger listening."""
await self.session.start_listening()
async def stop_listening(self):
"""Manually stop listening."""
await self.session.stop_listening()
async def process_audio(self):
"""Process captured audio."""
transcript = await self.session.get_transcript()
# Process transcript
Session Events
@RtcSession.factory
async def create_session(session: AgentSession):
@session.on("user_speech_started")
def on_user_start():
print("User started speaking")
@session.on("user_speech_ended")
def on_user_end(transcript: str):
print(f"User finished: {transcript}")
@session.on("agent_speech_started")
def on_agent_start():
print("Agent started speaking")
@session.on("agent_speech_interrupted")
def on_agent_interrupted():
print("Agent was interrupted")
@session.on("agent_speech_ended")
def on_agent_end():
print("Agent finished speaking")
@session.on("turn_completed")
def on_turn_complete():
print("Turn completed")
await session.start(...)
Optimizing Turn Detection
Fast Response
await session.start(
agent=FastAgent(),
stt="deepgram/nova-3",
llm="openai/gpt-4o-mini", # Fast model
tts="cartesia/sonic",
vad=silero.VAD.load(
min_silence_duration=0.2, # Quick detection
),
turn_detection="server_vad",
min_endpointing_delay=0.3, # Short delay
)
Natural Conversation
from livekit.plugins.turn_detector import EOUModel
await session.start(
agent=ConversationalAgent(),
stt="deepgram/nova-3",
llm="openai/gpt-4o", # Better context understanding
tts="cartesia/sonic",
vad=silero.VAD.load(
min_silence_duration=0.4, # Allow thinking pauses
),
turn_detection=EOUModel.load(), # ML-based
min_endpointing_delay=0.5,
)
Telephony Optimized
await session.start(
agent=PhoneAgent(),
stt="deepgram/nova-3-phonecall",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic",
vad=silero.VAD.load(
min_silence_duration=0.5, # Account for phone delay
activation_threshold=0.6, # Less sensitive for noise
),
turn_detection="server_vad",
min_endpointing_delay=0.6,
noise_cancellation=noise_cancellation.NC(),
)
Debugging Turn Detection
import logging
logging.basicConfig(level=logging.DEBUG)
@RtcSession.factory
async def create_session(session: AgentSession):
@session.on("vad_metrics")
def on_vad_metrics(metrics):
print(f"VAD probability: {metrics.speech_probability:.2f}")
print(f"Speech duration: {metrics.speech_duration:.2f}s")
@session.on("turn_detection_metrics")
def on_turn_metrics(metrics):
print(f"Confidence: {metrics.confidence:.2f}")
print(f"Is end of turn: {metrics.is_end_of_turn}")
await session.start(
agent=MyAgent(),
...
)
Complete Example
import logging
from dotenv import load_dotenv
from livekit.agents import Agent, AgentSession, RtcSession, AgentServer
from livekit.plugins import silero, noise_cancellation
from livekit.plugins.turn_detector import EOUModel
load_dotenv()
logging.basicConfig(level=logging.INFO)
class ConversationalAgent(Agent):
def __init__(self):
super().__init__(
instructions="""You are a natural conversational assistant.
Listen carefully and respond thoughtfully.
It's okay to pause while thinking."""
)
self.interrupted_count = 0
async def on_enter(self):
await self.session.generate_reply(
"Hi! I'm ready to chat. What's on your mind?"
)
async def on_interrupted(self):
self.interrupted_count += 1
logging.info(f"Interrupted {self.interrupted_count} times")
async def on_user_turn(self, message: str):
logging.info(f"User said: {message}")
await super().on_user_turn(message)
@RtcSession.factory
async def create_session(session: AgentSession):
# Load VAD
vad = silero.VAD.load(
min_speech_duration=0.15,
min_silence_duration=0.4,
activation_threshold=0.5,
)
# Load turn detector
turn_detector = EOUModel.load()
# Log events
@session.on("user_speech_started")
def on_user_start():
logging.info("User speaking...")
@session.on("user_speech_ended")
def on_user_end(transcript: str):
logging.info(f"User: {transcript}")
@session.on("agent_speech_started")
def on_agent_start():
logging.info("Agent responding...")
await session.start(
agent=ConversationalAgent(),
stt="deepgram/nova-3",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic",
vad=vad,
turn_detection=turn_detector,
noise_cancellation=noise_cancellation.BVC(),
# Endpointing
min_endpointing_delay=0.5,
max_endpointing_delay=2.0,
# Interruptions
allow_interruptions=True,
interrupt_min_words=3,
resume_on_false_interrupt=True,
)
if __name__ == "__main__":
AgentServer(create_session).run()
Best Practices
- Use ML turn detector: More natural than VAD alone
- Keep VAD for interruptions: Always include VAD
- Tune for use case: Fast vs natural tradeoff
- Handle false interrupts: Resume speech when appropriate
- Log metrics: Debug conversation flow
Deliverables
For: $ARGUMENTS
Provide:
- Turn detection mode selection
- VAD configuration
- Endpointing settings
- Interruption handling
- Event handlers
- Optimization recommendations
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/livekit-turn-detection-mrzxupvi' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/livekit-turn-detection-mrzxupvi/download' --output '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md.part' && mv '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md.part' '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Write, Bash(pip install, npm install), Glob, Grep, WebSearch
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md' && test -s '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/livekit-turn-detection' && cp -R '.skill-downloads/livekit-turn-detection-mrzxupvi' '.claude/skills/livekit-turn-detection'Cursor
test -f '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md' && test -s '.skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/livekit-turn-detection' && cp -R '.skill-downloads/livekit-turn-detection-mrzxupvi' '.cursor/skills/livekit-turn-detection'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/livekit-turn-detection-mrzxupvi'openskills read 'livekit-turn-detection-mrzxupvi'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/livekit-turn-detection-mrzxupvi/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.