LiveKit Cloud Agent Draining

Can someone explain to me how the Draining of Agents work in LiveKit Cloud? We’re a small startup with only 1 Agent deployed to LiveKit Cloud and not much usage. But one thing I noticed today, is that if I deploy an agent, it takes time for the others to drain, even though there are no Active usage of those other agents. AND the worst thing is, somehow my new sessions are being dispatched to the old agent! I know this only from querying the logs, because I see logs that I don’t expect to see in my new agent deployed code.

There may be an issue with LiveKit could deployment where Agents don’t correctly drain all the way. And new sessions could land on an old agent. In the example below our dashboard shows agents draining from 6 days ago, I know for sure there are no usages of those agents anymore. We have 0 rooms opened right now!

See the attached image showing two agents draining, one from 6 days ago and one from like an hour ago.

So my concern is:

  1. Agents may not be draining correctly
  2. New sessions are landing on old agents when a new one is recently deployed

If it’s expected that for some time new sessions may land on an old agent, how do we ensure that our sessions pick the latest agent? It would be expected that this happen automatically, but if it’s not, how do we pass a build id or something?

mitra-ai/agent/mitra-ai-agents main ✔ 50m ⍉
▶ lk agent list
Using project [Mitra-AI]
┌─────────────────┬─────────┬─────────────────┬──────────────────────┐
│ ID │ Regions │ Version │ Deployed At │
├─────────────────┼─────────┼─────────────────┼──────────────────────┤
│ CA_kmFxzzVtko9H │ us-east │ v20260224201212 │ 2026-02-24T20:13:44Z │
└─────────────────┴─────────┴─────────────────┴──────────────────────┘
(mitra-ai-agents-py3.13)
mitra-ai/agent/mitra-ai-agents main ✔ 12m
▶ lk room list
Using project [Mitra-AI]
┌────────┬──────┬──────────────┬────────────┐
│ RoomID │ Name │ Participants │ Publishers │
├────────┼──────┼──────────────┼────────────┤
└────────┴──────┴──────────────┴────────────┘

Took a look around, and I believe your code is “eating” the signal. It needs to be passed on to the LiveKit process. If the LiveKit SDK does not receive the signal, it will continue to run forever.

See cli.py