limited-pillow-7054
12/13/2025, 10:33 AM"Is ElevenLabs STT (Scribe v2) available through LiveKit Inference? The blog post only mentions AssemblyAI, Cartesia, and Deepgram for STT."2. Model Identifier Format
"What is the correct model identifier for3. Lithuanian Language Support? We triedinference.STT()but it doesn't seem to process audio (elevenlabs/scribe_v2_realtime)."stt_audio_duration=0.0
"Which STT providers in LiveKit Inference support Lithuanian (lt) language? We need real-time STT for Lithuanian."4. Debugging STT Issues
"We're seeing5. Current Working Configuration (for reference)in our logs after switching tostt_audio_duration=0.0. TTS and greeting work fine. How can we debug why STT isn't receiving audio?"inference.STT()
"Before migration, we usedwhich worked. After migrating toelevenlabs.STT(language_code='lt', use_realtime=True), audio is not being transcribed."inference.STT(model='elevenlabs/scribe_v2_realtime', language='lt')
tall-airline-16756
12/13/2025, 10:33 AMtall-airline-16756
12/13/2025, 10:34 AMstt_audio_duration=0.0 is happening after the migration.
1) ElevenLabs STT availability
• ElevenLabs Scribe V2 Realtime is available through LiveKit Inference. You don’t need a separate ElevenLabs account when using it via LiveKit Inference. (ElevenLabs STT | LiveKit docs)
2) Correct model identifier for inference.STT()
• Use: elevenlabs/scribe_v2_realtime. Your syntax inference.STT(model='elevenlabs/scribe_v2_realtime', language='lt') is correct.
3) Lithuanian support (lt)
• Lithuanian (lt) is supported by ElevenLabs Scribe V2 Realtime via LiveKit Inference.
4) Why you’re seeing stt_audio_duration=0.0 and how to debug it (step-by-step)
• Summary: stt_audio_duration=0.0 means the STT service is not receiving audio frames. This is a data-flow issue (routing/subscription/VAD/buffering), not a model identifier problem. Check the following:
1. Verify the agent is actually receiving the remote participant’s audio track
◦ Log track_subscribed events and confirm an active audio track is subscribed to the agent session. (STT models docs)
1. Confirm audio frames reach the STT pipeline
◦ Enable metrics_collected / STTMetrics logging and look for nonzero audio_duration before it reaches inference. (audio_duration=0 shows frames never got to STT`.) (Observability data hooks)
1. Compare AgentSession/STT initialization between old and new setups
◦ Ensure stt is passed into AgentSession the same way and no middleware (e.g., a StreamAdapter or VAD) is dropping frames. Look for differences in how audio is captured/forwarded.
1. Check VAD, buffering, and streaming configuration
◦ Disable or loosen strict VAD or aggressive silence thresholds temporarily to confirm audio isn’t being filtered out before streaming to STT.
1. Environment variables / plugin conflicts
◦ You previously used the ElevenLabs plugin (elevenlabs.STT(...)) which required ELEVEN_API_KEY. When switching to inference.STT(), the plugin key is not required; having plugin-related env vars or plugin initialization still present can lead to unexpected behavior. Remove or isolate any leftover plugin setup while testing.
1. Reproduce with a minimal test flow
◦ Create a minimal session that subscribes to an audio track and routes it to inference.STT(model='elevenlabs/scribe_v2_realtime', language='lt'). Confirm track_subscribed -> STTMetrics -> nonzero audio_duration.
5) Notes on your current working vs migrated config
• elevenlabs.STT(language_code='lt', use_realtime=True) worked because that plugin handled audio routing in its expected way. inference.STT(model='elevenlabs/scribe_v2_realtime', language='lt') is the correct migration target; the failure points to audio delivery/metrics or leftover plugin config rather than the model id.
If you’d like, share:
• a short snippet of your `AgentSession`/STT init code and
• the track_subscribed and STTMetrics log lines around the time you see stt_audio_duration=0.0
I’ll review and point out exactly where audio is getting dropped.
Sources: ElevenLabs STT | LiveKit docs | ElevenLabs STT plugin guide | LiveKit docs | Speech-to-text (STT) models | LiveKit Docs | Models | LiveKit Docs | Observability data hooks | LiveKit docslimited-pillow-7054
12/13/2025, 10:38 AMDoes inference.STT support ElevenLabs models? When I inspect the SDK locally:from livekit.agents.inference.stt import STTModels
print(STTModels)
• It only shows:deepgram/*
• cartesia/*
• assemblyai/*
• auto
No ElevenLabs models are listed. Is elevenlabs/scribe_v2_realtime a valid model identifier for inference.STT()? Or should we use deepgram/nova-3 instead for STT via LiveKit Inference? Our current code:from livekit.agents import inference
stt = inference.STT(
model="elevenlabs/scribe_v2_realtime",
language="en",
)
SDK version: livekit-agents (please confirm which version supports ElevenLabs STT via inference)tall-airline-16756
12/13/2025, 10:38 AMinference.STT().
Why your local STTModels enum only shows Deepgram/Cartesia/AssemblyAI
• The SDK’s local STTModels enumeration may not include every backend model string even though the inference gateway accepts additional provider model IDs at runtime. The missing ElevenLabs entry in STTModels is an SDK enumeration omission, not an indication the model is unsupported.
SDK version to use
• Use livekit-agents >= 1.2.13 (Python) to ensure compatibility with LiveKit Inference features.
What to do next (concise checklist)
1. Confirm your installed SDK: pip show livekit-agents and upgrade if older than 1.2.13.
2. Keep your code as:
from livekit.agents import inference
stt = inference.STT(
model="elevenlabs/scribe_v2_realtime",
language="en",
)
1. If STT still fails, share your pip show output and the track_subscribed / STTMetrics log lines — I’ll help pinpoint whether the issue is SDK version, audio routing, or leftover plugin config.
Would you like me to walk through upgrading the SDK and validating the runtime behavior now?
Sources: ElevenLabs STT | LiveKit docs | Models | LiveKit Docs | Speech-to-text (STT) models | LiveKit Docs | Build voice, video, and physical AI | LiveKitlimited-pillow-7054
12/13/2025, 10:41 AMmodel_name="openai/gpt-4o-mini" model_provider="livekit" ✅
2. TTS metrics working: model_name="gpt-4o-mini-tts" audio_duration=2.7 ✅
3. NO STT metrics at all - stt_audio_duration=0.0
4. No track_subscribed events logged
The issue is that audio track is not being subscribed/received by the agent. Let me share this info with the LiveKit team:Info for LiveKit Team
Here are the relevant log lines: LLM working (via inference):[INFO] LLM metrics completion_tokens=12 model_name="openai/gpt-4o-mini" model_provider="livekit"
TTS working (via openai.TTS plugin):[INFO] TTS metrics audio_duration=2.7 model_name="gpt-4o-mini-tts" model_provider="api.openai.com"
STT NOT working:stt_audio_duration=0.0
• No track_subscribed events logged at all - this confirms the audio routing issue. *Session setup:*Agent connects to room ✅
• Agent greets with TTS ✅
• Session waits ~30 seconds
• Participant disconnects
• Session ends with stt_audio_duration=0.0
Question for LiveKit: Why isn't the audio track being subscribed? Is there a special configuration needed for inference.STT to receive SIP participant audio?tall-airline-16756
12/13/2025, 10:41 AMtrack_subscribed events and stt_audio_duration=0.0. Root cause: the agent is not subscribing to the SIP participant’s audio track, so STT never receives audio.
What to check and fix (short checklist)
• Ensure auto-subscribe is enabled when connecting:
await ctx.connect(auto_subscribe=True)
• Add defensive manual subscription on track publication:
@ctx.room.on("track_published")
def on_track_published(publication, participant):
if publication.kind == rtc.TrackKind.KIND_AUDIO:
publication.set_subscribed(True)
• Add logging for these events to confirm flow:
◦ participant_joined
◦ track_published
◦ track_subscribed
If you see `participant_joined`/`track_published` but no track_subscribed, subscription logic is failing.
SIP-specific checks
• Confirm the SIP call is in active state and actually publishing audio (not ringing or hangup).
• SIP participants are regular room participants; no special STT config is required — STT gets audio from subscribed tracks.
Other common causes to validate
• You have no code/path that turns off autoSubscribe or prevents calling set_subscribed(True).
• No middleware (VAD/StreamAdapter) is dropping frames before subscription.
• STT model config is correct (e.g., inference.STT(model="elevenlabs/scribe_v2_realtime", language="lt")) — model id isn’t the issue.
If you want, share these two small items and I’ll review:
1. The connect call and any custom room connection logic (where auto_subscribe is set).
2. Your track_published / subscription handlers and current event logs for participant_joined, track_published, and track_subscribed.
I’ll point to exactly where the subscription is being missed.
Sources: Speech-to-text (STT) models | LiveKit Docs | ElevenLabs STT | LiveKit docs | SIP participant | LiveKit docs | Rooms, participants, and tracks | LiveKit docs | Subscribing to tracks | LiveKit docslimited-pillow-7054
12/13/2025, 12:02 PMtrack_subscribed event firing when the web participant publishes their audio track? We have auto_subscribe=True in ctx.connect(), but want to confirm the agent is actually subscribing to the participant's audio track.
• Are audio frames being received by the agent? The agent joins, speaks the greeting (TTS works), but doesn't respond to user speech. Is there a way to verify audio frames are flowing from participant → agent?
• Could there be a track kind mismatch? We're using @rtc.ai_functions decorators. Is there something special needed to receive audio from web participants vs SIP participants?
2. STT Pipeline Specifics
• What should the stt_audio_duration metric show? In our logs we saw stt_audio_duration=0.0 before. After adding auto_subscribe=True, what value indicates STT is receiving audio?
• Is elevenlabs/scribe_v2_realtime the correct model identifier for LiveKit Inference Add-On? We're using:
• stt = inference.STT(
• model="elevenlabs/scribe_v2_realtime",
• language="en",
• )
• Does inference.STT require any additional configuration to start processing audio (e.g., explicit start call, VAD settings)?
3. Web Client vs SIP Participant
• Are there differences in how web participants' audio is handled compared to SIP participants? The agent was originally built for telephony - could there be codec or format mismatches with browser audio?
• Does the browser audio track need specific encoding settings (sample rate, channels, codec) to be compatible with ElevenLabs STT via inference?
4. Agent Session Configuration
• In MultimodalAgent / VoicePipelineAgent, is there a setting to explicitly enable STT? Our setup:
• agent = MultimodalAgent(
• model=model,
• fnc_ctx=fnc_ctx,
• )
• agent.start(ctx.room, participant)
• Should we be using VoicePipelineAgent instead of MultimodalAgent for STT → LLM → TTS flow with inference models?
5. Debugging Steps
• What logs should we look for to confirm:
a. Audio track published by participant
b. Audio track subscribed by agent
c. Audio frames received by STT
d. Transcription generated
• Is there a LiveKit dashboard or CLI command to verify real-time audio flow in a room?
6. Known Issues
• Are there any known issues with ElevenLabs Scribe V2 via LiveKit Inference for web-originated audio?
• Is there a minimum audio duration before STT starts processing (e.g., VAD threshold)?tall-airline-16756
12/13/2025, 12:03 PMtrack_subscribed fire? Add these listeners and check logs:
@ctx.room.on("participant_joined")
def on_participant_joined(p):
print("joined", p.identity, p.kind)
@ctx.room.on("track_published")
def on_track_published(pub, p):
print("track_published", pub.kind, pub.source, p.identity)
if pub.kind == rtc.TrackKind.KIND_AUDIO:
pub.set_subscribed(True) # defensive subscribe
@ctx.room.on("track_subscribed")
def on_track_subscribed(track, pub, p):
print("track_subscribed", track.kind, p.identity, "sid=", pub.sid)
• To confirm audio frames arrive, attach an audio reader inside `track_subscribed`:
async def handle_audio(track):
async for frame in rtc.AudioStream(track):
print("audio frame:", len(frame.samples), frame.timestamp)
If you see frames, the agent is receiving audio; if not, subscription or publisher state is wrong.
• @rtc.ai_functions does not change track subscription behavior. Web and SIP participants publish standard audio tracks; no special decorator handling is required.
2) STT pipeline specifics
• What stt_audio_duration should show:
◦ >0.0 when STT received and processed speech (e.g., 2.7 means 2.7s processed). 0.0 means STT saw no frames or VAD suppressed them.
• Model identifier:
◦ elevenlabs/scribe_v2_realtime is the correct model id for inference.STT.
• Additional config required:
◦ No explicit “start” call for inference.STT when used via AgentSession — audio routing + VAD trigger the STT. Ensure you pass STT to `AgentSession`:
session = AgentSession(
stt=inference.STT(model="elevenlabs/scribe_v2_realtime", language="en"),
...
)
await session.start(ctx.room)
• VAD sensitivity can prevent STT from starting; lower thresholds if needed (see debugging steps).
3) Web client vs SIP participant differences
• Handling: functionally identical — both publish Microphone audio tracks the agent can subscribe to.
• Potential pitfalls:
◦ Browser preprocessing (AEC/noise suppression) can reduce signal so VAD never triggers.
◦ WebRTC codec negotiation (Opus) and sample rate are standard; STT expects mono 16k/24k style audio. No special encoding is normally required.
• Recommendation: test with a loud, continuous speech sample from the browser and temporarily disable browser noise suppression if possible.
4) Agent session configuration: MultimodalAgent vs VoicePipeline/AgentSession
• Use AgentSession (or VoicePipelineAgent patterns) for STT→LLM→TTS flows. MultimodalAgent is not the recommended path for inference STT.
• Example:
session = AgentSession(
stt=inference.STT(model="elevenlabs/scribe_v2_realtime", language="en"),
llm=openai.LLM(...),
tts=openai.TTS(...),
vad=silero.VAD.load() # recommended
)
await session.start(room=ctx.room, agent=my_agent, room_input_options=RoomInputOptions(auto_subscribe=True))
5) Debugging steps — logs and tools (exact things to check)
• Logs to capture (in order):
a. participant_joined — confirms participant presence
b. track_published — confirms the participant published an audio track
c. track_subscribed — confirms agent subscribed to that track
d. audio frame logs in AudioStream — confirms frames flowing to agent
e. VAD events — confirms voice segments detected
f. STT metrics (stt_audio_duration) and transcription events
• Where to look:
◦ Agent runtime logs (enable DEBUG around track events and VAD)
◦ LiveKit Cloud Console shows participants/tracks
◦ CLI: lk room list --room-id <id> and lk agent logs --id <agent-id> can help
• If you see track_published but no track_subscribed, subscription logic is missing or auto_subscribe was disabled.
6) Known issues and thresholds
• Known pitfalls:
◦ Aggressive browser noise suppression or very low microphone volume can cause VAD to miss speech.
◦ SDK enums (like local STTModels) might not enumerate every backend model, but runtime accepts elevenlabs/scribe_v2_realtime.
• VAD thresholds:
◦ Default VAD has min_speech_duration and min_silence_duration (e.g., 0.05s / 0.55s). If speech is too short or quiet, STT may not trigger. Lower min_speech_duration or activation threshold to make it more sensitive.
Quick checklist to get STT working now
• Confirm auto_subscribe=True in ctx.connect() or manually call set_subscribed(True) on track_published.
• Add track_subscribed and audio-frame logs to confirm frames flow.
• Use AgentSession with inference.STT(model="elevenlabs/scribe_v2_realtime", language="en").
• If stt_audio_duration remains 0.0, lower VAD thresholds and test with louder/continuous speech.
If you want, paste:
• your connect call and subscription handlers, and
• the exact short log excerpt for participant_joined, track_published, track_subscribed (if any), and stt_audio_duration
I’ll point to the precise line where subscription or audio routing is failing.
Sources: Silero VAD plugin | LiveKit docs | ElevenLabs STT | LiveKit docs | Models | LiveKit Docs | Understanding "silence detected on local audio track" warning | Agents v0.x migration guide - Python | LiveKit docslimited-pillow-7054
12/13/2025, 12:33 PMlivekit-agents)STTElevenLabs Scribe V2 via `inference.STT`LLMOpenAI GPT-4o-mini via `inference.LLM`TTSOpenAI TTS via openai.TTS pluginVADSilero VADBackendFastAPI on RailwayFrontendNext.js on VercelVoice InfrastructureLiveKit Cloud
What Works
• ✅ Agent joins the room
• ✅ Agent greets in English ("Hello! How can I help you today?")
• ✅ TTS works (greeting is spoken)
• ✅ LLM works (greeting generated)
• ✅ Participant connects
• ✅ Audio track published by browser
• ✅ Audio track subscribed by agent
• ✅ ctx.wait_for_participant() works - agent waits for user
What's BROKEN
• ❌ session.start() returns immediately - doesn't stay running
• ❌ VAD never triggers (user_started_speaking never fires)
• ❌ STT never receives audio (stt_audio_duration=0.0)
• ❌ Agent doesn't respond to user speech
The Core Problem (from logs)
12:31:08,194 - Participant joined! identity=web-tester-01629fbb
12:31:08,194 - Starting agent session...
12:31:08,201 - Agent said: Greeting customer
12:31:08,209 - Agent session completed ← SESSION ENDS IMMEDIATELY (11ms!)
12:31:08,846 - track_published ← Audio track comes AFTER session ended
12:31:08,875 - SUCCESS - Subscribed to AUDIO track ← Too late, session is done
The session.start() call is not blocking - it returns immediately after the greeting, before the audio track is even published. The session "completes" in 11 milliseconds.What We Tried
1. ✅ Added auto_subscribe=True to ctx.connect()
2. ✅ Added debug handlers for track subscription
3. ✅ Added debug handlers for VAD/STT pipeline events
4. ✅ Added ctx.wait_for_participant() - official API
5. ✅ Used room_io.RoomOptions instead of deprecated RoomInputOptions
6. ❌ Session still exits immediately after greeting
Next Step Needed
1. The session.start() should block and keep running while the participant is connected. It's exiting immediately. We need to either:Find why session.start() isn't blocking/looping
2. Or add explicit code to keep the session alive
This is likely a fundamental misunderstanding of how AgentSession.start() is supposed to work - we may need to check LiveKit examples more carefully.tall-airline-16756
12/13/2025, 12:34 PMAgentSession.start() is non-blocking by design. Your entrypoint function finishes right after the greeting, which ends the process/session before the participant publishes audio. That’s why track_published and track_subscribed happen “too late” and stt_audio_duration stays 0.0.
What to do (exact, minimal changes)
1) Keep the entrypoint alive until the participant leaves
• Use a wait that blocks the function (example with asyncio.Event):
disconnect_event = asyncio.Event()
@ctx.room.on("disconnected")
def on_disconnect():
disconnect_event.set()
await disconnect_event.wait() # blocks until participant disconnects
await session.aclose()
• Or wait for the participant to join and then wait for their disconnect:
participant = await ctx.wait_for_participant()
# start session/greet...
await participant.wait_for("disconnected") # or the room disconnected handler
2) Start session correctly and ensure audio input is enabled
• Start session and pass room options so audio flows into STT:
session = AgentSession(
stt=inference.STT(model="elevenlabs/scribe_v2_realtime", language="en"),
llm=inference.LLM(model="openai/gpt-4o-mini"),
tts=openai.TTS(...),
vad=silero.VAD.load()
)
await session.start(room=ctx.room, agent=my_agent, room_options=RoomOptions(audio_input=True))
await session.generate_reply(instructions="Greet the user")
# then block (disconnect_event.wait())
3) Defensive subscription & logging (confirm audio flow)
• Ensure subscription happens before blocking returns:
await ctx.connect(auto_subscribe=True)
@ctx.room.on("track_published")
def on_track_published(pub, p):
if pub.kind == rtc.TrackKind.KIND_AUDIO:
pub.set_subscribed(True)
@ctx.room.on("track_subscribed")
def on_track_subscribed(track, pub, p):
print("Subscribed to audio from", p.identity)
# attach frame reader to confirm frames seen
4) Verify VAD/STT behavior
• VAD controls when STT runs. If VAD never triggers, STT never receives audio.
◦ Temporarily lower VAD thresholds (min_speech_duration, activation threshold) to be more sensitive.
◦ Log VAD events and audio frames inside the subscribed audio handler to confirm frames are arriving.
5) Summary of what to expect after fixes
• The entrypoint blocks while user is connected.
• track_published → track_subscribed will occur while the session is active.
• VAD should detect speech and produce stt_audio_duration > 0.0.
• STT (ElevenLabs Scribe V2 realtime) will transcribe; LLM responds; TTS speaks.
If you want, paste:
• your current entrypoint function (connect, session.start(), and what you do after), and
• a short log snippet showing the greeting + session completed + later track_published lines
I’ll mark exactly where to insert the blocking wait so the session stays alive.
Sources: Agent session | LiveKit docs | Text and transcriptions | LiveKit docs | Job lifecycle | LiveKit docs | Agents (Node.js) | livekit/livekit_composite | DeepWiki | Company directory phone assistant | LiveKit docslimited-pillow-7054
12/13/2025, 12:36 PM@server.rtc_session(agent_name="poskai-test-agent")
async def entrypoint(ctx: JobContext) -> None:
# ... setup code ...
# Connect to room
await ctx.connect(auto_subscribe=True)
# Create session with STT/LLM/TTS/VAD
session = AgentSession(
vad=vad,
stt=inference.STT(model="elevenlabs/scribe_v2_realtime", language="en"),
llm=inference.LLM(model="openai/gpt-4o-mini"),
tts=openai.TTS(model="gpt-4o-mini-tts", voice="echo"),
allow_interruptions=True,
# ... other config ...
)
# Wait for participant
participant = await ctx.wait_for_participant()
# Start session
await session.start(
room=ctx.room,
agent=agent,
room_options=room_io.RoomOptions(
audio_input=room_io.AudioInputOptions(),
audio_output=room_io.AudioOutputOptions(),
),
)
# ← FUNCTION ENDS HERE - nothing after session.start()
Log Snippet (showing the problem)
12:31:07,876 - Waiting for participant to join room: voice-test-01629fbb
12:31:07,876 - DEBUG: Current participants: []
12:31:08,194 - DEBUG: Participant joined! identity=web-tester-01629fbb, kind=0
12:31:08,194 - Starting agent session for room: voice-test-01629fbb with participant: web-tester-01629fbb
12:31:08,201 - Agent said: Greeting customer
12:31:08,209 - Agent session completed for room: voice-test-01629fbb ← SESSION ENDS (11ms after start!)
12:31:08,846 - DEBUG track_flow: track_published - participant=web-tester-01629fbb, kind=1 (AUDIO) ← TOO LATE
12:31:08,875 - DEBUG track_flow: SUCCESS - Subscribed to AUDIO track from web-tester-01629fbb ← TOO LATE
Where exactly should I insert the blocking wait so the session stays alive after session.start() returns?tall-airline-16756
12/13/2025, 12:36 PMsession.start() so your entrypoint doesn't return. Right now the function ends and the session/background tasks are torn down before the participant’s audio arrives.
Minimal change — keep session alive until participant disconnects:
# after await session.start(...)
# keep the agent alive while participant is connected
disconnect_event = asyncio.Event()
@ctx.room.on("disconnected")
def _on_disconnect():
disconnect_event.set()
try:
await disconnect_event.wait() # BLOCK here until room disconnect
finally:
await session.aclose()
Alternative: wait on the specific participant object you already have:
# participant = await ctx.wait_for_participant()
await participant.wait_for("disconnected") # blocks until that participant leaves
await session.aclose()
Where to put it: immediately after your existing session.start() call (replace the comment where the function currently ends). This ensures:
• track_published / track_subscribed happen while the session is active
• VAD can detect speech and STT receives audio (nonzero stt_audio_duration)
• Proper cleanup via await session.aclose() when done
If you want, paste that small appended block into your function and I’ll review to confirm placement.limited-pillow-7054
12/13/2025, 12:39 PM# After session.start()
await session.start(
room=ctx.room,
agent=agent,
room_options=room_io.RoomOptions(
audio_input=room_io.AudioInputOptions(),
audio_output=room_io.AudioOutputOptions(),
),
)
logger.info(f"Session started, now waiting for participant disconnect...")
# CRITICAL FIX per LiveKit developer:
# session.start() is non-blocking - we must keep the entrypoint alive
# otherwise the session/background tasks are torn down before audio arrives
disconnect_event = asyncio.Event()
@ctx.room.on("disconnected")
def _on_room_disconnect():
logger.info("Room disconnected event received")
disconnect_event.set()
@ctx.room.on("participant_disconnected")
def _on_participant_disconnect(participant):
logger.info(f"Participant disconnected: {participant.identity}")
disconnect_event.set()
try:
logger.info(f"Blocking until room disconnect for: {ctx.room.name}")
await disconnect_event.wait() # BLOCK here until room/participant disconnects
finally:
logger.info(f"Disconnect detected, closing session for: {ctx.room.name}")
await session.aclose()
logger.info(f"Agent session completed for room: {ctx.room.name}")tall-airline-16756
12/13/2025, 12:39 PMsession.start() runs the session asynchronously; if your entrypoint returns, the process ends and background tasks are torn down. Blocking on a room/participant disconnect keeps the entrypoint alive so `track_published`/`track_subscribed`, VAD, and STT run while participants speak.
Small improvements to consider
• Ensure auto-subscribe is enabled (you already have auto_subscribe=True on connect).
• Add a short timeout fallback in case disconnect never fires:
try:
await asyncio.wait_for(disconnect_event.wait(), timeout=60*30) # 30 min
except asyncio.TimeoutError:
logger.info("Timeout waiting for disconnect, closing session")
• Add debug logs for track_published / track_subscribed / VAD events so you can confirm audio frames and stt_audio_duration increase while session is running.
Validation checklist after deploy
• track_published appears while session is active
• track_subscribed fires soon after
• Audio-frame logs appear from the subscribed track
• VAD events trigger and stt_audio_duration > 0.0
• Agent responds (LLM → TTS) to transcribed speech
If you want, paste your track_published / track_subscribed logs after this change and I’ll verify the audio flow and next VAD/STT tuning.limited-pillow-7054
12/13/2025, 12:49 PMtrack_published - Audio track published
2. ✅ track_subscribed - Audio track subscribed successfully
3. ✅ Session is now blocking properly (didn't end immediately)
4. ❌ stt_audio_duration=0.0 - STT still not receiving audio
5. ❌ No VAD events - user_started_speaking never fired
6. ❌ No STT events - user_input_transcribed never fired
The blocking fix worked! The session stayed alive until you disconnected (). But VAD is not detecting your speech. Key observation: Track is subscribed but VAD isn't processing frames. This is the exact scenario to ask the LiveKit developer about. *Question for LiveKit developer:*After the blocking fix, the session now stays alive correctly:Participant disconnected: web-tester-536c99d9
fires ✅track_published
fires ✅track_subscribed
Session blocks on disconnect_event.wait() ✅
Session ends only when participant disconnects ✅
But VAD/STT still not working:
never firesuser_started_speaking
never firesuser_input_transcribed
in UsageSummarystt_audio_duration=0.0
We use:
stt = inference.STT(model="elevenlabs/scribe_v2_realtime", language="en")
llm = inference.LLM(model="openai/gpt-4o-mini")
vad = silero.VAD.load()
session = AgentSession(vad=vad, stt=stt, llm=llm, tts=tts, ...)
await session.start(room=ctx.room, agent=agent, room_options=room_io.RoomOptions(...))
Audio track is subscribed but VAD never detects speech. What could cause VAD to not process the subscribed audio frames?
tall-airline-16756
12/13/2025, 12:50 PMtrack_subscribed handler, attach an AudioStream and log sample stats:
@ctx.room.on("track_subscribed")
def on_track_subscribed(track, pub, participant):
if track.kind == rtc.TrackKind.KIND_AUDIO:
async def read():
async for frame in rtc.AudioStream(track):
print("frame samples:", len(frame.samples), "min/max:", frame.samples.min(), frame.samples.max())
break
asyncio.create_task(read())
• If samples are all zeros or near-zero, the microphone/peer is silent or suppressed.
1. Verify sample rate and channels
◦ WebRTC often uses 48kHz stereo. Silero VAD expects 8/16k mono. If frames show 48000Hz, resample to 16k mono before VAD or confirm AgentSession does so.
1. Check browser preprocessing and mic volume
◦ Disable echo cancellation/noise suppression in createLocalAudioTrack, or test with a different browser/device and a loud continuous voice to rule out suppression.
1. Confirm VAD is actually wired to the subscribed track
◦ You passed vad into AgentSession, but verify the framework connected it by:
▪︎ Logging VAD internal events (enable debug) or
▪︎ Manually running VAD on frames read from AudioStream to see if it detects speech.
1. Lower VAD sensitivity for testing
vad = silero.VAD.load(activation_threshold=0.3, min_speech_duration=0.05, min_silence_duration=0.3)
1. Test with injected audio (control test)
◦ Play a known audio file as the participant’s mic (loopback) or use an audio file source to ensure content is non-silent and in correct sample rate.
1. If frames reach VAD but no events fire
◦ Log VAD calls and examine whether frames are being discarded due to unexpected format, shape, or dtype. If so, convert to int16 PCM, mono, 16k before VAD.
What to share if you want me to inspect further
• One short raw audio frame log showing min/max sample values and sample rate.
• track_subscribed handler code and any custom RoomIO or stream adapters.
• VAD instantiation parameters.
Expected results after fixes
• You’ll see non-zero frame samples in logs.
• VAD will emit user_started_speaking and user_stopped_speaking.
• stt_audio_duration increases (>0), STT transcribes, and agent replies.
If you paste the small logs/code I requested, I’ll highlight exactly which conversion or wiring step is missing.
Sources: Understanding "silence detected on local audio track" warning | Silero VAD plugin | LiveKit docs | Agent session | LiveKit docs | Processing raw media tracks | LiveKit docslimited-pillow-7054
12/13/2025, 1:11 PMAudio frames are arriving but are completely silent:frame 0: min=0, max=0, non_zero=0
frame 7: min=-2, max=2, non_zero=175 (noise floor only)
Rate is 48000Hz, 1 channel, 480 samples per frame. Browser shows mic permission granted and mic indicator active. Is this a browser-side audio processing issue (noise suppression, echo cancellation)? Should we disable audio processing on the client side when creating the audio track?tall-airline-16756
12/13/2025, 1:12 PMconst audioTrack = await createLocalAudioTrack({
noiseSuppression: false,
echoCancellation: false,
channelCount: 1,
});
• Or use rtcConstraints:
const audioTrack = await createLocalAudioTrack({
rtcConstraints: {
noiseSuppression: false,
echoCancellation: false,
autoGainControl: false,
},
});
Why this fixes it
• Browser noise suppression/echo cancellation can zero-out or heavily attenuate speech, producing frames with min/max near 0 so VAD never triggers. Disabling these returns raw audio amplitudes so Silero VAD can detect voice and STT receives meaningful frames.
Optional production recommendations
• After disabling client-side processing, you can enable agent-side inbound noise cancellation (BVC) to clean audio server-side:
room_options = RoomOptions(
audio_input=AudioInputOptions(noise_cancellation=noise_cancellation.BVC())
)
• Do not enable both strong client-side and agent-side processing simultaneously (double filtering can hurt detection).
Quick debug steps after changing the client
1. Reproduce and log a few frames from `track_subscribed`:
◦ Expect non-zero min/max and significantly more non_zero samples during speech.
1. Observe VAD events (user_started_speaking) and stt_audio_duration > 0.
2. If still low amplitude, lower VAD activation threshold or resample to 16k mono before VAD.
If you want, paste a short post-change frame log (min/max/non_zero and sample rate) and I’ll confirm the next tuning step.
Sources: Understanding "silence detected on local audio track" warning | Codecs and more | LiveKit docs | Enhanced noise cancellation | LiveKit docslimited-pillow-7054
12/13/2025, 2:22 PMLooking at the logs: Audio frames ARE arriving with real signal now:frame 4 - min=-45, max=40, non_zero=433 ← ACTUAL AUDIO!
frame 5 - min=-57, max=54, non_zero=470 ← ACTUAL AUDIO!
frame 6 - min=-53, max=52, non_zero=469 ← ACTUAL AUDIO!
• This is much better than before (min=-19, max=24). Values of -57 to +54 show real audio is reaching the server. BUT the critical issue: The audio amplitude is still extremely low for speech:16-bit audio range: -32768 to +32767
• Your max values: 57 (that's 0.17% of full scale)
• Normal speech should be: min=-5000 to -15000, max=+5000 to +15000
• Why VAD doesn't trigger: Silero VAD expects speech-level amplitudes. Values of ±57 are still just ambient noise/mic hiss level, not speech. *Key observation from your test:*Your local meter shows 80% green (loud in browser)
• But server receives tiny values (±57)
1. *This suggests audio GAIN is being lost somewhere in the WebRTC pipeline:*Browser captures at 80% level ✓
2. WebRTC encodes it
3. LiveKit server receives it
4. Server decodes it → but values are tiny
*Question for LiveKit developer:*"Audio frames arrive at the agent with min=-57, max=54 on a 16-bit scale (-32768 to +32767). That's 0.17% amplitude. Local browser meter shows 80% level when speaking. The gain is being lost somewhere in WebRTC encoding/decoding. VAD never triggers because amplitude is too low. Is there an audio gain setting we need on the client or server side?"
tall-airline-16756
12/13/2025, 2:23 PMconst audioTrack = await createLocalAudioTrack({
autoGainControl: false,
noiseSuppression: false,
echoCancellation: false,
});
console.log(audioTrack.getSettings());
• Confirm getSettings() shows these as false. If any are still true, the browser is overriding them.
2) Amplify pre-encode using Web Audio (recommended quick fix)
• Boost gain before publishing so the encoder carries a strong signal:
const ctx = new AudioContext();
const src = ctx.createMediaStreamSource(localStream);
const gain = ctx.createGain();
gain.gain.value = 10; // try 5-30x, tune as needed
const dest = ctx.createMediaStreamDestination();
src.connect(gain);
gain.connect(dest);
const amplifiedTrack = dest.stream.getAudioTracks()[0];
await localParticipant.publishTrack(amplifiedTrack, { source: Track.Source.Microphone });
• This ensures the encoded Opus stream contains proper amplitude that survives SFU decoding.
3) Verify server-side received amplitude immediately after fix
• In your track_subscribed handler, read one frame and log min/max/non_zero and RMS/dBFS. Expect values in thousands and RMS around -20 to -6 dBFS for normal speech.
4) If client amplification is not possible, test alternate browsers/devices
• Firefox tends to be less aggressive about AGC; compare Chrome vs Firefox vs mobile to isolate browser behavior.
5) Tune VAD sensitivity for testing (but don't rely on this as the primary fix)
vad = silero.VAD.load(activation_threshold=0.3, min_speech_duration=0.05, min_silence_duration=0.3)
• Lower thresholds help detect softer speech while you validate amplitude fixes.
6) Avoid double-processing
• If you enable agent-side noise cancellation/BVC later, do not keep aggressive client-side processing enabled. Double filtering can reduce signal quality.
Longer-term / platform notes
• The desirable long-term fix is to avoid client-side automatic AGC or to provide an explicit per-track gain control in the agent/SFU. For now, client-side pre-encode gain is the reliable workaround.
• If you confirm amplification fixes VAD, share post-fix frame logs and we’ll recommend optimal gain value and any necessary resampling.
What to share next (one small paste)
• One post-change frame log line (min/max/non_zero and RMS or dBFS) from track_subscribed. I’ll confirm if levels are in the expected range and advise final VAD/STT tuning. Sources: Stream music over WebRTC using React and WebAudiolimited-pillow-7054
12/13/2025, 2:42 PMinference.STT(model="elevenlabs/scribe_v2_realtime", language="en")
• LLM: inference.LLM(model="openai/gpt-4o-mini")
• TTS: openai.TTS() (direct plugin, not inference)
• VAD: silero.VAD.load()
• Client: Browser via livekit-client JS SDK
• *What works:*Agent joins room ✅
• Participant joins ✅
• Audio track published and subscribed ✅
• Agent greeting plays (TTS works) ✅
• session.start() with blocking wait ✅
• *What doesn't work:*VAD never fires user_started_speaking
• STT never transcribes
• Agent never responds to user speech
Debug logs show:DEBUG audio_frames: frame 0 - min=0, max=0, mean=0
DEBUG audio_frames: frame 6 - min=-92, max=118, mean=1
DEBUG audio_frames: frame 7 - min=-136, max=133, mean=-1
• Audio amplitude is ~0.4% of 16-bit full scale. VAD expects thousands. *We tried:*`auto_subscribe=True` ✅
• Blocking wait after session.start() ✅
• Disabled browser audio processing (echoCancellation, noiseSuppression, autoGainControl = false) ✅
• Web Audio gain boost (10x-30x) before publishing - didn't help
1. *Questions:*Is there a minimal working example using LiveKit Inference (not direct API keys) that we can test against?
2. Is the low audio amplitude a known issue with browser → LiveKit → Agent pipeline?
3. Should we be using a different approach to publish audio from browser with sufficient amplitude for VAD?
Our entrypoint code (simplified):@server.rtc_session(agent_name="poskai-test-agent")
async def entrypoint(ctx: JobContext):
await ctx.connect(auto_subscribe=True)
stt = inference.STT(model="elevenlabs/scribe_v2_realtime", language="en")
llm = inference.LLM(model="openai/gpt-4o-mini")
tts = openai.TTS(model="gpt-4o-mini-tts", voice="echo")
vad = silero.VAD.load()
session = AgentSession(vad=vad, stt=stt, llm=llm, tts=tts)
agent = MyAgent(instructions="...")
participant = await ctx.wait_for_participant()
await session.start(room=ctx.room, agent=agent)
# Block until disconnect
disconnect_event = asyncio.Event()
ctx.room.on("disconnected", lambda: disconnect_event.set())
await disconnect_event.wait()tall-airline-16756
12/13/2025, 2:42 PMtrack.getSettings() and log autoGainControl, noiseSuppression, echoCancellation. Each must be false.
1. Publish a pre-encoded boosted track (Web Audio) — do this exactly:
◦ Create AudioContext, connect MediaStreamSource -> GainNode -> MediaStreamDestination, then publish the destination track.
const stream = await navigator.mediaDevices.getUserMedia({
audio: { echoCancellation: false, noiseSuppression: false, autoGainControl: false }
});
const ctx = new AudioContext();
const src = ctx.createMediaStreamSource(stream);
const gain = ctx.createGain();
gain.gain.value = 10; // start 10x, tune 5-30x
src.connect(gain);
const dest = ctx.createMediaStreamDestination();
gain.connect(dest);
const amplifiedTrack = dest.stream.getAudioTracks()[0];
await room.localParticipant.publishTrack(amplifiedTrack, { source: Track.Source.Microphone });
1. Verify post-publish samples on the agent immediately
◦ In track_subscribed, read one frame and log min/max/non_zero and RMS/dBFS. Expect peaks in thousands (e.g., min≈-5k, max≈+5k) and RMS around -20 to -6 dBFS for normal speech.
1. If amplitude is still tiny after step 2:
◦ Try different browsers (Firefox often applies less hidden processing than Chrome). If Firefox shows correct amplitude, the browser is the source.
◦ Ensure you’re not publishing the original raw track in parallel (only publish the amplified track).
◦ Confirm your frontend doesn’t call setSinkId()/mute/volume APIs that clip volume.
1. Temporary VAD tuning (only for testing)
vad = silero.VAD.load(activation_threshold=0.3, min_speech_duration=0.05, min_silence_duration=0.3)
• Lower thresholds for tests, but do not rely on this as the final solution.
1. Optional production path
• After you deliver raw, well-leveled audio into LiveKit, enable agent-side inbound noise cancellation (BVC) if you want cleaned audio server-side:
room_options = RoomOptions(audio_input=AudioInputOptions(noise_cancellation=noise_cancellation.BVC()))
• Don’t keep aggressive client-side processing + BVC simultaneously.
What I’ll need to help further (only one small paste)
• One post-amplification frame log line from track_subscribed showing min/max/non_zero and RMS or dBFS. Example:
frame 4 - min=-5200, max=5100, non_zero=480, rms_db=-18
• If that looks good, I’ll recommend final VAD thresholds and confirm STT will start receiving audio.
If you want, I can also paste a minimal frontend code snippet that implements the exact Web Audio amplification + publish flow tuned for LiveKit. Would you like that?
Sources: Voice AI quickstart | LiveKit docs | Agent session | LiveKit docs | Silero VAD plugin | LiveKit docs | Models | LiveKit Docs | Turn detection and interruptions | LiveKit Docslimited-pillow-7054
12/13/2025, 2:44 PMtall-airline-16756
12/13/2025, 2:44 PM// Minimal Amplified Microphone -> LiveKit publish example
import { connect, Track } from "livekit-client";
async function publishAmplifiedMic(livekitUrl, token, roomName) {
// 1) Connect to LiveKit
const room = await connect(livekitUrl, token, { room: roomName });
// 2) Get mic with client-side processing disabled
const rawStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: false,
noiseSuppression: false,
autoGainControl: false,
channelCount: 1,
},
});
// Confirm settings (optional)
const origTrack = rawStream.getAudioTracks()[0];
console.log("orig settings:", origTrack.getSettings());
// 3) Create Web Audio graph: source -> gain -> destination
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
const source = audioCtx.createMediaStreamSource(new MediaStream([origTrack]));
const gainNode = audioCtx.createGain();
// TUNE THIS: start around 5-20 (5x to 20x). Too high -> clipping/distortion.
gainNode.gain.value = 10;
// Optional: add a limiter/clipper or analyser for monitoring
const analyser = audioCtx.createAnalyser();
analyser.fftSize = 2048;
source.connect(gainNode);
gainNode.connect(analyser);
// 4) Destination that produces a new MediaStreamTrack to publish
const dest = audioCtx.createMediaStreamDestination();
gainNode.connect(dest);
const amplifiedTrack = dest.stream.getAudioTracks()[0];
// 5) Publish the amplified track (replace existing mic publish if needed)
await room.localParticipant.publishTrack(amplifiedTrack, { source: Track.Source.Microphone });
// Optional: monitor level (RMS) to tune gain dynamically
const data = new Uint8Array(analyser.fftSize);
function logLevel() {
analyser.getByteTimeDomainData(data);
// compute simple RMS
let sum = 0;
for (let i = 0; i < data.length; i++) {
const v = (data[i] - 128) / 128; // -1..1
sum += v * v;
}
const rms = Math.sqrt(sum / data.length);
const db = 20 * Math.log10(rms || 1e-8);
console.log("mic rms dB:", db.toFixed(1));
requestAnimationFrame(logLevel);
}
requestAnimationFrame(logLevel);
// 6) Clean up helper
return {
room,
stop: async () => {
amplifiedTrack.stop();
origTrack.stop();
await room.disconnect();
audioCtx.close();
},
};
}
// Usage example:
// const { room, stop } = await publishAmplifiedMic("wss://livekit.example.com", "<TOKEN>", "room-name");
Notes and tips
• Verify origTrack.getSettings() shows autoGainControl/noiseSuppression/echoCancellation all false. If the browser overrides them, try another browser (Firefox often respects these more).
• Start with moderate gain (5–10) to avoid clipping; inspect the analyser RMS dB to tune.
• Ensure you publish only the amplified track (avoid publishing the original raw track too).
• After publishing, confirm on the agent side that frame min/max are now in the thousands (e.g., ±5k) so Silero VAD can detect speech.
Paste your post‑change agent frame log (min/max/RMS) and I’ll confirm final VAD parameters.limited-pillow-7054
12/13/2025, 5:18 PMLivekit Cloud, Livekit Self hosted and LiveKit Inference whats the diffrence
tall-airline-16756
12/13/2025, 5:19 PMlimited-pillow-7054
12/13/2025, 5:19 PMtall-airline-16756
12/13/2025, 5:20 PMtrack_subscribed handler, log the first few frames (you already do). If PSTN→LiveKit already has low amplitude, fixing Telnyx is required. If PSTN→LiveKit looks good but your agent sees low amplitude, the SFU/agent decode path may be attenuating.
1. RoomOptions: audio_input and resampling
◦ Ensure you start session with audio input enabled:
await session.start(room=ctx.room, agent=agent,
room_options=room_io.RoomOptions(audio_input=room_io.AudioInputOptions()))
• If the incoming sample rate differs (e.g., 8k vs 48k), ensure the agent-side pipeline resamples to VAD-expected rates (16k mono). Confirm resampling is happening.
1. Prevent automatic agent-side normalization
◦ Ensure no code is normalizing/scaling frames after decode. Agent should receive raw PCM.
If PSTN amplitude is low but browser audio was normal earlier
• That suggests Telnyx or the SIP transport is the main culprit (microphone/browser paths were already fixed). Focus on Telnyx trunk settings and codec negotiation.
Actionable next steps (ordered)
1. Record RTP or ask Telnyx to verify that the call inbound to LiveKit has expected energy (peak RMS). If RTP shows low energy, Telnyx must adjust trunk settings (disable AGC/normalization or change codec).
2. Force Telnyx to use G.722 / HD voice on trunk. Re-test and re-check agent frame logs.
3. If RTP into LiveKit looks normal but agent still sees low amplitude:
◦ Confirm LiveKit SFU decode path isn’t configured to normalize; collect a short sample (WAV) from the LiveKit side and compare levels.
1. If Telnyx can’t change processing, as a workaround use in-agent gain compensation:
◦ If audio arriving at the agent is low but non-zero, apply a server-side gain multiplier (e.g., multiply PCM by 10–30) before feeding to VAD/STT. This should be temporary—better to fix at source.
◦ Example: multiply int16 PCM samples, clamp to avoid clipping.
1. Keep VAD thresholds conservative while debugging:
◦ silero.VAD.load(activation_threshold=0.3, min_speech_duration=0.05)
What to share with Telnyx/support (if you contact them)
• Exact SIP trunk configuration (codec list, transport, any media transforms enabled).
• A short RTP capture or base64-encoded audio sample showing low amplitude.
• Timestamps when you saw low-energy frames on the LiveKit side.
What to send me (I’ll help interpret)
• One short audio sample taken at:
1) Immediately after Telnyx→LiveKit ingress (if you can capture), or 2) The first few agent-side frames you already log (min/max array and sample_rate).
• Your Telnyx trunk codec list and settings (G.722 enabled? any audio processing toggles?)
If you give me one agent-side frame log after forcing G.722 (or after a Telnyx config change), I’ll confirm whether the amplitude is correct or whether you should apply server-side gain.
Sources: SIP participant | LiveKit docs | ElevenLabs STT | LiveKit docs | Turn detection and interruptions | LiveKit Docs | HD voice for SIP | LiveKit docs | Secure trunking | LiveKit docslimited-pillow-7054
12/13/2025, 5:30 PMWe found the quickstart uses string format:session = AgentSession(
stt="deepgram/nova-3:en",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic-3:voice-id",
)
But our code uses object format:from livekit.agents import inference
stt = inference.STT(model="elevenlabs/scribe_v2_realtime", language="en")
llm = inference.LLM(model="openai/gpt-4o-mini")
Question: For LiveKit Inference, should we use STRING format directly in AgentSession? Is inference.STT() / inference.LLM() even needed?
Question 2: AUDIO AMPLITUDE ISSUE (CRITICAL)
• *Browser-side (BEFORE WebRTC publish):*RMS dB: -1.5 to -20 (GOOD, loud)
• Applied 22x gain via Web Audio API
• echoCancellation=false, noiseSuppression=false, autoGainControl=false ✅
• *Agent-side (AFTER receiving):*RMS dB: -46 to -55 (BAD, essentially silence)
• Min/max amplitude: ±400 (expected: ±5000)
• VAD NEVER triggers
Question: Is WebRTC/Opus/LiveKit SFU normalizing the audio? Should audio arrive at the agent with proper amplitude? Is this expected behavior or a bug?
Question 3: ROOM CONNECTION PATTERN
Our code does:await ctx.connect(auto_subscribe=True)
participant = await ctx.wait_for_participant()
await session.start(room=ctx.room, agent=agent)
# Then blocks with disconnect_event.wait()
Quickstart does:await session.start(room=ctx.room, agent=Assistant())
# No ctx.connect(), no wait_for_participant(), no manual blocking
Question: Does session.start() handle room connection internally? Should we remove ctx.connect() and wait_for_participant()?
Question 4: ELEVENLABS SCRIBE V2 MODEL ID
We used: elevenlabs/scribe_v2_realtime (underscore) Docs show: elevenlabs/scribe-v2-realtime:en (hyphen) Question: Is elevenlabs/scribe-v2-realtime:en the correct model ID for LiveKit Inference? Is this STT model fully supported and working?
Question 5: RECOMMENDED MODELS FOR TESTING
We want to use LiveKit Inference for everything (no separate API keys). Question: What's the recommended STT + LLM + TTS combination that definitely works with LiveKit Inference right now? We want to test with a known-working setup before customizing.tall-airline-16756
12/13/2025, 5:31 PM"deepgram/nova-3:en") and the inference.* helper objects.
• You do NOT strictly need to call inference.STT() / inference.LLM() — using string IDs in AgentSession is the simplest path and matches quickstart examples.
• Use objects when you need to pass extra SDK-specific options (custom kwargs, VAD wiring, or client-side config). For basic inference usage, prefer the string shorthand for clarity.
Question 2 — Audio amplitude behavior (why RMS drops)
• Audio arriving at the agent should not be near-silent if the browser signal is loud. The decoded PCM at the agent is expected to reflect the encoded signal amplitude (no intentional large attenuation). What you’re seeing (browser loud → agent RMS ≈ -50 dB) is not expected normal behavior and indicates attenuation somewhere in the chain (capture/encoding/codec negotiation, SIP trunk, or SFU decode). It’s not normal for LiveKit to deliver near-silent audio when the published track is loud. Possible causes:
◦ Browser still applying AGC/processing (verify with track.getSettings() — must show autoGainControl, noiseSuppression, echoCancellation all false). Some browsers silently override settings.
◦ Telnyx/SIP trunk-side processing (AGC, normalization, codec transcoding) can reduce energy.
◦ SFU/codec path/resampling differences or re-normalization in decode.
• Debug steps (exact):
a. Log track.getSettings() in browser and confirm flags are false.
b. Publish only the Web‑Audio amplified track (do not publish original raw mic in parallel).
c. Test different browsers (Firefox vs Chrome) to see if amplitude differs.
d. Capture RTP at SIP ingress (or ask Telnyx) — if RTP already low, fix Telnyx trunk (disable AGC/normalization; enable G.722 HD voice).
e. If RTP into LiveKit looks OK but agent sees low amplitude, capture a short decoded WAV at LiveKit/SFU and compare. If SFU is attenuating, we can escalate or apply a server-side gain multiplier as a temporary workaround (multiply PCM before VAD/STT).
• Short conclusion: low agent amplitude is not the expected behavior; root is in processing/codec/gain somewhere — confirm client settings, test browsers, inspect RTP or enable temporary server-side gain if source changes aren’t possible.
Question 3 — Room connection pattern (ctx.connect vs session.start)
• session.start() does NOT implicitly connect your process to the room for JobContext. The quickstart sometimes shows a simplified pattern where the session helper manages the room internally, but in your JobContext flow:
◦ Keep await ctx.connect(auto_subscribe=True) to ensure the worker’s context is connected and will receive room events.
◦ Keep await ctx.wait_for_participant() if you want to wait for a participant before starting the session (good pattern).
• Important lifecycle detail: session.start() is non-blocking. You must keep the entrypoint alive (e.g., wait on disconnect_event or participant disconnect). Your current pattern (connect → wait_for_participant → session.start → block on disconnect) is correct. Do not remove ctx.connect() unless you use a different helper that handles connection.
Question 4 — ElevenLabs Scribe V2 model identifier
• Use the hyphenated form: elevenlabs/scribe-v2-realtime:en (provider/model-version with region/language after colon). That is the supported LiveKit Inference model ID format.
• ElevenLabs Scribe V2 Realtime is supported by LiveKit Inference and should work without a separate ElevenLabs key. If you used elevenlabs/scribe_v2_realtime (underscores) that is likely an identifier mismatch in places — prefer the documented hyphenated ID. If you still see no effect, confirm SDK version compatibility (livekit-agents >= 1.2.13 for inference features).
Question 5 — Recommended known-working model combination (use this to validate) Use these inference-backed IDs (string format) for a baseline known-working stack:
• STT: "deepgram/nova-3:en" (multilingual variants exist) — good reliable baseline for testing if ElevenLabs shows issues.
• LLM: "openai/gpt-4o-mini" via inference.LLM or the string "openai/gpt-4o-mini".
• TTS: "cartesia/sonic-3:default" or "openai/tts-1:alloy" via inference.TTS (use inference.TTS for consistency) OR keep the plugin openai.TTS() if you need a plugin voice. Prefer inference.TTS when testing full Inference path.
• Example quickstart session (string IDs):
session = AgentSession(
stt="deepgram/nova-3:en",
llm="openai/gpt-4o-mini",
tts="cartesia/sonic-3:voice-id",
vad=silero.VAD.load(),
)
• Start here first. If this combination works end-to-end (VAD triggers, stt_audio_duration > 0, transcripts appear), then switch STT to elevenlabs/scribe-v2-realtime:en to validate that model specifically.
Extra practical tips
• Confirm livekit-agents version >= 1.2.13. Run pip show livekit-agents.
• Always check track_subscribed + one audio-frame log immediately after subscription (min/max/non_zero/RMS). Use that to validate amplitude before trusting VAD.
• For hard-to-fix trunk-side attenuation, temporary server-side gain (multiply PCM frames by a constant, clamp to int16 range) will let you continue testing while Telnyx/codec settings are adjusted.
• Use the string shorthand for quick repros; move to object helpers only when you need SDK options.
If you want I can:
• Provide a minimal AgentSession example using the recommended working model combo (string IDs) you can paste and run now.
• Or help validate a single post-amplification frame log (min/max/RMS) to confirm whether amplitude after your front-end amplification is sufficient for VAD. Which would you prefer?limited-pillow-7054
12/13/2025, 5:54 PMWe're using:TTS_MODEL = "cartesia/sonic-3:f786b574-daa5-4673-aa0c-cbe3e8534c02"
The voice ID f786b574-daa5-4673-aa0c-cbe3e8534c02 is "Katie" from Cartesia docs. Question: Is this the correct format for Cartesia TTS via LiveKit Inference? Should it be cartesia/sonic-3:voice-id or cartesia/sonic-3/voice-id or something else?
Question 2: Server-Side Gain Boost with String Format STT
We have server-side gain boost via stt_node override in our Agent class:class POSKAIAgent(Agent):
async def stt_node(self, audio, model_settings):
async def amplified_audio():
async for frame in audio:
yield apply_gain_to_frame(frame, 16.0) # +24dB
async for event in Agent.default.stt_node(self, amplified_audio(), model_settings):
yield event
Question: When using STRING format STT (stt="deepgram/nova-3:en"), does the stt_node override still get called? Or does string format bypass the Agent's stt_node method entirely?
Question 3: Deepgram vs ElevenLabs for Testing
We're starting with deepgram/nova-3:en as you recommended. Question: Once Deepgram works, to switch to ElevenLabs, do we just change:STT_MODEL = "elevenlabs/scribe-v2-realtime:en"
And everything else stays the same? Any gotchas with ElevenLabs via LiveKit Inference?
Question 4: livekit-agents Version Requirement
1. You mentioned livekit-agents >= 1.2.13 for inference features. Question: What's the minimum version that supports:String format for STT/LLM/TTS in AgentSession
2. ElevenLabs Scribe V2 via inference
3. Cartesia Sonic-3 via inference
We want to pin the correct version in requirements.txt.tall-airline-16756
12/13/2025, 5:54 PM