steep-balloon-41261
08/01/2025, 9:31 AMtall-airline-16756
08/01/2025, 9:31 AMtall-airline-16756
08/01/2025, 9:31 AMlocal_participant property of a Room before successfully connecting to LiveKit. To resolve this, ensure the following steps:
1. Call room.connect() before accessing room.local_participant.
2. Await the connection before proceeding.
3. Only access the local participant after the connection is successfully established.
Here is an example of how to do this correctly:
async def entrypoint(ctx: JobContext):
# Connect to the room first
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
# Now you can safely access the local participant
local_participant = ctx.room.local_participant
await local_participant.publish_data("hello world")
# You can also iterate through remote participants
for rp in ctx.room.remote_participants.values():
print(rp.identity)
Ensure that you call and await room.connect() before interacting with the room's participants. Let me know if you need further assistance!
Sources: livekit-rtc/livekit/rtc/room.pytall-airline-16756
08/01/2025, 9:33 AM.env.local file with this content:`LIVEKIT_API_KEY=YOUR_API_KEY
LIVEKIT_API_SECRET=YOUR_API_SECRET
NEXT_PUBLIC_LIVEKIT_URL=wss://YOUR_LIVEKIT_URL`Just swap out the placeholders with your actual LiveKit API key, secret, and server URL.
3. Run Your Agent:
Start your agent in development mode like this:This will connect your agent right to the LiveKit server.
◦ If you’re using Python, run:`python agent.py dev`
◦ If you’re on Node.js, run:`node my_agent.js dev`
1. Open the Playground:
Launch the playground in your browser, and if it asks, just enter your LiveKit server URL and access token.
2. Join a Room:
Use the playground interface to hop into a LiveKit room. Your agent will join automatically and be ready to chat!
If you hit any bumps or want a hand with anything, just let me know—I’m here to help!
Sources: Agents Playground | LiveKit Docs | Voice AI quickstart | LiveKit Docs | README.md | web/.env.sampletall-airline-16756
08/01/2025, 9:35 AM