c
hi
t
Thanks for reaching out, Arun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — thanks for reaching out! How can I help you today? If you have a specific issue, please share a few details such as: • What you’re trying to do (e.g., join a room, publish audio/video, integrate SDK) • Any error messages or unexpected behavior • Platform/SDK (web, iOS, Android, or server) and SDK version • Room ID or project ID if relevant I’ll help you from there.
c
184702.370 WARNI… livekit.…ns.silero inference is slower than realtime from livekit.agents import Agent, JobContext, WorkerOptions, cli from livekit.agents.voice import AgentSession from livekit.plugins import openai, cartesia, silero, deepgram, google from dotenv import load_dotenv from agents.utils.prompt import WELCOME_MESSAGE from agents.utils.web_agent import get_all_metadata, get_llm_from_config, get_stt_from_config, get_tts_from_config from agents.utils.prompt import DEFAULT_SYSTEM_PROMPT load_dotenv() class V1TestAgent(Agent): def __init__(self, meta_data): agent_info = meta_data['agent'] super().__init__( instructions=agent_info.get("system_prompt", DEFAULT_SYSTEM_PROMPT), stt=get_stt_from_config(meta_data['stt']), llm=get_llm_from_config(meta_data['llm']), tts=get_tts_from_config(meta_data['tts']), vad=silero.VAD.load(), ) async def entrypoint(ctx: JobContext): meta_data = await get_all_metadata(ctx) agent = V1TestAgent(meta_data) session = AgentSession() await session.start(agent=agent, room=ctx.room) if True: await session.say(meta_data['agent'].get('greeting_message', WELCOME_MESSAGE)) async def on_session_end(): ctx.delete_room(ctx.room.name) ctx.add_shutdown_callback(on_session_end) def run(): cli.run_app( WorkerOptions( entrypoint_fnc=entrypoint, agent_name="v1_test_agent", port=8082, ) ) if name == "__main__": run()how to speed up
t
Thanks — I’m responding about the Silero VAD “inference is slower than realtime” warning and how to speed it up. Quick checklist and recommended changes (apply in this order): 1) Prewarm and reuse the VAD model • Load the model once per worker process and store it in
ctx.proc.userdata
(use
WorkerOptions(prewarm_fnc=...)
) instead of calling
silero.VAD.load()
for every Agent/session. • Pass the preloaded instance into your Agent so sessions reuse it. 2) Use optimal load parameters • Call
silero.VAD.load(force_cpu=True, sample_rate=16000)
(match your audio sample rate) to avoid unnecessary resampling or device switching. 3) Reduce per-session initialization overhead • Ensure
get_stt_from_config
,
get_llm_from_config
, and
get_tts_from_config
return already-initialized instances (or prewarm them similarly) so session start doesn’t block. 4) Check CPU and environment constraints • Run the worker on a machine with sufficient CPU. Monitor CPU usage during inference — high CPU contention causes slowdown. Avoid tiny containers or shared noisy neighbors. 5) If inference still lags, measure to find the bottleneck • Log processing time per audio chunk in VAD and other pipeline stages. That will show whether VAD, STT, or network calls are the culprit. If you want, paste: • how you currently start the worker (WorkerOptions/prewarm usage), • your host CPU specs (vCPU count / container limits), • the sample rate of incoming audio, and I’ll give exact code edits and a short benchmark plan. Sources: Repeater | LiveKit docs | Uninterruptable Agent | LiveKit docs | Silero VAD plugin | LiveKit docs | examples/voice_agents | livekit/livekit_composite | DeepWiki