little-king-41579
03/13/2026, 8:16 PMtall-airline-16756
03/13/2026, 8:17 PMtall-airline-16756
03/13/2026, 8:17 PMctx.job.metadata and parse it (it’s a JSON string). Below are concise examples for Python and Node.js.
Python example
import json
from livekit.agents import JobContext
async def entrypoint(ctx: JobContext):
# metadata is a JSON string on the job object
metadata = json.loads(ctx.job.metadata)
call_id = metadata["call_id"]
from_number = metadata["from_number"]
contact_name = metadata["contact_name"]
call_direction = metadata.get("call_direction")
phone_number_id = metadata.get("phone_number_id")
# use these values as needed
print(f"Call ID: {call_id}, From: {from_number}, Contact: {contact_name}")
Node.js / TypeScript example
import type { JobContext } from '@livekit/agents';
export default {
entry: async (ctx: JobContext) => {
// metadata is a JSON string on the job object
const metadata = JSON.parse(ctx.job.metadata);
const callId = metadata.call_id;
const fromNumber = metadata.from_number;
const contactName = metadata.contact_name;
const callDirection = metadata.call_direction;
const phoneNumberId = metadata.phone_number_id;
console.log(`Call ID: ${callId}, From: ${fromNumber}, Contact: ${contactName}`);
},
};
Notes and quick tips
• The metadata is sent as a string, so parsing is required (json.loads / JSON.parse).
• Use .get() (Python) or optional chaining / checks in JS if some fields may be missing.
• If you want to pass structured objects rather than strings, you can still stringify before dispatch and parse inside the entrypoint as shown.
If you’d like, tell me:
• which language (Python or Node) you’re using,
• and paste the exact entrypoint signature you have — I’ll give a ready-to-drop-in snippet for your agent code. Sources: Job lifecycle | LiveKit Documentation | Survey Calling Agent | LiveKit Documentation | Agent dispatch | LiveKit Documentation | sip | livekit/livekit_composite | DeepWiki