l
hi
t
Thanks for reaching out, Pavan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — what can I help you with today? Tell me briefly what you’re trying to do (example: joining a room, publishing audio/video, SDK errors, auth/token issues, or billing). If you have an error message, SDK/platform (web/iOS/Android), and any steps you’ve already tried, include those and I’ll jump in.
l
AgentStateChangedEvent {"message": "worker is at full capacity, marking as unavailable", "level": "INFO", "name": "livekit.agents", "load": 0.7392038461538462, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-12-10T082945.701896+00:00"} can you check this
t
You're seeing an AgentStateChangedEvent that says: "worker is at full capacity, marking as unavailable." I'll explain what this means, why it happened, and what you can do next. What it means • The agent measured its current load at ~0.739 (73.9%) which is above the configured threshold of 0.7 (70%), so the worker marked itself unavailable and will stop accepting new jobs. Existing sessions continue running. Why this can happen • A spike in concurrent agent sessions. • Resource-heavy processing (VAD, noise suppression, turn-detection, or other models). • If running on burstable cloud instances (e.g., t3/t4), CPU credits can be exhausted causing throttling even when reported CPU looks modest. Recommended next steps • Scale horizontally: add more agent instances so load spreads across workers. • Use non-burstable instance types (c5, m5, c6i) for consistent CPU performance. • Monitor agent metrics and logs to track session counts, CPU, and load over time. • If self-hosting and your workload allows it, consider tuning
load_fnc
/
load_threshold
(not changeable on LiveKit Cloud). Quick questions to help me advise further 1. Are you on LiveKit Cloud or self-hosting agents? 2. What instance types are your agents running on (if applicable)? 3. Did this coincide with a traffic spike or enabling any audio processing features (VAD, noise cancel, turn detection)? Tell me those and I’ll give specific next steps for your environment. Sources: Agent server options | LiveKit docs | Deploying to custom environments | LiveKit docs | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | Deploy and scale agents on LiveKit Cloud | Agent deployment CLI reference | LiveKit docs
l
session = AgentSession( stt=get_stt(assistant), llm=get_llm(assistant), tts=get_tts(assistant), vad=vad, # Use prewarmed VAD turn_detection=turn_detector, # Use prewarmed turn detector # Performance optimizations preemptive_generation=True, # Start LLM before end-of-turn confirmed min_endpointing_delay=0.3, # Faster response (default is 0.5) max_endpointing_delay=4.0, # Reduced from 6.0 user_away_timeout=15.0, # Reduced from 20.0 min_interruption_duration=0.4, # Slightly faster interruption detection min_interruption_words=1, # Respond to single word interruptions ) from livekit.plugins.silero import VAD from livekit.plugins.turn_detector.multilingual import MultilingualModel def get_turn_detector(): return MultilingualModel() def get_vad(): vad = VAD.load() return vad this my agent session
t
Thanks — that session config is helpful. I’ll explain how those settings can raise worker load, what to try immediately, and a couple quick questions to target recommendations. How your session config increases load • Prewarmed VAD and turn detector: prewarming keeps models in memory and ready, which increases baseline CPU/memory usage per worker. • `preemptive_generation=True`: starts LLM work before turn end — this increases concurrent CPU/RAM usage and can raise short-term load spikes. • Shorter endpointing and timeouts (
min_endpointing_delay=0.3
,
max_endpointing_delay=4.0
,
user_away_timeout=15.0
,
min_interruption_*
): these make the agent respond more frequently and quicker, raising concurrency and job churn. Immediate mitigations to reduce load • Temporarily disable
preemptive_generation
or only enable it for high-priority sessions. • Increase
min_endpointing_delay
slightly (e.g., back to 0.5) to reduce generation starts. • Reduce number of concurrently attached components per worker (e.g., avoid prewarming both VAD and turn detector on every worker). • If using burstable instances, switch to non-burstable types (c5/m5/c6i) or scale horizontally by adding more workers. Longer-term options • Horizontal scaling: add more agent instances to distribute sessions. • Gate high CPU features behind capability checks so only some workers run heavy models. • If self-hosting, tune `load_threshold`/`load_fnc` for your workload. Quick questions to recommend precise steps 1. Are you on LiveKit Cloud or self-hosting agents? 2. What instance types are your agents running on? 3. Did this happen during a traffic spike or after enabling prewarming/features? Tell me those and I’ll suggest the best next changes for your environment.
l
i am using livekit cloud
t
Thanks — since you’re on LiveKit Cloud, here’s what matters and actionable steps you can take. What’s happening • LiveKit Cloud enforces a load threshold of 0.7. Your worker reported load ~0.739 and was marked unavailable, so it stopped accepting new jobs while keeping existing sessions running. Practical, immediate actions you can take • Disable or limit preemptive generation (
preemptive_generation=False
) to avoid overlapping LLM work. • Avoid prewarming both VAD and turn detector on every worker — prewarm only the component you most need or prewarm on fewer workers. • Relax endpointing/timeouts slightly (e.g.,
min_endpointing_delay=0.5
,
max_endpointing_delay=4–6s
) to reduce generation churn. • Increase
min_interruption_duration
or
min_interruption_words
if false positives are starting LLM work too often. • Reduce concurrent sessions per agent (route fewer simultaneous users to each worker). Monitoring suggestions • Watch agent load and session counts around the times you saw the event to correlate spikes with traffic or features. • Look for patterns when preemptive generation or prewarmed models are in use. If you’d like, I can: • Suggest an updated AgentSession config with specific values to try. • Help prioritize which features to disable first for the biggest CPU reduction. Which would you prefer?
l
• Suggest an updated AgentSession config with specific values to try. • Help prioritize which features to disable first for the biggest CPU reduction.
t
Thanks — below are a prioritized set of feature changes (biggest CPU reduction first) and a suggested AgentSession config to try on LiveKit Cloud. Each change includes a brief rationale. Prioritized changes (apply in order) 1. Disable preemptive generation (largest immediate CPU win) ◦ Why: Prevents overlapping LLM work that spikes CPU by starting generation before turn end. 1. Avoid prewarming both models on every worker ◦ Why: Prewarmed VAD and turn detector increase baseline memory/CPU. Prewarm only the one you need most or prewarm on a subset of workers. 1. Turn off heavy audio models when not essential (e.g., advanced noise suppression) ◦ Why: These models consume CPU per session; disabling reduces per-session load. 1. Increase endpointing and interruption thresholds slightly ◦ Why: Reduces churn of short generations triggered by jittery endpointing or brief interruptions. 1. Reduce concurrent sessions per worker (routing change) ◦ Why: Distributes load horizontally if you can shift traffic to other workers. Suggested AgentSession config to try session = AgentSession( stt=get_stt(assistant), llm=get_llm(assistant), tts=get_tts(assistant), vad=get_vad(), # keep if you need local VAD; consider prewarming on fewer workers turn_detection=None, # disable turn detector (or remove prewarm) to cut baseline load preemptive_generation=False, # disabled to avoid overlapping LLM jobs min_endpointing_delay=0.5, # modestly higher to reduce premature generation max_endpointing_delay=5.0, # balanced responsiveness vs. CPU churn user_away_timeout=18.0, # slightly higher to avoid frequent session re-evaluations min_interruption_duration=0.5, min_interruption_words=2, # avoid reacting to single-word noise ) Rationale highlights • Turning off preemptive generation and removing one prewarmed model will give the biggest immediate reduction in CPU. • Slightly relaxing endpointing and interruption sensitivity prevents many small LLM starts that accumulate load. • If you still hit the threshold after these changes, scale horizontally (add more workers) or route fewer concurrent sessions per worker. If you want, I can: • Produce a variant that keeps the turn detector but removes prewarmed VAD (or vice versa) so you can A/B test which model costs more for your workload. Which model can you sacrifice first for testing?
l
i am running this on 4gb of docker ram
t
Thanks — with only 4 GB RAM for the Docker worker, we need to be conservative about prewarmed models and concurrent CPU work. Below are prioritized changes (apply top → bottom) and a recommended AgentSession tuned for 4 GB. Prioritized changes (biggest impact first) 1. Disable preemptive generation (stop overlapping LLM work). 2. Prewarm at most one model (choose VAD OR turn detector) — prefer VAD for basic endpointing. 3. Disable or remove turn detector prewarm (run it cold if needed). 4. Disable heavy audio processing (noise suppression, advanced models) unless essential. 5. Increase endpointing delays slightly to reduce churn. 6. Raise interruption thresholds (avoid single-word triggers). 7. Limit concurrent sessions per worker (route fewer users to each 4 GB container). Suggested AgentSession for 4 GB Docker session = AgentSession( stt=get_stt(assistant), llm=get_llm(assistant), tts=get_tts(assistant), vad=get_vad(), # keep VAD prewarmed if endpointing is critical turn_detection=None, # disable turn detector prewarm to save RAM/CPU preemptive_generation=False, # avoid overlapping LLM tasks min_endpointing_delay=0.6, # slightly slower but reduces false starts max_endpointing_delay=5.0, # keep responsiveness reasonable user_away_timeout=20.0, # slightly higher to avoid churn min_interruption_duration=0.6, min_interruption_words=2, # require at least 2 words to interrupt ) Additional operational tips • If you must use both VAD and turn detector, prewarm them on separate workers only (not every worker). • Monitor memory and CPU during peak use and lower concurrent session count if memory approaches limits. • Prefer lighter instance types or scale horizontally (more 4 GB workers) rather than trying to run many features on one container. If you want, I can produce two small A/B configs: • A: Prewarmed VAD only (keep above config). • B: Prewarmed turn detector only (swap
vad=None
,
turn_detection=get_turn_detector()
) Tell me which A/B you'd like and I’ll show the exact variant.
l
for my agent how many memory is needed
t
With your current stack (VAD, turn detector, STT/LLM/TTS, preemptive generation) and running on LiveKit Cloud, memory guidance: • Minimum: 4 GB RAM can work for lightweight, low-concurrency agents but is constrained with prewarmed models and concurrent LLM work. • Recommended: 8 GB RAM per agent for reliable headroom with common voice-AI features (VAD/turn detector, STT/LLM/TTS). • Why: prewarmed models and preemptive generation increase baseline RAM and concurrent CPU usage; real tests show ~2.8 GB used for 30 concurrent agents on an 8 GB host, so 8 GB gives room for spikes and extra models. • If you must stay at 4 GB: ◦ Prewarm at most one model (prefer VAD). ◦ Disable preemptive_generation. ◦ Increase endpointing delays and interruption thresholds. ◦ Limit concurrent sessions per worker. • If you can move to 8 GB: ◦ You can safely prewarm one or two lightweight models and use preemptive_generation selectively. ◦ Monitor memory and CPU in the LiveKit Cloud dashboard and scale horizontally if needed. If you tell me which model(s) you most rely on (VAD vs turn detector) and your typical concurrent sessions per worker, I’ll recommend a concrete memory/concurrency target. Sources: Deploying to custom environments | LiveKit docs | Deploy and scale agents on LiveKit Cloud | Introducing LiveKit Inference: A unified model interface for voice AI | LiveKit turn detector plugin | LiveKit docs | Troubleshooting Latency and Timeout Errors with Turn Detection on AWS