https://retellai.com/?utm_source=discord&utm_medium=seo logo
does the test chat work with dynamic variables or ...
# ❓・ai-evy-support
p
@AI Evy does the test chat work with dynamic variables or do I have to set them in advance?
a
Thanks for tagging me @punk8357. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Manually test your agent](https://docs.retellai.com/test/llm-playground) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
### Answer Yes, the test chat (LLM Playground) works with dynamic variables [(1) ]() . You can test dynamic variables directly in the playground without having to set them in advance for production calls . The LLM Playground allows you to test dynamic variables using the
{{variable_name}}
syntax in your prompts [(2) ]() . You can verify that variables are properly interpolated and test different variable values and scenarios directly in the testing interface [(1) ]() . For testing, you can use dynamic variables in your prompts like:
Copy code
"Hello {{user_name}}, I understand you're interested in {{product_name}}. How can I help you today?"
[(2) ]() The playground provides immediate feedback on how your agent handles dynamic variables, making it easy to iterate and refine your implementation before deploying to production [(1) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
how do I test if a dynamic variable is properly being set by seeing the value of it throughout the test chat?
@AI Evy how do I test if a dynamic variable is properly being set by seeing the value of it throughout the test chat?
a
Thanks for the follow-up, @punk8357. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
### Answer To test if a dynamic variable is properly being set during test chat, you can use the web interface to test your dynamic variables before deploying [(1) ]() . The documentation mentions that you should "test your dynamic variables using the web interface" . When a dynamic variable has no assigned value, it remains in its raw form with the curly braces intact . For example: - Prompt:
"Hello {{user_name}}, how can I help you today?"
- If
user_name
is not provided:
"Hello {{user_name}}, how can I help you today?"
- If
user_name
is "John":
"Hello John, how can I help you today?"
To check if a variable is unset in prompts, you can add conditional logic :
Copy code
If {{user_name}} appears with curly braces, use a generic greeting.
Otherwise, greet the customer by name.
For conversation flow conditions, you can check if a variable is unset using [(2) ]() :
Copy code
Condition: {{user_name}} contains {{
Result: True if variable is unset (still has curly braces)
The best practices include testing thoroughly with both set and unset variables [(1) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @punk8357. I'll get back to you soon.
p
should I be using dynamic variables in my custom functions @AI Evy
a
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer Yes, you can and should use dynamic variables in your custom functions. Dynamic variables work in several places within custom function configurations [(1) ]() : Where you can use dynamic variables in custom functions: - Custom function URLs - Tool descriptions - Property descriptions - Request headers - Header values can be static or include dynamic variables [(2) ]() [(3) ]() - Query parameters - Query parameter values can be static or include dynamic variables Setting response variables: You can also extract values from your custom function's API response and save them as dynamic variables for use later in the conversation [(3) ]() . For example, you can extract a user's name from the response and reference it later using
{{user_name}}
. Example response body that could set dynamic variables :
Copy code
json
{
 "properties": {
 "user": {
 "name": "John Doe",
 "age": 26
 }
 }
}
This allows your custom functions to both consume existing dynamic variables (like
{{customer_id}}
in a URL) and create new ones based on API responses, making your agent conversations more personalized and context-aware.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[3] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​