square-activity-46232
12/30/2025, 2:36 AMtall-airline-16756
12/30/2025, 2:37 AMtall-airline-16756
12/30/2025, 2:37 AMuser_name) to a LiveKit agent. The usual, recommended way is to include it in the job's metadata when you dispatch the agent. This makes the data available to the agent at startup.
How to do it (summary):
1. Add JSON to the dispatch metadata field (stringified), e.g.:
{
"user_name": "John Doe",
"user_id": "12345"
}
1. Dispatch with that metadata (example uses API or participant token with a RoomAgentDispatch):
• API dispatch: include metadata on the dispatch request.
• Participant token: add RoomAgentDispatch with metadata in the room config.
1. Read it inside the agent entrypoint:
metadata = json.loads(ctx.job.metadata)
user_name = metadata["user_name"]
Alternatives:
• Participant attributes (set on the participant and observed by the agent)
• Room metadata (shared across participants)
• In Agent Builder, reference {{metadata.user_name}} in prompts
Best practice: use job metadata for static per-user values like user_name so the agent starts with that context. Would you like a code snippet for the specific SDK/language you’re using?
Sources: Job lifecycle | LiveKit docs | Agent dispatch | LiveKit docs | External data and RAG | LiveKit docs | Context Variables | LiveKit docs | Agents and handoffs | LiveKit docs