Is there a ebook of the whole Livekit documentatio...
# ask-ai
m
Is there a ebook of the whole Livekit documentation i can download?
t
Thanks for reaching out, Stanislav. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! While LiveKit doesn’t offer an official ebook or downloadable version of the entire documentation, you can still access a complete text version at https://docs.livekit.io/llms-full.txt. Feel free to download and save it for offline use. If you'd like some help creating a personal offline copy in a specific format, just let me know! I’d be happy to guide you through the process using the tools available. Sources: livekit/livekit_composite | DeepWiki | livekit/livekit_composite | DeepWiki | LiveKit CLI | livekit/livekit_composite | DeepWiki | Development Tools | livekit/livekit_composite | DeepWiki | LiveKit Docs
m
when the agent session finishes how to get the tokens used ?
t
I understand you're looking to retrieve tokens used during an agent session, and I want to help clarify how this works with LiveKit. Currently, LiveKit doesn't offer a built-in feature to retrieve tokens after a session ends because tokens are usually short-lived and aren't stored for later access. However, a helpful approach is to log the tokens right when they're created through your token issuance service. This way, you'll have a handy record of all tokens issued for each session. If you'd like, I’d be more than happy to guide you through setting up this kind of logging—just let me know! Sources: Dispatching agents | LiveKit Docs | src/pages/api/token.ts | Analytics API | LiveKit Docs | livekit-plugins/livekit-plugins-anam/livekit/plugins/anam/api.py | complex-agents/nova-sonic/nova-sonic-form-agent/app/api/connection-details/...
m
no, I meant LLM tokens used, maybe session has it? for example session has history
t
To help you keep track of the LLM tokens used during your session, you can check out the token usage metrics through the
CompletionUsage
model. It includes handy fields like
prompt_tokens
,
completion_tokens
, and
total_tokens
. These metrics are generated during your session and can be captured in real-time. Also, you’ll find the entire conversation history stored in
session.history
. If you'd like, you can save this history to a file by using a shutdown callback once your session ends. If you’d like a hand setting this up or want some examples, just let me know—I’m here to help! Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | Workflows | LiveKit Docs | Workflows | LiveKit Docs | Session recording and transcripts | LiveKit Docs
m
agent keeps self interrupting, how to fix it?
t
It sounds like you're dealing with an agent that keeps self-interrupting—let’s work through some settings that can help smooth things out: • Try setting
allow_interruptions=False
in your
Agent
or
AgentSession
configuration. This helps prevent interruptions during speech. • Using
resume_false_interruption=True
along with
false_interruption_timeout
can be really useful to manage false interruptions caused by VAD sensitivity. • If you’re using a Realtime LLM with built-in turn detection, it might conflict with your local interruption settings, so it’s good to avoid that combination. • Explicitly configuring turn detection, like setting
turn_detection="vad"
, gives you better control over how the conversation flows. If you’d like, I’m here to help you implement these changes or provide some examples—just let me know! Sources: Turn detection and interruptions | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py
m
for some reason, the sound doesnt start playing for almost 500 ms using _background_audio_player for backround sound effects_ why ?
t
Thanks for reaching out! The 500ms delay you're noticing in sound playback when using _background_audio_player_ is most likely due to the default
min_endpointing_delay
setting in LiveKit's Voice Activity Detection (VAD) system. This setting creates a 500ms silence threshold before triggering actions like playing background sounds. If you'd like to reduce this delay, a great way is to lower the
min_endpointing_delay
by adjusting the
min_silence_duration
in your agent's turn detection settings. Here's an example to guide you:
Copy code
agent = VoicePipelineAgent(
    vad=silero.VAD.load(min_silence_duration=300),
    stt=deepgram.STT(),
    llm=openai.LLM(),
    tts=openai.TTS(),
)
By setting this value to 300ms or even lower, your background sound effects will play more promptly after the user finishes speaking. If you have any questions or want a hand with this setup, please don't hesitate to ask—I’m here to help! Sources: Improving voice AI's turn detection with transformers | Improving voice AI's turn detection with transformers | VoicePipelineAgent | LiveKit Docs | Improving voice AI's turn detection with transformers | examples/drive-thru/drivethru_agent.py
m
this didnt help
t
Could you please help me understand a bit more about when the 500ms delay happens? For example: • Is it right after you call
play()
on the _background_audio_player_? • Does it occur after the user stops speaking? • Or maybe during continuous playback alongside other media? Knowing this will really help us figure out if the issue is related to system settings, resource limits, or something specific to the platform. Thanks so much for your patience! Sources: src/room/Room.ts | livekit-agents/livekit/agents/voice/background_audio.py | Improving voice AI's turn detection with transformers | Improving voice AI's turn detection with transformers | Improving voice AI's turn detection with transformers
m
How to add evals? What about evals for realtime models?
t
Thank you for reaching out! Could you help me understand a bit more about what you mean by "adding evals"? For example: • Are you thinking about evaluation metrics to check how well your model is performing? • Or maybe you're interested in adding some custom evaluation logic for your realtime models? • Or is it something specific within LiveKit that you're curious about? The more details you can share, the better I can assist you. I'm here to help!