https://retellai.com/?utm_source=discord&utm_medium=seo logo
I need to choose a conversational path based on if...
# ❓・ai-evy-support
a
@AI Evy I need to choose a conversational path based on if a string (numerical value) is contained in a specific list of 50 numerical values.
a
Thanks for tagging me @aitoolworx. I'll look through relevant sources and get back to you shortly.
### Answer For conditional routing based on numerical values in Retell AI, you can use conversation flows with transition conditions [(1) ]() . The API supports structured conversation flows where you can define edges with transition conditions that evaluate specific criteria . Here's how you can structure this using the conversation flow API:
Copy code
javascript
{
  "nodes": [
    {
      "id": "start",
      "type": "conversation",
      "instruction": {
        "type": "prompt",
        "text": "Greet the customer and ask how you can help them."
      },
      "edges": [
        {
          "id": "edge_1",
          "transition_condition": {
            "type": "prompt",
            "prompt": "Customer wants to book appointment"
          },
          "destination_node_id": "book_appointment"
        }
      ]
    }
  ]
}
The transition condition uses a prompt-based approach where you can define the logic for checking if the numerical value exists in your list . You would structure your prompt within the transition condition to evaluate whether the provided numerical string matches any value in your predefined list of 50 numerical values . Retell AI's conversation flow system allows you to create multiple edges from a single node, so you can set up different paths based on whether the numerical value is found in your list or not .
​ To learn more, see the sources I considered: [[1] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
I'm using the canvas, not the API
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer For conditional routing based on numerical values in the Retell AI canvas, you'll want to use a Logic Split Node [(1) ]() . This node type creates conditional branches based on variables . However, there are some important considerations when working with Logic Split Nodes and custom variables: Variable Initialization Timing Logic Split Nodes may run before variables are fully loaded into memory [(2) ]() . If your numerical value comes from a dynamic variable, you may need to add a brief conversation node before the Logic Split Node to allow variables to fully initialize . Condition Setup In the Retell flow builder, string comparison doesn't require quotes in the condition editor . For checking if a value exists in your list of 50 numerical values, you could set up multiple conditions or use a "contains" operation . Alternative Approach If you encounter issues with the Logic Split Node (as some users have reported [(2) ]() [(3) ]() ) , you can use prompt-based logic instead [(2) ]() . Add instructions in your agent prompt to check the numerical value and use LLM decision-making rather than conditional nodes . The Logic Split Node is designed to handle exactly this type of conditional branching [(1) ]() , but given the complexity of checking against 50 specific values, you might find the prompt-based approach more reliable for your use case.
​ To learn more, see the sources I considered: [[1] Node Overview](https://docs.retellai.com/build/conversation-flow/node) [[2] Logic Split Node Equation Not Working As Expected](https://discord.com/channels/1186424376300679209/1406310248691667125) [[3] Help with Logic Split Nodes (and an example of a custom variable being used would be lovely!)](https://discord.com/channels/1186424376300679209/1358825261986087126) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
if i use logic split node, would I use the contains or exists operator?
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer For your use case of checking if a numerical value is contained in a list of 50 values, you would use the CONTAINS operator [(1) ]() . The documentation shows these equation condition examples :
Copy code
- "New York, Los Angeles" CONTAINS {{user_location}}
- "New York, Los Angeles" NOT CONTAINS {{user_location}}
For your scenario, you would structure it as :
Copy code
- "value1, value2, value3, ..., value50" CONTAINS {{your_variable_name}}
The exists operator is different - it checks whether a dynamic variable is defined and has a value :
Copy code
- {{variable_name}} exists
- {{variable_name}} does not exists
So for checking if a numerical value is within your list of 50 values, CONTAINS is the correct operator to use .
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
When setting up the Configure Conditions window, where do I place the variable containing my single number and where do I enter my list of 50 numbers?
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer For the Logic Split Node Configure Conditions window, you would set it up as follows [(1) ]() : Left side (variable) : Enter your dynamic variable containing the single number using the format
{{your_variable_name}}
[(2) ]() Operator: Select "CONTAINS" Right side (list) : Enter your list of 50 numbers as a comma-separated string:
"number1, number2, number3, ..., number50"
The Logic Split Node is designed to branch out the conversation flow based on conditions, and when entering this node, the agent will immediately evaluate the conditions and branch out to the corresponding destination nodes [(1) ]() . Make sure your dynamic variable is properly set up and populated before the Logic Split Node executes [(2) ]() . As noted in community discussions, there can be timing issues where the Logic Split Node runs before variables are fully loaded into memory [(3) ]() , so you may need to ensure the variable is available when the condition is evaluated.
​ To learn more, see the sources I considered: [[1] Logic Split Node](https://docs.retellai.com/build/conversation-flow/logic-split-node) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Logic Split Node Equation Not Working As Expected](https://discord.com/channels/1186424376300679209/1406310248691667125) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
a
Wouldn't his set up be looking to see if my variable "contains" the entire list of 50?
a
### Answer You're absolutely correct! I made an error in my previous response. Looking at the CONTAINS operator documentation, the syntax should be reversed [(1) ]() : Correct setup: - Left side (list) :
"number1, number2, number3, ..., number50"
- Operator: CONTAINS - Right side (variable) :
{{your_variable_name}}
The documentation shows this example :
Copy code
"New York, Los Angeles" CONTAINS {{user_location}}
This reads as "the list contains the variable value," not "the variable contains the list." So for your use case, you want to check if your list of 50 numbers contains the single number stored in your variable. Thank you for catching that - the setup I described would indeed be checking if your single variable contains the entire list of 50 numbers, which is the opposite of what you need.
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
How exactly then should I input the list of 50 numbers in the left side? Give me an actual example so I know if i need to wrap each number in quotes or seperate the numbers with commas.
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer [(1) ]() Based on the documentation example, you would input your list of 50 numbers as a comma-separated string without individual quotes around each number : Left side input example:
Copy code
1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010
The documentation shows the format as a simple comma-separated list . The CONTAINS operator performs string comparisons and doesn't require numerical input formatting . Complete condition setup: - Left side: Your comma-separated list of 50 numbers - Operator: CONTAINS - Right side:
{{your_variable_name}}
This will check if your list contains the value stored in your dynamic variable .
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Just to be sure, are you saying I do not need to enter the list as json with outer brackets?
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer Correct - you do not need JSON formatting with outer brackets [(1) ]() . Based on the documentation, the CONTAINS operator uses simple comma-separated string format . The documentation shows this example for transition conditions :
Copy code
- {{user_location}} == "New York"
- {{user_location}} == "Los Angeles"
And for CONTAINS operations, it shows :
Copy code
"New York, Los Angeles" CONTAINS {{user_location}}
So for your list of 50 numbers, you would enter them as a plain comma-separated list without JSON brackets, quotes around individual numbers, or any special formatting . Just the raw numbers separated by commas like I showed in the previous example . The CONTAINS operator performs string comparisons and doesn't require JSON or numerical input formatting .
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
when I test this with a variable that is contained in my list of numbers, the 'else' path is chosen.
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
2. **Add a Brief Conversation Node Before the Logic Split**: This allows variables to fully initialize [(1) ]() [(2) ]() . You can make the agent transition silently by instructing it not to speak in that node [(2) ]() . 3. **Use Prompt-Based Logic Instead**: This approach works more reliably [(1) ]() . Add instructions in your agent prompt to check the variable value and use LLM decision-making rather than conditional nodes . **Important Note from Retell Support**: According to Retell staff, using dynamic variables ALONE in a logic split node is confirmed to NOT WORK at this time [(2) ]() . It requires the content of the dynamic variable to be mentioned previously in the conversation to work . The most reliable workaround is to add a conversation node before your Logic Split Node that references the dynamic variable, then transition to the Logic Split Node .
### Answer This is a common issue with Logic Split Nodes and dynamic variables [(1) ]() [(2) ]() . The problem occurs because Logic Split Nodes may run before variables are fully loaded into memory [(1) ]() . Here are the most likely causes and solutions: Variable Initialization Timing Issue The Logic Split Node can execute before your dynamic variable is "hydrated" (fully loaded) . When this happens, it sees the variable as null/empty and takes the else path . Solutions: 1. **Add a Hydration Guard**: Use an "exists" condition first to ensure the variable is loaded :
Copy code
{{your_variable_name}} exists
​ To learn more, see the sources I considered: [[1] Logic Split Node Equation Not Working As Expected](https://discord.com/channels/1186424376300679209/1406310248691667125) [[2] HELP: Dynamic Variables and the NEW Logic Split Node](https://discord.com/channels/1186424376300679209/1359881066168582194) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
for comma separated values, should there be a space after each comma?
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer You can include spaces after each comma or not—Retell AI's documentation shows both formats as valid. For example, the documentation uses:
Copy code
"New York, Los Angeles" CONTAINS {{user_location}}
This example includes a space after the comma. So, using spaces for readability is fine, but it's not required for the condition to work. Both these are acceptable: - 1001, 1002, 1003 - 1001,1002,1003 Just keep your formatting consistent throughout your list for clarity [(1) ]() .
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
which way is best?
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
### Answer Both formats—spaces after commas or no spaces—are supported by Retell AI for comma-separated lists in the Logic Split Node. The documentation shows an example with spaces ("New York, Los Angeles") , but functionally, either "1001, 1002, 1003" or "1001,1002,1003" will work. Choose the style that keeps your list most readable and stay consistent throughout your flow [(1) ]() .
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
a
Should I enclose the list of 50 numbers with quotes or brackets?
a
​ To learn more, see the sources I considered: [[1] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
### Answer You should not enclose your list of 50 numbers with quotes or brackets. Enter them as a simple comma-separated list, like this: 1001, 1002, 1003, ..., 1050 There is no need for outer quotes, brackets, or special formatting—just the numbers separated by commas. This matches the documented usage for the CONTAINS operator in Retell AI transition conditions [(1) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
a
Prior to the logic split node, I have a conversation node that confirms the variable is loaded by speaking the value. Within the logic split node, when I enter my variable {{variable}} on the right side, the condition does not work. If I simply enter the value of the variable: 12345 the condition does work.
a
Thanks for the follow-up, @aitoolworx. I'll get back to you soon.
0679209/1406310248691667125) [(3) ]() . There is no documented fix in the sources. The issue is acknowledged by Retell support and is under development for improvement (equation-based transitions) [(1) ]() [(3) ]() . Check out these potentially useful sources: - [Help with Logic Split Nodes (and an example of a custom variable being used would be lovely!) ]() - [Logic Split Node Equation Not Working As Expected]() - [HELP: Dynamic Variables and the NEW Logic Split Node]() Would you like a general answer or workaround suggestion based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Help with Logic Split Nodes (and an example of a custom variable being used would be lovely!)](https://discord.com/channels/1186424376300679209/1358825261986087126) [[2] Logic Split Node Equation Not Working As Expected](https://discord.com/channels/1186424376300679209/1406310248691667125) [[3] HELP: Dynamic Variables and the NEW Logic Split Node](https://discord.com/channels/1186424376300679209/1359881066168582194) ​
### Answer Based on the available sources, Logic Split Nodes in Retell AI can have issues evaluating conditions against dynamic variables, even when a conversation node before the split node confirms the variable is loaded and spoken out loud [(1) ]() [(2) ]() [(3) ]() . Community and support discussions confirm that Logic Split Nodes often default to the "Else" path when the right side of your condition uses a dynamic variable (e.g., {{variable}}) , while direct values (like 12345) work as expected . This is a known limitation: the Logic Split Node does not reliably match dynamic variables unless their value has been explicitly referenced in the conversation, and sometimes even then, it fails to match as intended [(1) ]() [(3) ]() . The most consistent workaround reported is to ensure the agent actually says the value out loud in the conversation node immediately before the Logic Split Node, but even then, success is inconsistent . If you are already confirming the variable is loaded and spoken before the Logic Split Node, but conditions using {{variable}} still do not work, this matches the known behavior described by other users and Retell support [(1) ]() [(2) ]() [(3) ]() . Using the variable value directly (like 12345) works because it's a static comparison, not a dynamic one [(2) ](
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.