How to check memory usage of my lk agent worker!!
# ask-ai
f
How to check memory usage of my lk agent worker!!
t
Thanks for reaching out, Tushar. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you keep an eye on the memory usage of your LiveKit agent worker! Here are some ways you can do that: • Built-in Memory Monitoring: LiveKit agent workers come with built-in memory monitoring that checks the RSS (Resident Set Size) of job processes every 5 seconds. You can set thresholds for warnings and limits using options like
job_memory_warn_mb
and
job_memory_limit_mb
. For example, in Python:
Copy code
opts = WorkerOptions(
    job_memory_warn_mb=500,
    job_memory_limit_mb=0,
)
• Just a quick note: these settings work for process-based job executors. • Using the LiveKit CLI: If you're using LiveKit Cloud, you can easily check memory usage with the
lk agent status
command. Like this:
Copy code
lk agent status
• This will show memory usage in the "Mem" column. • System-Level Monitoring: For self-hosted setups, tools like
top
,
htop
, or
ps
are great for monitoring memory usage. If you have any questions or want me to walk you through any of these steps, just let me know—I’m here to help! Sources: agents/src/worker.ts | Agent deployment CLI reference | LiveKit Docs | Deploying to custom environments | LiveKit Docs | Deployment and scaling | LiveKit Docs | Logs, metrics, and telemetry | LiveKit Docs
f
I am infact using lk cloud. How to do lk agent status. Do I have to install lk as a CLI tool>
t
To get started with the
lk agent status
command, you'll first need to install the LiveKit CLI tool. Don't worry, I'll guide you through the steps: • Mac: You can easily install it using Homebrew:
brew install livekit-cli
• Linux: Just run the install script: `curl -sSL https://get.livekit.io/cli | bash`Alternatively, you can download it from the latest release. • Windows: Use
winget
to install: `winget install LiveKit.LiveKitCLI`Or grab it from the latest release. Once you have it installed, just authenticate with your LiveKit Cloud account by running:
Copy code
lk cloud auth
After you're logged in, checking your agent's status is straightforward: • If you have a
livekit.toml
file in your current directory, simply run:
lk agent status
• If not, no worries! Just specify the agent ID like this:
lk agent status --id CA_MyAgentId
This will give you useful details like memory and CPU usage. If you have any questions or run into any issues, please feel free to reach out—I’m here to help! Sources: cmd/lk/main.go | Agent deployment CLI reference | LiveKit Docs