When I am testing using my terminal, I connect to ...
# ask-ai
m
When I am testing using my terminal, I connect to a particular self-hosted agent. When another teammate connects to the same project and runs an agent, they get connected to the same session as well. Why does this happen? We are currently on the base plan.
t
Thanks for reaching out, Varun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Can you check if your project is set up to use the same room or session ID for all connections? That might be why multiple users are ending up in the same session. Let me know what you find! Sources: Inside a session | LiveKit Docs | Infrastructure & Deployment | livekit/livekit_composite | DeepWiki | Voice Assistants | livekit/livekit_composite | DeepWiki | agent/main.py | livekit-plugins/livekit-plugins-anam/livekit/plugins/anam/api.py
m
How do I do that?
t
Hey there! If you want to check whether your project is set up to use the same room or session ID for all connections, here’s a simple way to do it: 1. First, make sure all participants are joining the same room name. Usually, this is specified in the JWT token used for authentication. 2. Next, you can use the LiveKit SDK to grab the Room SID (Session ID) once connected. For example, with the Node SDK, you’d use the
getSid()
method like this:
Copy code
const room = new Room();
await room.connect(url, token);
console.log('Room SID:', await room.getSid());
Then, just compare the Room SIDs across different connections. If they match, that means the same session is being reused. If you’d like to make sure each session is unique, try adding something like a timestamp or a UUID to the room name when you create it. Hope this helps! Sources: config-sample.yaml | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | Analytics API | LiveKit Docs | packages/livekit-rtc/src/room.ts | src/room/Room.ts
m
Thanks. How long does a self-deployed agent show up on livekit cloud after closing the terminal? We closed sessions for an agent long time back but are still seeing the agent with multiple concurrent sessions.
t
Hey there! For self-deployed agents, they should disappear from the LiveKit Cloud dashboard pretty quickly after you close the terminal or stop the agent process. If you’re still seeing the agent with multiple sessions hanging around long after closing the terminal, it might mean the agent didn’t shut down properly or some connections are sticking around. Here’s what you can try to fix it: • Make sure the agent process has completely stopped on your server or local machine. • Look out for any leftover connections or processes that might still be talking to LiveKit Cloud. • Try restarting the LiveKit Cloud dashboard so it shows the latest status. If you’re still running into issues, just let me know—I’m happy to help you sort it out! Sources: Deploying to custom environments | LiveKit Docs | Deploying to production | LiveKit Docs
m
How do I go about the second and third options?
t
Here’s a friendly guide to help you check for any lingering connections or processes and restart your LiveKit Cloud dashboard: 1. Check for lingering connections or processes: ◦ On your server or local machine, open up a process manager (like the
ps
command on Linux/Mac or Task Manager on Windows) and see if there are any running processes related to the agent. ◦ If you spot any, go ahead and terminate them using commands like
kill [PID]
on Linux/Mac or by clicking "End Task" on Windows. ◦ Also, double-check that no other scripts or services are automatically restarting the agent process behind the scenes. 1. Restart the LiveKit Cloud dashboard: ◦ Try logging out of the dashboard and then logging back in to refresh everything. ◦ If things still seem off, clearing your browser cache or trying a different browser or device can often do the trick to make sure you’re seeing the latest state. If you run into any bumps or want a hand with these steps, just let me know—I’m here to help!