Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running agents with connect --room causes worker to receive sometimes two job requests instead of one #1063

Open
tpapaj opened this issue Nov 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tpapaj
Copy link

tpapaj commented Nov 9, 2024

Hello! I am running simple livekit worker with command python main.py connect --room tpapaj-room (where tpapaj-room can be anything) using function

from livekit.agents import AutoSubscribe, JobContext, WorkerOptions, cli, llm
(...)
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))

where entrypoint is my function where I create VoiceAssistant etc.

Sometimes it works correctly and one job request is received:

2024-11-09 17:33:47,917 - INFO livekit.agents - starting worker {"version": "0.10.1", "rtc-version": "0.18.0"}
2024-11-09 17:33:48,258 - INFO livekit.agents - registered worker {"id": "AW_xxxWY4", "region": "Germany", "protocol": 15, "node_id": "NC_xxxF3R"}
2024-11-09 17:33:48,259 - INFO livekit.agents - connecting to room tpapaj-room 
2024-11-09 17:33:48,526 - INFO livekit.agents - received job request {"job_id": "AJ_xxxiSW", "dispatch_id": "", "room_name": "tpapaj-room", "agent_name": "", "resuming": false}

Sometimes on startup worker receives two job requests:

2024-11-09 17:34:15,144 - INFO livekit.agents - starting worker {"version": "0.10.1", "rtc-version": "0.18.0"}
2024-11-09 17:34:15,505 - INFO livekit.agents - registered worker {"id": "AW_yxxxWiS", "region": "Germany", "protocol": 15, "node_id": "NC_xxx39j"}
2024-11-09 17:34:15,507 - INFO livekit.agents - connecting to room tpapaj-room 
2024-11-09 17:34:16,473 - INFO livekit.agents - received job request {"job_id": "AJ_xxxvAt", "dispatch_id": "", "room_name": "tpapaj-room", "agent_name": "", "resuming": false}
2024-11-09 17:34:16,581 - INFO livekit.agents - received job request {"job_id": "AJ_xxxPpE", "dispatch_id": "", "room_name": "tpapaj-room", "agent_name": "", "resuming": false}

This causes application to create two agents(entrypoint function is called twice) who then start talk to each other in a room. As you can see, received job requests have different ids(I masked parts of ids with xxx strings, just in case).
It looks like it has tendency to create two agents when --room argument uses a room name that was not used for a while and restarting the worker with the same room usually works correctly and creates a single agent.

I expected to see just one job request being sent to the worker.

It seems to be similar issue to #759 but it is claimed there that the problem was fixed, but I still see the problem.
I tried livekit-agent versions 0.10.1, 0.10.2, 0.11.1 without success.

Current livekit packages in pip freeze:

livekit==0.18.0
livekit-agents==0.11.1
livekit-api==0.7.1
livekit-plugins-elevenlabs==0.7.7
livekit-plugins-openai==0.10.5
livekit-plugins-silero==0.7.3
livekit-protocol==0.6.0
@tpapaj tpapaj added the bug Something isn't working label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant