Instead of playing an IVR menu (“Press 1 for billing, press 2 for support”), this recipe lets the caller state their need in natural language and routes them based on what they said. The LLM extracts intent; the function handles the routing deterministically.Documentation Index
Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
Use this file to discover all available pages before exploring further.
When to use this
Use this pattern when:- Replacing a traditional IVR or phone tree
- You have multiple specialist queues and want to route callers correctly first time
- You want to capture the caller’s intent in
conv.stateto brief the receiving agent
The complete pattern
Routing flow
Briefing the receiving agent
Therouting_reason stored in conv.state can be passed to your CTI or CRM via a webhook on call transfer. This means the agent answering the call already knows why the caller is calling — reducing “Can you tell me again what you need?” moments.
Handling caller corrections
Callers sometimes change their mind or correct the LLM’s initial interpretation. Make the routing function re-callable by not usingflow.goto_step() — stay in the current context so the LLM can re-route if the caller says “actually, it’s a billing question”:
Key decisions
Why pass `reason` as a parameter?
Why pass `reason` as a parameter?
The LLM captures the caller’s exact words (paraphrased) in
reason. This is more useful than just intent because it gives the receiving agent context about why the caller chose this queue — not just which queue they were sent to.Why fall back to general_enquiry instead of failing?
Why fall back to general_enquiry instead of failing?
An unknown intent should never cause the call to fail or loop. Routing to general ensures the caller always reaches a human who can handle any edge case.
Why use utterance + handoff together?
Why use utterance + handoff together?
Using
utterance gives the caller a natural transition message before the transfer. Without it, the call transfers silently, which feels like a dropped call.Check your understanding
← Caller ID validation
Previous recipe
Back to Recipes
All recipes

