When we pass in metadata into an Agent dispatch - ...
# ask-ai
e
When we pass in metadata into an Agent dispatch - where abouts is this metadata located? RuntimeContext or JobContext?
Copy code
const createRoomOptions: any = {
          name: roomName,
          emptyTimeout: 300, // 5 minutes
          maxParticipants: 2,
          agents: [
            {
              agentName: agentName,
              metadata: JSON.stringify({ workflowId: workflowId })
            }
          ]
        };
t
Thanks for reaching out, Arthur. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — good question. The metadata you pass into the agent dispatch is stored on the JobContext. You can access it as
ctx.job.metadata
(it's typically a JSON string), for example:
Copy code
export default defineAgent({
  entry: async (ctx: JobContext) => {
    const metadata = JSON.parse(ctx.job.metadata);
    const workflowId = metadata.workflowId;
    // ...
  },
});
If you want, tell me which runtime (Node/Python) you're using and I can show the exact snippet for that language. Sources: Agent dispatch | LiveKit docs | Job lifecycle | LiveKit docs | Agents (Node.js) | livekit/livekit_composite | DeepWiki