aloof-scooter-47164
12/16/2025, 1:16 AMtall-airline-16756
12/16/2025, 1:16 AMtall-airline-16756
12/16/2025, 1:16 AM@server.rtc_session()
async def my_agent(ctx: JobContext):
# read room metadata
room_metadata = ctx.room.metadata
print(f"Room metadata: {room_metadata}")
# optional: connect to participate
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
Node.js / TypeScript
export default defineAgent({
entry: async (ctx: JobContext) => {
// read room metadata
const roomMetadata = ctx.room.metadata;
console.log(`Room metadata: ${roomMetadata}`);
// optional: connect to participate
await ctx.connect(undefined, AutoSubscribe.AUDIO_ONLY);
},
});
Key points
• Access the metadata property on the ctx.room (rtc.Room) provided to the agent entrypoint.
• Metadata is a string and has a 64 KiB size limit.
• If you need to react to changes, listen for the RoomMetadataChanged event.
• Room metadata is set via server APIs (e.g., CreateRoom / UpdateRoomMetadata); agents/participants can't directly change it without appropriate permissions.
Would you like an example that parses JSON metadata or code showing how to handle the RoomMetadataChanged event?
Sources: Room metadata | LiveKit docs