chilly-ghost-74326
07/28/2025, 11:37 AMtall-airline-16756
07/28/2025, 11:37 AMtall-airline-16756
07/28/2025, 11:38 AM<ws://localhost:7880>
Ensure your agent's configuration uses this URL instead of an SSL-based one (e.g., wss://).
2. Configure SSL for Local Development (Optional)
• If you need SSL for local development, you'll need to set up SSL termination. This requires a domain, an SSL certificate, and a load balancer or reverse proxy to handle HTTPS/SSL termination.
3. Verify Server Status
• Ensure your LiveKit server is running properly. Start it in development mode using the following command:
livekit-server --dev
This should start an instance that your agent can connect to without SSL.
Additional Troubleshooting
• Confirm your LiveKit server is running on port 7880.
• Ensure no firewall is blocking the connection.
• Verify that the agent's ws_url configuration matches your server setup (HTTP vs HTTPS).
Let me know if you need further assistance or if the issue persists after trying these steps.chilly-ghost-74326
07/28/2025, 12:05 PMtall-airline-16756
07/28/2025, 12:06 PMAgentSession Events
Want to catch those transcription events? Here's a friendly way to listen in:
from livekit.agents import AgentSession
@session.on("user_input_transcribed")
def on_transcript(transcript):
if transcript.is_final:
# Woohoo! We've got a final transcript
print(f"Final transcript: {transcript.transcript}")
else:
# Catching those interim updates
print(f"Interim transcript: {transcript.transcript}")
2. Accessing Current Transcript Property
Need to grab the current transcript? It's super easy:
# Snag the current transcript, including those interim results
current_text = voice_component.current_transcript
3. Using Session History
Want to keep track of the whole conversation? We've got you covered:
# Peek into the complete conversation history
conversation_history = session.history
# Pro tip: Save that history when shutting down
session.add_shutdown_callback(save_conversation_history)
4. Listening to Conversation Events
Get real-time updates as conversations unfold:
@session.on("conversation_item_added")
def on_conversation_item_added(item):
# Catch those new conversation items as they come in
print(f"New item added: {item}")
5. Custom STT Event Handling
For the tech-savvy agents out there, here's how to handle STT events directly:
from livekit.agents import stt, transcription
async def _forward_transcription(
stt_stream: stt.SpeechStream,
stt_forwarder: transcription.STTSegmentsForwarder,
):
async for ev in stt_stream:
stt_forwarder.update(ev)
if ev.type == stt.SpeechEventType.INTERIM_TRANSCRIPT:
print(ev.alternatives[0].text, end="")
elif ev.type == stt.SpeechEventType.FINAL_TRANSCRIPT:
print(" -> ", ev.alternatives[0].text)
6. Pipeline Nodes Access
Pro move: Text transcripts are also available in real-time through the llm_node or transcription_node.
Pick the method that feels right for your project. Whether you want real-time updates or a full conversation history, we've got you covered! Happy coding! 🚀
Sources: examples/other/transcription/README.md | Session recording and transcripts | LiveKit Docs | Transcriptions | LiveKit Docs | complex-agents/teleprompter/cartesia-ink.pychilly-ghost-74326
07/28/2025, 12:26 PMtall-airline-16756
07/28/2025, 12:26 PMRoomOutputOptions(sync_transcription=False) in a way that's super easy to understand. It's basically a cool LiveKit setting that gives you more control over how transcriptions show up.
What it does:
• When sync_transcription=False is set, transcriptions pop up right away, without waiting to match the original speech perfectly.
• This turns off the default synchronized transcription feature.
Default behavior (when sync_transcription=True):
• Normally, transcriptions follow along with the agent's speech, showing text word by word in real-time.
• If the agent gets interrupted, the transcription stops and adjusts to match what was actually said.
Usage example:
await session.start(
agent=MyAgent(),
room=ctx.room,
room_output_options=RoomOutputOptions(sync_transcription=False),
)
When to use it:
• When you want transcriptions to appear lightning-fast, without waiting for perfect timing.
• When you need transcriptions to show up immediately as they're generated.
• When speed matters more than perfectly synced playback.
This option is part of the RoomOutputOptions dataclass and is super helpful for apps where getting transcriptions quickly is a top priority. Hope this helps you understand it better!
Sources: Text and transcriptions | LiveKit Docs | livekit-agents/livekit/agents/voice/room_io/__init__.pychilly-ghost-74326
07/28/2025, 12:27 PMtall-airline-16756
07/28/2025, 12:28 PMpreemptive_generation parameter in `AgentSession`:
session = AgentSession(
preemptive_generation=True,
# other parameters...
)
2. Optimize Network and Infrastructure
• Imagine your agent is like a delivery service - the closer your services are to each other, the faster the response! Keep your LLM, Speech-to-Text, and Text-to-Speech services close network-wise.
• Keep an eye on those performance metrics - Time To First Token and Time To First Byte are your new best friends.
• Choose speedy service providers and use pre-connect buffering to get things moving quickly.
3. TTS-Specific Optimizations
• For Rime TTS, try the reduce_latency parameter. Just a heads up - it might make some words sound a bit funny, but hey, speed comes with trade-offs!
4. Minimize Connection Time
• Use those long-lasting "warm" tokens when logging in.
• Get your agent ready while generating tokens - multitasking for the win!
5. Handle Processing Delays
• Sometimes delays happen, but don't worry! Here are some ways to keep users engaged:
◦ Give users a heads up that you're working on their request.
◦ Throw in some cute "thinking" messages like "Let me check that out for you..."
◦ Use dynamic, AI-generated thinking responses.
◦ Play some background audio to keep things interesting.
By using these strategies, you'll create an agent experience that feels super responsive and friendly. Happy optimizing! 🚀
Sources: Agent speech and audio | LiveKit Docs | examples/voice_agents/preemptive_generation.py | AI Agents Framework | livekit/livekit_composite | DeepWiki | Rime integration guide | LiveKit Docs | Web and mobile frontends | LiveKit Docschilly-ghost-74326
07/28/2025, 12:31 PMtall-airline-16756
07/28/2025, 12:32 PM@livekit/components-react, it's super simple! Just set the video prop to false on the LiveKitRoom component. Check out this quick example:
<LiveKitRoom
video={false}
audio={false}
token={token}
serverUrl={process.env.NEXT_PUBLIC_LK_SERVER_URL}
onMediaDeviceFailure={(e) => {
console.error(e);
alert(
'Error acquiring camera or microphone permissions. Please make sure you grant the necessary permissions in your browser and reload the tab',
);
}}
>
<VideoConference />
</LiveKitRoom>
Pro tip: The video prop is pretty flexible – it can be a boolean or VideoCaptureOptions, and it defaults to false. This means your video won't start publishing right away when you connect to the LiveKit room.
2. Runtime Control
Want more flexibility? No problem! You can totally control your video tracks on the fly. Imagine having buttons that let you toggle video during your session – just use something like appActions.toggleVideo() to turn video on and off as you need.
Whether you want to disable video from the start or switch it up mid-session, these methods have got you covered. Hope this helps make your LiveKit setup a breeze! 😊
Sources: Subscribing to tracks | LiveKit Docs | src/room/track/LocalVideoTrack.ts | examples/nextjs/pages/minimal.tsx | docs/interfaces/LiveKitRoomProps.htmlchilly-ghost-74326
07/28/2025, 12:38 PMtall-airline-16756
07/28/2025, 12:39 PMchilly-ghost-74326
07/28/2025, 12:40 PM