enough-match-43171
12/15/2025, 4:57 PMtall-airline-16756
12/15/2025, 4:57 PMtall-airline-16756
12/15/2025, 4:57 PMmetadata property on a RemoteParticipant and listen for updates via the participant_metadata_changed event.
1. Simple example to read metadata after joining:
from livekit import rtc
from livekit.agents import JobContext, AutoSubscribe
@agent.rtc_session()
async def my_agent(ctx: JobContext):
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
participant = await ctx.wait_for_participant()
print("Participant metadata:", participant.metadata)
# parse JSON metadata if applicable
import json
metadata_dict = json.loads(participant.metadata) if participant.metadata else {}
print("Parsed metadata:", metadata_dict)
1. Listen for metadata changes:
@ctx.room.on("participant_metadata_changed")
def on_metadata_changed(
participant: rtc.RemoteParticipant,
old_metadata: str | None,
new_metadata: str | None
):
print(f"Metadata changed for {participant.sid}: {old_metadata} -> {new_metadata}")
Notes:
• metadata is a single string; parse it (e.g., JSON) if you stored structured data.
• Participants need the canUpdateOwnMetadata permission in their access token to update their own metadata.
• Metadata updates are synchronized across the room.
Would you like a full example agent that handles multiple participants or code to update metadata from a participant client?
Sources: Participant attributes and metadata | LiveKit docs