Hi Team,
I am facing an issue with the LiveKit agent worker and would appreciate your guidance.
Case 1
When I dispatch an agent to join a room, sometimes it works correctly, but other times only the dispatch is created while the agent worker does not respond and does not start transcribing data.
In those cases, the real-time meeting continues, but the agent never starts processing, which causes me to lose the meeting data.
Case 2
To resolve this issue, I implemented a Redis-based approach.
What I did:
-
During dispatch, I check a Redis flag.
-
If the flag is not equal to
1, I retry the dispatch and create a new dispatch repeatedly. -
On the agent worker side, whenever the worker executes successfully or starts responding, I set the Redis flag to
1.
This implementation helped me verify whether the worker actually started and allowed me to dispatch accordingly.
However, now I am facing another issue: sometimes the agent suddenly leaves the meeting even though the session is still active and was not closed.
Case 3
For a more permanent solution, I contacted LiveKit AI support. They suggested replacing the Redis approach with job_status from LiveKit.
I updated both my dispatcher and agent worker code accordingly.
What I observed:
-
Sometimes after dispatching, I receive
job_status = 2, which indicates the agent is running correctly. -
However, most of the time I receive
job_status = 1.
When the status remains 1, the agent does not start the job, and because of that I lose the meeting conversation data.
Example logs:
Room ensured: 0u4r9n
Found existing dispatch: AD_8Chk8zceLc7t
Creating NEW dispatch for room 0u4r9n
Dispatch created: AD_X2XvFEEeMZeL
Poll 5 → Status: 1
Could you please help me understand what I might be doing wrong and suggest the correct permanent solution for handling this issue?
Thank you.