cuddly-crowd-48028
09/07/2025, 5:26 PMtall-airline-16756
09/07/2025, 5:26 PMtall-airline-16756
09/07/2025, 5:27 PMVoicePipelineAgent or MultimodalAgent classes, which can send transcriptions right to your frontend app if you set it up that way.
Transcriptions come in segments, each linked to a participant and track, and they’re marked as final once complete. You can also keep track of these transcriptions on the server side by listening to events like user_speech_committed and agent_stopped_speaking.
Here’s how you can tweak the transcription settings:
• Turn synchronized transcription forwarding on or off using RoomOutputOptions.
• Use TTS-aligned transcription for better timing and accuracy.
• Customize how transcriptions appear with the transcription_node() hook.
If you’re working with custom agents, the STTSegmentsForwarder class lets you forward transcriptions manually. Just give me a shout if you want more details or need a hand getting it all set up!
Sources: Example Applications | livekit/livekit_composite | DeepWiki | Transcriptions | LiveKit Docs | Recording agent sessions | LiveKit Docs | livekit-agents/livekit/agents/voice/transcription/synchronizer.py | Docs::Agentscuddly-crowd-48028
09/07/2025, 5:42 PMtall-airline-16756
09/07/2025, 5:42 PMAgent subclass. Here’s a friendly guide on how to tackle debugging for each component:
1. Debugging STT (Speech-to-Text)
• Try overriding the stt_node() method to peek at or tweak the audio input and transcription output.
• It’s super helpful to log audio frames and transcription events before and after processing.
• Here’s an example:
async def stt_node(self, audio: AsyncIterable[rtc.AudioFrame], model_settings: ModelSettings):
print("STT: Processing audio frames...")
events = await Agent.default.stt_node(self, audio, model_settings)
async for event in events:
print(f"STT Output: {event}")
yield event
2. Debugging LLM (Language Model)
• Override the llm_node() method to check out the chat context and the responses generated by the LLM.
• Logging input messages and output chunks can really help you understand what’s happening under the hood.
• Here’s how you might do it:
async def llm_node(self, chat_ctx: llm.ChatContext, model_settings: ModelSettings):
print(f"LLM Input: {chat_ctx.messages}")
response = await Agent.default.llm_node(self, chat_ctx, model_settings)
async for chunk in response:
print(f"LLM Output: {chunk}")
yield chunk
3. Debugging TTS (Text-to-Speech)
• Give overriding the tts_node() method a shot to keep an eye on text input and audio output.
• Logging text segments before synthesis and trying out custom audio processing can be really insightful.
• Check out this example:
async def tts_node(self, text: AsyncIterable[str], model_settings: ModelSettings):
async for segment in text:
print(f"TTS Input Text: {segment}")
yield segment
Extra Debugging Tips
• Use lifecycle hooks like on_user_turn_completed() to get a better look at user input and chat context.
• Catch errors with session.on("error") to log any hiccups in STT, LLM, or TTS.
• Don’t forget about metrics tracking—it’s great for profiling latency and accuracy.
If you want, I’m here to help with implementation or any specific debugging scenarios you run into. Just let me know!
Sources: Pipeline nodes and hooks | LiveKit Docs | Docs::Agents | examples/voice_agents/error_callback.py | examples/src/comprehensive_test.ts | Pipeline nodes and hooks | LiveKit Docscuddly-crowd-48028
09/07/2025, 5:48 PMtall-airline-16756
09/07/2025, 5:49 PMcuddly-crowd-48028
09/07/2025, 5:53 PMsk_408bf95...)
- Voice ID: 21m00Tcm4TlvDq8ikWAM (Rachel voice) is valid
- Model: eleven_monolingual_v1 is working
### ❌ LiveKit Plugin Fails
- Outside Job Context: RuntimeError: Attempted to use an http session outside of a job context
- Inside Job Context: Plugin works but generates silent audio
- Error Pattern: APIConnectionError: Connection error. (body=None, retryable=True)
## Root Cause Analysis
### The Real Issue
1. ElevenLabs TTS Plugin: Requires proper HTTP session management within LiveKit job context
2. Session Management: LiveKit's HTTP context is not properly initialized for the ElevenLabs plugin
3. Silent Audio Generation: Plugin fails silently and generates empty audio frames instead of speech
### Technical Details
python
# This works - Direct API call
response = requests.post(url, json=data, headers=headers) # :white_check_mark: 54,797 bytes
# This fails - LiveKit plugin
tts = elevenlabs.TTS(api_key=api_key, voice_id="21m00Tcm4TlvDq8ikWAM")
# :x: RuntimeError: Attempted to use an http session outside of a job context
## Impact
- KAORI Agent: Generates 501 audio frames but all are silent (RMS: 0.000004)
- User Experience: No speech output despite successful connection and audio streaming
- File Generation: Creates correct-sized WAV files (481,004 bytes) but with no sound
## Solution Attempted
Switched to OpenAI TTS but same issue persists:
- OpenAI TTS: Also generates silent audio in LiveKit context
- Same Pattern: 501 frames, 481,004 bytes, but silent content
- Conclusion: Issue is with LiveKit agent pipeline, not TTS provider
## Final Diagnosis
The issue is NOT with ElevenLabs TTS - it's with LiveKit's agent pipeline configuration that prevents any TTS provider from generating actual speech content. The agent generates audio frames but they contain silence instead of synthesized speech.
ElevenLabs TTS works perfectly when called directly, but fails within the LiveKit agent context due to HTTP session management issues.tall-airline-16756
09/07/2025, 5:53 PM