adamant-jelly-5173
11/18/2025, 5:35 PMtall-airline-16756
11/18/2025, 5:35 PMtall-airline-16756
11/18/2025, 5:35 PMagent.py using the following helpful methods:
• Using Metadata in Agent Dispatch: You can pass variables explicitly during agent dispatch by attaching metadata. The agent then accesses these variables via ctx.job.metadata. Here’s a simple example:
async def entrypoint(ctx: JobContext):
metadata = json.loads(ctx.job.metadata)
user_id = metadata["user_id"]
user_name = metadata["user_name"]
• Dispatch via Participant Connection: Another way is to embed agent dispatch configuration in the access token when a user joins a room. This lets you have dynamic dispatch per user with metadata.
• Access Room or Participant Data: Agents can also dynamically pull in contextual data like the room name (ctx.room.name) or participant attributes using ctx.wait_for_participant().
If you’d like, I’m here to provide more details or examples on any of these approaches—just let me know!
Sources: Agent dispatch | LiveKit Docs | Job lifecycle | LiveKit Docs | Authentication | LiveKit docs | SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | livekit-plugins/livekit-plugins-bey/livekit/plugins/bey/avatar.py