busy-breakfast-32623
09/15/2025, 6:57 AMtall-airline-16756
09/15/2025, 6:57 AMtall-airline-16756
09/15/2025, 6:58 AMbusy-breakfast-32623
09/15/2025, 6:58 AMBVCTelephony for best results
noise_cancellation=noise_cancellation.BVC(),
),
)
print("Room created:", ctx.room)
await ctx.connect()
await session.generate_reply(
instructions="start with a greeting ",
)
if name == "__main__":
agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint,num_idle_processes=2,agent_name="AI_Agent"))tall-airline-16756
09/15/2025, 6:59 AMmetadata field is a string property of a participant that can hold any data you need, and you can access it through the participant object in the agent’s JobContext.
Here’s a simple way to do it:
async def entrypoint(ctx: JobContext):
# Connect to the room
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
# Wait for the first participant to join
participant = await ctx.wait_for_participant()
# Access participant metadata
metadata = participant.metadata
print(f"Participant metadata: {metadata}")
# You can also access attributes (key-value pairs)
language = participant.attributes.get("user.language")
print(f"User language: {language}")
Also, if you'd like to respond when a participant’s metadata changes, you can set up an event listener like this:
@ctx.room.on("participant_metadata_changed")
def on_metadata_changed(p: rtc.Participant, old_metadata: str, new_metadata: str):
print(f"Participant {p.identity} metadata changed from {old_metadata} to {new_metadata}")
One more tip: you can set the initial values for metadata and attributes right in the participant’s access token. This way, they’re ready and waiting as soon as the participant joins the room.
Sources: Participant attributes and metadata | LiveKit Docs | examples/primitives/participant_entrypoint.py