able-jackal-19719
08/26/2025, 3:41 PMtall-airline-16756
08/26/2025, 3:41 PMtall-airline-16756
08/26/2025, 3:42 PMawait req.accept(
name="agent", # Display name
identity="identity" # Unique identifier
)
So, to wrap it up: use name when you want something friendly and readable for people, and identity when you need a unique, programmatic ID. Hope that clears things up!
Sources: Anatomy of an Agent | LiveKit Docs | Worker options | LiveKit Docs | src/components/playground/Playground.tsx | Rooms, participants, and tracks | LiveKit Docsable-jackal-19719
08/26/2025, 3:43 PMif __name__ == "__main__":
agents.cli.run_app(
agents.WorkerOptions(
entrypoint_fnc=entrypoint,
# prewarm_fnc=prewarm,
agent_name=f"latifah-english",
)
)tall-airline-16756
08/26/2025, 3:44 PMagent_name you set in the code is actually an attribute of the agent worker or job, not the participant itself. That’s why it doesn’t show up in the participant list. Instead, agents are identified in the participant list by their kind field, which will be set to AGENT.
The agent_name mainly comes into play during the dispatch process to decide which agent gets assigned to a room, but it’s not visible as a public field in the participant list. If you want to keep track of which agent with a certain agent_name joined a room, you can match this info using backend logs, the agent dispatch API, or by checking out job metadata through the server SDKs.
If you have any more questions or need a hand with this, just let me know—I’m here to help!
Sources: Core API primitives | LiveKit Docs | Dispatching agents | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs | livekit-protocol/src/livekit.rs | JobRequest | LiveKit Agentsable-jackal-19719
08/26/2025, 3:44 PMtall-airline-16756
08/26/2025, 3:45 PMagent_name in LiveKit:
1. Using Job Metadata:
You can add metadata during the dispatch process and then access it in the agent's JobContext. Here's a quick example:
async def entrypoint(ctx: JobContext):
logger.info(f"Job metadata: {ctx.job.metadata}")
metadata = json.loads(ctx.job.metadata)
Just set the metadata when you create a dispatch like this:
dispatch = await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="test-agent",
room="my-room",
metadata='{"user_id": "12345"}'
)
)
1. Using Backend Logs:
You can also add the agent_name to your logs using `ctx.log_context_fields`:
async def entrypoint(ctx: JobContext):
ctx.log_context_fields = {
"worker_id": ctx.worker_id,
"room_name": ctx.room.name,
"agent_name": ctx.job.agent_name,
}
These logs can then be easily reviewed with your existing logging tools.
1. Using the Agent Dispatch API:
You can query dispatch records to get the agent_name like this:
dispatches = await lkapi.agent_dispatch.list_dispatch(room_name="my-room")
for dispatch in dispatches:
print(f"Agent {dispatch.agent_name} dispatched to {dispatch.room}")
If you want me to walk you through any of these or need a hand setting them up, just let me know—I'm happy to help!
Sources: Dispatching agents | LiveKit Docs | Dispatching agents | LiveKit Docs | Agent dispatch | LiveKit Docs | Job lifecycle | LiveKit Docs | protobufs/livekit_agent_dispatch.proto