how to connect to a room using agent playground?
# ask-ai
w
how to connect to a room using agent playground?
t
Thanks for reaching out, Sunil. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to connect to a room using the Agent Playground in LiveKit, here’s a simple way to do it: 1. Manual Connection (Token Connect): • First, open up the Agent Playground interface. • Head over to the Manual tab. • Pop in your LiveKit server URL (something like
wss://your-project.livekit.cloud
) in the URL field. • Then, add a valid access token in the token field. • Hit Connect and you’re good to go! 2. Using LiveKit Cloud: • If you’ve got Cloud enabled, just pick the LiveKit Cloud tab. • Sign in and select your project. • The playground will take care of filling in the URL and generating a token for you automatically. 3. Prerequisites: • Make sure your agent worker is up and running with the right environment variables set: ◦
LIVEKIT_URL
◦
LIVEKIT_API_KEY
◦
LIVEKIT_API_SECRET
◦ And any other keys you might need, like
OPENAI_API_KEY
. • Start the agent by running:
Copy code
node my_agent.js start
Or if you’re developing, use:
Copy code
node my_agent.js dev
4. Hosted Playground: • Feel free to try out the hosted version if you want to test things quickly. Once you’re connected, your agent will join the room and can start interacting through audio, video, or chat. If you hit any bumps or have questions, just let me know—I’m here to help! Sources: README.md | agents/src/job.ts | LiveKit Agents
w
how to create an access token for manual connect?
t
Hey there! To create an access token for manual connection in LiveKit, you’ve got a few easy options: 1. Using the LiveKit CLI:
Copy code
lk token create \
  --api-key <project_key> --api-secret <project_secret> \
  --join --room <room_name> --identity <user_identity> \
  --valid-for 24h
Just swap out
<project_key>
,
<project_secret>
,
<room_name>
, and
<user_identity>
with your real info. This will give you a JWT token that’s good for 24 hours. 2. Using a Server SDK (like Node.js):
Copy code
import { AccessToken, VideoGrant } from 'livekit-server-sdk';

function createParticipantToken(identity, roomName) {
  const at = new AccessToken('API_KEY', 'API_SECRET', {
    identity,
    ttl: '15m', // token valid for 15 minutes
  });

  const grant = {
    room: roomName,
    roomJoin: true,
    canPublish: true,
    canSubscribe: true,
    canPublishData: true,
  };

  at.addGrant(grant);
  return at.toJwt(); // returns signed JWT token
}
This one creates a token that lets your user join a room, publish audio/video, and subscribe to streams — pretty handy! 3. Using LiveKit Dashboard: If you’re on LiveKit Cloud, you can easily generate tokens right from your project dashboard over at cloud.livekit.io. If you want a hand with any of these options or have questions, just let me know — I’m here to help! Sources: Transcription Applications | livekit/livekit_composite | DeepWiki | LiveKit CLI Setup | LiveKit Docs | TEMPLATE.md | packages/livekit-server-sdk/src/AccessToken.ts | app/api/token/route.ts
w
how do I create tokens on livekit dashboard? explain in detail and step by step
t
Hey there! The knowledge base doesn’t have exact steps for creating tokens directly through the LiveKit Dashboard. Are you asking about a specific process in the LiveKit Cloud Dashboard’s UI, or are you looking for help with the backend implementation? Let me know so I can guide you better! Sources: LiveKit CLI | livekit/livekit_composite | DeepWiki | Generating tokens | LiveKit Docs | Authentication | LiveKit Docs
w
lk isnt recognized as a cmdlet. how to install lk?
t
Hey there! Ready to get the LiveKit CLI (
lk
) up and running? Just follow the steps below based on your operating system, and you'll be all set in no time: For macOS: • Simply install it using Homebrew:
Copy code
brew install livekit-cli
For Linux: • Run this command to download and install:
Copy code
curl -sSL https://get.livekit.io/cli | bash
If you prefer, you can also grab a precompiled binary from the latest release page. For Windows: • Go ahead and install using winget:
Copy code
winget install LiveKit.LiveKitCLI
Or, if you like, download a precompiled binary from the latest release page. Want to build from Source? • Just clone the repository and build it with Go:
Copy code
git clone https://github.com/livekit/livekit-cli
make install
Quick heads up: make sure Git LFS is installed since it’s needed for the embedded video resources. Once you’ve got it installed, don’t forget to authenticate with your LiveKit Cloud account by running:
Copy code
lk cloud auth
This will set up your project credentials so using the CLI is a breeze. If you hit any snags or have questions, just give me a shout—I’m here to help! Sources: cmd/lk/app.go | LiveKit CLI | livekit/livekit_composite | DeepWiki | LiveKit CLI Setup | LiveKit Docs | CLI Setup | LiveKit Docs