steep-balloon-41261
10/18/2025, 2:20 PMtall-airline-16756
10/18/2025, 2:21 PMtall-airline-16756
10/18/2025, 2:21 PMpython myagent.py dev
This mode is really handy because it enables hot reloading, letting you test changes locally while your production agent keeps running. It’s a great way to develop and test without any interruptions to your service.
Sources: TEMPLATE.md | README.md | README.mdbreezy-art-50071
10/18/2025, 2:25 PMtall-airline-16756
10/18/2025, 2:27 PM# Development Environment (.env.dev)
LIVEKIT_URL=wss://your-dev-project.livekit.cloud
LIVEKIT_API_KEY=your_dev_api_key
LIVEKIT_API_SECRET=your_dev_api_secret
• Run your local agent in development mode: Simply start your agent locally with this command:
python myagent.py dev
• Test in a sandbox environment: You can also use the LiveKit dashboard’s sandbox section to safely test your agent with the same project credentials, without touching production.
If you'd like, I’m here to walk you through setting up a separate LiveKit project or configuring your environment for isolated testing—just let me know!breezy-art-50071
10/18/2025, 2:42 PMtall-airline-16756
10/18/2025, 2:44 PMasync def job_request_cb(job_request: agents.JobRequest):
await job_request.accept(
TextStreamingAgent.create,
identity="text-streaming-agent",
name="Text Streaming Agent",
)
• Agent Dispatch: If you want more explicit control over which agents join specific rooms, using named agents works great. For example:
dispatch = await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="test-agent",
room=room_name,
metadata="my_metadata"
)
)
• Access Tokens: Another way is setting the identity through access tokens, which is especially useful for avatar sessions or participant-specific setups:
token = api.AccessToken(api_key, api_secret)
.with_identity("identity")
.with_grants(api.VideoGrants(room_join=True, room="my-room"))
.to_jwt()
• CLI Configuration: And if you're working with CLI-based deployments, you can configure the identity in a TOML file like this:
[agent]
id = "AG_xxxxxxxxxxxxx"
If you'd like, I can walk you through any of these methods in more detail—just let me know which one sounds best for you!
Sources: server/agent.py | examples/agent_dispatch.py | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | ivr-nagivator/flask_livekit/extension.py | examples/other/transcription/multi-user-transcriber.pybreezy-art-50071
10/18/2025, 2:46 PMagent-<some-random-string?tall-airline-16756
10/18/2025, 2:48 PMagent-<random-string> happens because LiveKit wants to make sure every participant in a room has a unique identity. So, if multiple agents try to join with the same identity (like "agent"), LiveKit kindly adds a random string to keep things unique and avoid any mix-ups.
If you'd like to have more control over the identities and prevent this from happening, here are a couple of friendly tips:
• Generate unique identities: Try creating a unique identifier for each agent instance before you generate the access token.
• Set the identity explicitly: When you create the access token, you can specify a unique identity for the agent. Here's a little example:
token = api.AccessToken(api_key, api_secret)
.with_identity("my-unique-agent")
.with_grants(api.VideoGrants(room_join=True, room="my-room"))
.to_jwt()
If you’d like, I’m here to help you step-by-step with implementing this—just let me know!
Sources: livekit-agents/livekit/agents/inference/_utils.py | Rooms, participants, and tracks | LiveKit Docs | plugins/anam/src/avatar.ts | src/pages/api/token.ts | app/api/connection-details/route.tsbreezy-art-50071
10/18/2025, 2:55 PMtall-airline-16756
10/18/2025, 2:55 PMListParticipants method. Here’s a friendly example using the Python SDK:
from livekit import api
from livekit.protocol import room as room_proto
# Initialize the LiveKit API
lkapi = api.LiveKitAPI()
# Create the request
list_request = room_proto.ListParticipantsRequest(room="your-room-name")
# List participants
participants_response = await lkapi.room.list_participants(list_request)
# Access the participants
for participant in participants_response.participants:
print(f"Identity: {participant.identity}")
print(f"Name: {participant.name}")
print(f"State: {participant.state}")
print(f"Joined at: {participant.joined_at}")
print(f"Metadata: {participant.metadata}")
print(f"SID: {participant.sid}")
Just a quick note: this method needs room_admin permission, so please make sure your API token has the right grants. If you’d like, I’m here to help you with any part of this—just let me know!
Sources: livekit-api/livekit/api/room_service.py | mcp/server.py | livekit-api/src/services/room.rs | Managing participants | LiveKit Docsbreezy-art-50071
10/18/2025, 3:00 PMbreezy-art-50071
10/18/2025, 3:01 PMjwt_token = token.to_jwt()
room = rtc.Room()
await room.connect(LIVEKIT_URL, jwt_token)
print(f"Connected to LiveKit room: {ROOM_NAME}")
lkapi = api.LiveKitAPI(LIVEKIT_URL, API_KEY, API_SECRET)
# Create the request
list_request = room_proto.ListParticipantsRequest(room=ROOM_NAME)
# List participants
participants_response = await lkapi.room.list_participants(list_request)tall-airline-16756
10/18/2025, 3:02 PMfrom livekit.agents import get_job_context
# Get the agent's identity from the job context
job_ctx = get_job_context()
agent_identity = job_ctx.token_claims().identity
print(f"Agent identity: {agent_identity}")
• Using the Room's Local Participant:
# Fallback method using the room's local participant
agent_identity = room.local_participant.identity
print(f"Agent identity: {agent_identity}")
Also, if you want to keep an eye on everyone joining the room and spot agents specifically, you can check their kind field like this:
async def on_participant_join(job_ctx, participant):
print(f"Participant joined: {participant.identity}")
if participant.kind == ParticipantKind.AGENT:
print(f"Agent joined with identity: {participant.identity}")
If you'd like, I’m here to help you with the next steps or any other questions you might have. Just let me know!
Sources: livekit-plugins/livekit-plugins-anam/livekit/plugins/anam/avatar.py | Job lifecycle | LiveKit Docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | agents/src/job.ts | Rooms, participants, and tracks | LiveKit Docsbreezy-art-50071
10/18/2025, 3:03 PMbreezy-art-50071
10/18/2025, 3:03 PMtall-airline-16756
10/18/2025, 3:04 PM