https://retellai.com/?utm_source=discord&utm_medium=seo logo
I’m facing an issue with the "retell_llm_dynamic_v...
# ❓・ai-evy-support
n
@AI Evy I’m facing an issue with the "retell_llm_dynamic_variables" parameter. When passing it through the API and checking the condition using a logic split node (e.g., {{facility}} == "Hospital"), the condition is not working as expected — it always goes into the Else branch. However, the same condition works correctly when tested directly through the dashboard. Here’s the payload I’m sending: "retell_llm_dynamic_variables": { "case_id": "1234", "facility": "Hospital", "name": "John Doe" }
a
Thanks for tagging me @nikhilmishra_53806. I'll look through relevant sources and get back to you shortly.
### Answer This is a known issue with dynamic variables in logic split nodes. The problem occurs because when Retell starts a call, your
retell_llm_dynamic_variables
may not yet be "hydrated" (fully loaded into memory for the flow engine) [(1) ]() . If a Split node tries to read the variable too early, it sees null/empty and takes the wrong path . The solution is to implement a "hydration guard" - a condition that checks if the variable exists before comparing its value . Instead of just checking
{{facility}} == "Hospital"
, you should first verify the variable is loaded:
Copy code
facility exists
or
Copy code
facility != ""
This ensures "the variable is loaded with something" before you compare it to "Hospital" . If you need to handle cases where the variable isn't loaded yet, you can implement 1-2 retries using a counter so it loops back until the variable loads . If after a couple tries it's still empty, you can fall back gracefully by asking the caller . Your payload structure looks correct - dynamic variables should be passed as strings in the
retell_llm_dynamic_variables
object [(2) ]() , [(1) ]() . The issue is timing-related rather than format-related.
​ To learn more, see the sources I considered: [[1] Logic Split Node Equation Not Working As Expected](https://discord.com/channels/1186424376300679209/1406310248691667125) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.