livekit / agents

Build real-time multimodal AI applications 🤖🎙️📹
https://docs.livekit.io/agents
Apache License 2.0
1.16k stars 230 forks source link

Joining all existing rooms #518

Open leejiliang opened 2 months ago

leejiliang commented 2 months ago

When I started the Agent Worker, the current situation will only be added to the room created after that. I have a lot of already active rooms. I have no other way to trigger the addition of Agent except for re -creation. The only thing I can refer to the document can refer to : Python my_Agent.py Connect-ROOM , but this operation can only be processed before I start agent and can only handle one room. Did I miss what I read the document? Thank you for answering.

agent 0.8.0. example : simple-color livekit: 1.6.2

keepingitneil commented 2 months ago

If your purpose for having a lot of rooms is for prewarming/setup - we've introduced a prewam_fnc in the WorkerOptions

If your issue is that agents are leaving the room and you have no way of adding them back, you can use our livekit-api package to delete the room upon agent disconnection. After doing this, re-joining the same "room" name will trigger an agent rejoin. You can also set departureTimeout and emptyTimeout on your rooms to reduce these situations

leejiliang commented 2 months ago

My situation is more like the second situation described, but I can't turn off a room in an active state. I hope that after I start a worker process, I can traverse the existing rooms, and then join an agent as the participant, I read the code of the livekit server. When the room was created, I started a goroutine to process the LaunchJob function. I did not find a similar function in SDK-GO. Does the official provide this API in the Client SDK or Server SDK?

leejiliang commented 1 month ago

Finally, by modifying the source code of the service side, through the expansion of RoomService.UpdateroommetAdata, it triggers the agent to add the room by updating the metadata of the room. But my logic is achieved through hard coding.

leejiliang commented 1 month ago

livekit 1.7.2 has support it , https://github.com/livekit/livekit/pull/2919.

davidzhao commented 1 month ago

yes, in a future, you'll be able to create manual dispatches for agents.