handsome-easter-5670
06/27/2025, 6:17 PMtall-airline-16756
06/27/2025, 6:17 PMtall-airline-16756
06/27/2025, 6:17 PMMetadata()
function on the Room object. For example, in the Go SDK, the Room struct has a method:`func (r *Room) Metadata() string`
⢠To receive updates when room metadata changes, you can handle the RoomMetadataChanged
event. This allows your application to be notified when the metadata is updated.
Please note that while all participants can access room metadata, it can only be set using server APIs, specifically the CreateRoom and UpdateRoomMetadata APIs.
Sources: lksdk package - github.com/livekit/server-sdk-go/v2 - Go Packages | Room metadata | LiveKit Docs | Room metadata | LiveKit Docshandsome-easter-5670
06/27/2025, 6:24 PMtall-airline-16756
06/27/2025, 6:24 PMimport json
async def entrypoint(ctx: JobContext):
metadata = json.loads(ctx.job.metadata)
user_id = metadata["user_id"]
user_name = metadata["user_name"]
user_phone = metadata["user_phone"]
# ...
Pro tip: I recommend using JSON to structure your metadata. It's a great way to include user information, specific job parameters, or any other custom data you want your agent to know about. Pretty cool, right? š This approach gives you tons of flexibility in how you pass information around. Sources: Job lifecycle | LiveKit Docshandsome-easter-5670
06/27/2025, 6:24 PMtall-airline-16756
06/27/2025, 6:25 PMawait lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name=agent_name, room=room_name, metadata='{"user_id": "12345"}'
)
)
Cool thing is, this metadata gets picked up right in the job's entrypoint. While the documentation doesn't specifically call out frontend applications sending metadata, it's totally doable if your frontend is set up to make these API calls. Pretty neat, right? š Just wanted to make sure you know all the flexible ways you can pass along extra information when you're working with dispatches! Sources: Job lifecycle | LiveKit Docs | Agent dispatch | LiveKit Docs