Hello LiveKit AI, Help me with 1 command which giv...
# ask-ai
a
Hello LiveKit AI, Help me with 1 command which gives me active participants ongoing calls on a specific server?
t
Thanks for reaching out, Hiren. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To see who’s actively participating in ongoing calls on a specific server, you can use the LiveKit CLI with this command:
Copy code
lk room participants list <room_name>
If you want to target a particular server, you’ve got a few easy options to set that up: 1. Environment Variables:
Copy code
export LIVEKIT_URL=<wss://your-server.livekit.cloud>
export LIVEKIT_API_KEY=your-api-key
export LIVEKIT_API_SECRET=your-api-secret

lk room participants list <room_name>
2. CLI Flags:
Copy code
lk room participants list <room_name> \
  --url <wss://your-server.livekit.cloud> \
  --api-key your-api-key \
  --api-secret your-api-secret
3. Project Configuration:
Copy code
lk project add myserver <wss://your-server.livekit.cloud> your-api-key your-api-secret
lk project use myserver
lk room participants list <room_name>
This will give you detailed info about each participant, like their identity and connection status. If you have any questions or want a hand with anything else, just let me know! Sources: packages/livekit-server-sdk/src/RoomServiceClient.ts | src/main/kotlin/io/livekit/server/RoomService.kt | telephony/sip_lifecycle.py
a
what If I dont even know the room name?? I just want to get the list of participants OR say list of rooms with participants in it..
t
If you’re not sure about the room name, no worries! You can easily see all the active rooms along with how many participants are in each by running this command:
Copy code
lk room list
This will show you all the active rooms with details like: • Room ID • Room Name • Number of Participants • Number of Publishers If you’d prefer to work with the data programmatically, you can get everything in JSON format by using:
Copy code
lk room list --json
And if you want to dig a bit deeper to see who’s in each room, just list the rooms first, then check participants for any room with:
Copy code
lk room participants list <room_name>
Feel free to reach out if you have any questions or need a hand with anything else! Sources: autocomplete/fish_autocomplete
a
Okay, Suppose there's an existing room, where already a human participant and an AI agent is there, I want another user to be added in an existing room who can also see the chat_ctx and control VoicePipelineAgent conversation with human user
t
To add another user to an existing room and let them access the chat context and control the VoicePipelineAgent conversation, here’s a friendly step-by-step guide for you: 1. Generate an Access Token for the User: You’ll want to create a token that gives them permission to join the room, publish audio, publish data, and subscribe:
Copy code
// Example in JavaScript
const grant = {
  room: roomName,
  roomJoin: true,
  canPublish: true,
  canPublishData: true,
  canSubscribe: true,
};
const at = new AccessToken('LIVEKIT_API_KEY', 'LIVEKIT_API_SECRET', { identity: 'user_identity' });
at.addGrant(grant);
const token = at.toJwt();
2. Initialize the VoicePipelineAgent: Set up the agent with components like VAD, STT, LLM, and TTS, and configure the chat context to make it super helpful:
Copy code
const agent = new pipeline.VoicePipelineAgent(vad, stt, llm, tts, {
  chatCtx: new llm.ChatContext().append({
    role: llm.ChatRole.SYSTEM,
    text: 'You are a helpful assistant.',
  }),
  allowInterruptions: true,
});
3. Start the Agent: Connect the agent to the room and participant like this:
Copy code
const participant = await ctx.waitForParticipant('participant_identity');
agent.start(ctx.room, participant);
4. Control the Conversation: Use the
say
method to have the agent speak and smoothly manage the chat:
Copy code
await agent.say('Hello, how can I help you today?', true);
If you want me to walk you through any of these steps or if something’s unclear, just let me know—I’m here to help! Sources: complex-agents/nova-sonic/nova-sonic-form-agent/app/api/connection-details/... | Agents 0.x migration guide | LiveKit Docs | examples/src/outbound.ts | VoicePipelineAgent | LiveKit Agents