I have voice agent deployed on livekit cloud. Shou...
# ask-ai
d
I have voice agent deployed on livekit cloud. Should i run
lk agent deploy
every single time to update the code on server? or is there any other way I can update the code on the server for the agent?
t
Thanks for reaching out, Harsha. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! When you want to update the code for your voice agent on LiveKit Cloud, just use the
lk agent deploy
command. This will kick off a smooth rolling deployment where LiveKit Cloud builds a new container image from your updated code (using your Dockerfile), spins up new instances alongside the current ones, directs new sessions to these fresh instances, and then gently shuts down the old instances once their active sessions finish (which can take up to an hour). Just a heads up: this is the only way to update your agent's code. Other commands like
update
or
update-secrets
are meant for updating metadata or secrets, not the code itself. Sources: Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | autocomplete/fish_autocomplete
d
I am using google tts but the ai is not speaking and here are the logs -
Copy code
{"message": "starting worker", "level": "INFO", "name": "livekit.agents", "version": "1.2.6", "rtc-version": "1.0.12", "timestamp": "2025-09-08T04:23:56.767481+00:00"}
{"message": "preloading plugins", "level": "INFO", "name": "livekit.agents", "packages": ["livekit.plugins.cartesia", "livekit.plugins.deepgram", "livekit.plugins.openai", "livekit.plugins.silero", "livekit.plugins.sarvam", "livekit.plugins.google", "livekit.plugins.turn_detector", "av"], "timestamp": "2025-09-08T04:23:56.767591+00:00"}
{"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 93, "timestamp": "2025-09-08T04:23:58.532893+00:00"}
{"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 96, "timestamp": "2025-09-08T04:23:58.551216+00:00"}
{"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 93, "elapsed_time": 0.35, "timestamp": "2025-09-08T04:23:58.879281+00:00"}
{"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 96, "elapsed_time": 0.33, "timestamp": "2025-09-08T04:23:58.885423+00:00"}
{"message": "registered worker", "level": "INFO", "name": "livekit.agents", "id": "CAW_zcmfosSmbZFA", "url": "https://voice-agent-101bt5fj.livekit.cloud", "region": "US East B", "protocol": 16, "timestamp": "2025-09-08T04:23:58.927539+00:00"}
{"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_d5ibSciCJ53a", "dispatch_id": "", "room_name": "sbx-2bra0q-jcLTB9En6F5xiR9aesQquU", "agent_name": "", "resuming": false, "timestamp": "2025-09-08T04:24:27.902754+00:00"}
{"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 159, "timestamp": "2025-09-08T04:24:27.986027+00:00"}
{"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 159, "elapsed_time": 0.25, "timestamp": "2025-09-08T04:24:28.232938+00:00"}
{"message": "EOU metrics", "level": "INFO", "name": "livekit.agents", "room": "sbx-2bra0q-jcLTB9En6F5xiR9aesQquU", "end_of_utterance_delay": 0.49, "transcription_delay": 0.17, "pid": 93, "job_id": "AJ_d5ibSciCJ53a", "timestamp": "2025-09-08T04:24:31.064912+00:00"}
t
Thanks for sharing the logs! They don’t seem to show any clear errors with Google TTS. Could you double-check if the Google TTS plugin is set up with the right API keys and settings? Also, have you noticed any error messages or anything unusual happening when you use the TTS feature?
d
this is the error -
Copy code
{"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_d5ibSciCJ53a", "dispatch_id": "", "room_name": "sbx-2bra0q-jcLTB9En6F5xiR9aesQquU", "agent_name": "", "resuming": false, "timestamp": "2025-09-08T04:24:27.902754+00:00"}
{"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 159, "timestamp": "2025-09-08T04:24:27.986027+00:00"}
{"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 159, "elapsed_time": 0.25, "timestamp": "2025-09-08T04:24:28.232938+00:00"}
{"message": "EOU metrics", "level": "INFO", "name": "livekit.agents", "room": "sbx-2bra0q-jcLTB9En6F5xiR9aesQquU", "end_of_utterance_delay": 0.49, "transcription_delay": 0.17, "pid": 93, "job_id": "AJ_d5ibSciCJ53a", "timestamp": "2025-09-08T04:24:31.064912+00:00"}
{"message": "process memory usage is high", "level": "WARNING", "name": "livekit.agents", "memory_usage_mb": 507.31640625, "memory_warn_mb": 500, "memory_limit_mb": 0, "pid": 93, "job_id": "AJ_d5ibSciCJ53a", "timestamp": "2025-09-08T04:25:18.900214+00:00"}
t
Hey there! I noticed the logs are showing a warning about high memory usage, which might be affecting the TTS functionality. Could you share a bit about your system’s memory setup? Also, do you happen to have any other heavy processes running on the same server? I’m here to help figure this out with you!
d
I am using livekit cloud
t
Hey there! If you’re seeing high memory usage warnings for your voice agents on LiveKit Cloud, it might affect features like TTS. No worries though—here are some friendly steps to help you sort it out: 1. Get to Know Memory Monitoring: LiveKit gives a heads-up when memory usage goes over 500 MB by default. You can tweak this limit anytime using the
job_memory_warn_mb
setting. 2. Make Sure Resources Are Enough: For smooth sailing, LiveKit suggests 4 cores and 8GB RAM per worker for most voice AI apps. If things get busy, try cutting down on simultaneous jobs or turn off plugins you don’t really need. 3. Keep an Eye on Usage: The LiveKit Cloud dashboard is your friend here—it shows you memory and CPU use, so you can spot anything that’s hogging resources. 4. Adjust Limits When Needed: If memory use keeps crossing the warning line, you might want to raise that limit or set a
job_memory_limit_mb
to keep processes running smoothly. Feel free to reach out if you want a hand putting these tips into action or if you have any other questions. I’m here to help! Sources: livekit-agents/livekit/agents/worker.py | Deploying to custom environments | LiveKit Docs | Deploy and scale agents on LiveKit Cloud
d
where do i change this in livekit cloud?
t
In LiveKit Cloud, you can easily adjust memory thresholds like
job_memory_warn_mb
and
job_memory_limit_mb
through the WorkerOptions settings when you’re setting up your agent. For instance, setting
job_memory_warn_mb
lets you define when to get a memory warning, and
job_memory_limit_mb
sets the max memory usage before the process stops. If you’d like a hand finding or changing these settings in your deployment, just let me know—I’m here to help! Sources: examples/avatar_agents/bithuman/agent_local.py
d
please give me the command
t
Hey there! Just a quick heads-up: there isn’t a direct command to set
job_memory_warn_mb
or
job_memory_limit_mb
in LiveKit Cloud. Instead, you’ll want to configure these settings right in the agent’s code using the
WorkerOptions
class. Here’s a little example to guide you:
Copy code
from livekit.agents import WorkerOptions, cli

if __name__ == "__main__":
    cli.run_app(
        WorkerOptions(
            entrypoint_fnc=entrypoint,
            worker_type=WorkerType.ROOM,
            job_memory_warn_mb=1500,
            job_memory_limit_mb=2000,
            num_idle_processes=1,
        )
    )
Once you’ve updated the code, just redeploy the agent using
lk agent deploy
. If you want, I’m here to help you through the process—just let me know! Sources: tests/test_ipc.py
d
this is my current code -
Copy code
def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()


if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
t
If you want to include memory thresholds in your current code, you can easily tweak the
WorkerOptions
configuration like this:
Copy code
from livekit.agents import WorkerOptions, cli

def prewarm(proc: JobProcess):
    proc.userdata["vad"] = silero.VAD.load()

if __name__ == "__main__":
    cli.run_app(
        WorkerOptions(
            entrypoint_fnc=entrypoint,
            prewarm_fnc=prewarm,
            job_memory_warn_mb=1500,  # Set memory warning threshold
            job_memory_limit_mb=2000  # Set memory limit
        )
    )
Once you’ve made these changes, just redeploy your agent using
lk agent deploy
. If you run into any issues or have questions, feel free to reach out—I’m here to help!