wonderful-wolf-51568
11/21/2025, 10:56 AMtall-airline-16756
11/21/2025, 10:56 AMtall-airline-16756
11/21/2025, 10:56 AMmetadata (job metadata).
• The agent’s entrypoint (@rtc_session / job handler) reads ctx.job.metadata and configures behavior based on that data.
2) Why this works
• Dispatch rule metadata is static and cannot be changed at runtime.
• Webhooks are notifications; they let you run logic but do not directly modify an already-dispatched agent.
• Passing metadata in CreateAgentDispatchRequest ensures the agent receives dynamic context before it starts.
3) Minimal example (conceptual)
• Webhook handler:
a. Receive webhook with caller info.
b. Lookup customer segment / required behavior.
c. Call CreateAgentDispatchRequest with metadata containing caller attributes.
• Agent entrypoint:
◦ Read ctx.job.metadata, then set STT/LLM/tools/initial context or routing behavior accordingly before starting session.
4) Optional alternatives
• Use participant attributes to surface caller info into the room and let the agent read those attributes in its entrypoint — but you still need to delay or control dispatch so the agent sees the updated attributes.
• If immediate auto-dispatch is required by SIP flow, consider adjusting the SIP workflow to pause dispatch until your backend returns the desired metadata and triggers the explicit dispatch.
If you want, tell me:
• Which webhook event you receive for inbound calls (e.g., participant_joined or room_started), and
• Whether your current SIP setup auto-dispatches immediately
I’ll give a concise example tailored to your webhook event and language (Node/Python).
Sources: Agents telephony integration | LiveKit Docs | Webhooks | LiveKit docs | SIP participant | LiveKit docs | Agent dispatch | LiveKit docs | Job lifecycle | LiveKit docs