how can I pass metadata from the frontend to the l...
# ask-ai
c
how can I pass metadata from the frontend to the livekit agent?
g
To pass metadata from the frontend to a LiveKit agent, you can use participant attributes or room metadata. When creating an access token for a participant, you can include metadata in the token. This metadata can then be accessed by the agent once the participant connects to the room. For example, you can set metadata in the access token like this:
Copy code
const token = new AccessToken(apiKey, apiSecret, {
  identity: "user_identity",
  metadata: JSON.stringify({ key: "value" }),
});
This metadata will be available to the agent when the participant connects. Ensure that the agent is set up to listen for metadata changes or access the metadata upon connection. Would you like more details on how to implement this in your specific setup? Sources: - Participant attributes and metadata 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.