Alexander
04/19/2026, 4:34 PMAI Evy
04/19/2026, 4:34 PMAI Evy
04/19/2026, 4:34 PMretell_llm_dynamic_variables when making outbound calls [(2) ]() or return it from your inbound webhook [(1) ]() .
2. Implement custom logic using one of these methods:
- **Custom function/tool**: Create a custom tool that queries your database or API to look up the closest location based on the ZIP code, then returns that information to the agent
- **Pre-process before the call**: Query your system before initiating the call, then pass the closest location information as dynamic variables
3. Use the location data in your agent's prompt or for call transfers. For example, if you need to transfer to different locations, you can use a dynamic variable like {{transfer_number}} in the Transfer Call tool [(1) ]() [(3) ]() .
The dynamic variables you set can be used throughout your agent configuration - in prompts, begin messages, tool descriptions, and transfer destinations [(1) ]() .
**AI Evy
04/19/2026, 4:34 PMAI Evy
04/19/2026, 4:34 PMAlexander
04/19/2026, 4:36 PMAI Evy
04/19/2026, 4:36 PMAI Evy
04/19/2026, 4:36 PM{{zip_code}}) , the LLM can see this information in the conversation context and may be using its general knowledge to make educated guesses about geographic proximity . However, this approach isn't reliable or accurate since:
- The LLM doesn't have access to your actual location database
- It's making assumptions based on general geographic knowledge
- Results may be inconsistent or incorrect
For reliable location routing, you should implement explicit logic using either:
- A Custom Function that queries your location database with the ZIP code and returns the closest location
- Code Tool to perform the ZIP-to-location lookup [(2) ]()
- Pre-processing the ZIP code before the call starts and passing the result as a dynamic variable [(1) ]()
The fact that it "works most of the time" suggests the LLM is inferring rather than using a deterministic system, which could lead to errors.AI Evy
04/19/2026, 4:36 PMAI Evy
04/19/2026, 4:36 PM