I am getting memory usage issues with my cloud dep...
# ask-ai
c
I am getting memory usage issues with my cloud deployed agent, is there a way I can access the files and check for it?
t
Thanks for reaching out, Subham. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! To help you better, could you please share a bit more about the kind of access you're looking for? For example: • Are you hoping to see real-time memory metrics, dig into historical logs, or access specific dump files? • Are you working with a custom agent image where memory tracing might be turned on programmatically? • Have you had a chance to check the LiveKit Cloud dashboard or tried the
lk agent logs
command to find memory-related details? Getting a clearer picture will allow me to guide you to the best tools or solutions. I'm here to help! Sources: tools/main/README.md | Deploy and scale agents on LiveKit Cloud | cmd/lk/agent.go | components/media_lib_sal/mem_trace/README.md
c
i see it agent logs command, and i see the following metrics,
Copy code
{
  "message": "process memory usage is high",
  "level": "WARNING",
  "name": "livekit.agents",
  "memory_usage_mb": 501.0390625,
  "memory_warn_mb": 500,
  "memory_limit_mb": 0,
  "pid": 101,
  "job_id": "AJ_tHVbLEqG6sBz",
  "timestamp": "2025-09-15T11:02:18.000799+00:00"
}
t
Thank you for sharing your logs! The warning you're seeing indicates that the process memory usage has gone beyond the set
memory_warn_mb
threshold. Let’s work through some steps together to help you manage this: 1. Adjust the memory warning threshold: If your workload is memory-intensive, it might be helpful to increase the
memory_warn_mb
value in your agent's configuration. For example, tasks like noise cancellation often need a bit more memory. 2. Investigate memory leaks: If memory usage keeps rising unexpectedly, it’s a good idea to check if there might be memory leaks in your application. For JavaScript agents, reviewing the changelog of the
@livekit/agents
package can reveal past fixes related to memory. For Python agents, implementing memory tracing can give you insights into allocation history. 3. Monitor container memory limits: You can use tools like the LiveKit CLI to keep an eye on current memory usage (
CurMem
) compared to the memory limit (
MemLimit
) for your agent deployments. If you’d like, please let me know whether you’re using the Python or JavaScript LiveKit Agent SDK, and if the memory usage tends to spike occasionally or grows steadily over time. I’m here to help you get this sorted! Sources: Deploying to custom environments | LiveKit Docs | Deployment and scaling | LiveKit Docs | agents/CHANGELOG.md | pnpm-lock.yaml | components/media_lib_sal/mem_trace/README.md
c
how to do this? increase
memory_warn_mb
t
To help you increase the
memory_warn_mb
threshold in your LiveKit agent, you’ll want to adjust the
job_memory_warn_mb
parameter in your agent’s configuration. Here’s a friendly example for a Python-based agent:
Copy code
if __name__ == "__main__":
    cli.run_app(
        WorkerOptions(
            entrypoint_fnc=entrypoint,
            worker_type=WorkerType.ROOM,
            job_memory_warn_mb=1500,  # Set memory warning threshold to 1500 MB
            prewarm_fnc=prewarm,
            initialize_process_timeout=60,
            num_idle_processes=1,
        )
    )
You can simply replace
1500
with whatever memory threshold feels right for you in MB. This way, warnings will only pop up when memory usage goes beyond that limit. If you have any questions or want me to walk you through this configuration step-by-step, just let me know—I’m here to help! Sources: tests/test_ipc.py | kubernetes/agent-manifest.yaml
c
can I set _`job_memory_limit_mb=2048`_ in livekit cloud? Does it throw any issues?
t
Thanks for reaching out! In LiveKit Cloud, some advanced runtime settings like
job_memory_limit_mb
are usually managed behind the scenes. While you can set this parameter in self-hosted deployments to control memory limits (for example,
job_memory_limit_mb=2048
), in Cloud deployments, these settings are generally ignored and the platform takes care of managing them for you. Don't worry—setting
job_memory_limit_mb
in LiveKit Cloud won’t cause any issues, but it probably won’t enforce the memory limit you’re aiming for since the system handles memory based on its own policies. If having precise control over memory limits is important for your use case, self-hosting your agents might be a great option. And of course, I’m here to help if you want some tips on optimizing memory usage in LiveKit Cloud or if you have any other questions! Sources: livekit-agents/livekit/agents/ipc/inference_proc_executor.py | agents/src/ipc/supervised_proc.ts
c
what is the memory limit for livekit cloud?
t
Thanks so much for your question! While the specific memory limit for LiveKit Cloud agents isn’t officially documented, LiveKit generally suggests starting with 8GB of memory per worker for most voice AI applications in custom setups. When it comes to Cloud-hosted agents, the platform takes care of memory management behind the scenes, so those exact limits aren’t something users can see directly. If you’d like, I’m more than happy to help you find out the precise details about memory limits in LiveKit Cloud. Just let me know, and I can either assist further or connect you with the right team to get a clear answer for you. Sources: livekit-agents/livekit/agents/ipc/supervised_proc.py | Deploying to custom environments | LiveKit Docs
c
Yes I want to know the livekit memory limits, I don't want my agent running into memory issues.