https://retellai.com/?utm_source=discord&utm_medium=seo logo
Hi, I am experiencing an strange issue that i have...
# ❓・ai-evy-support
v
@AI Evy Hi, I am experiencing an strange issue that i haven't managed to resolve, i have a chat agent that has a dynamic variable passed in to in (value = 2), that value is used by functions inside the agent, but when these functions are invoked the value being passed is 12345, i have check for any hardcoding and there is none.... is this something others have experienced?
a
Thanks for tagging me @VI. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Dynamic Variables Don't Populate in Chat-Only Test Mode (Multi-Prompt Agent)](https://discord.com/channels/1186424376300679209/1421373431781396580) [[3] Get Chat](https://docs.retellai.com/api-references/get-chat) ​
### Answer --- This is an unusual issue. A few things to check: 1. **Default Dynamic Variables**: Verify you don't have a default value of
12345
set at the agent level. Default variables serve as a fallback and will only be used when specific variables aren't included in the call request. [(1) ]() 2. **Testing Variables**: If you're testing in the dashboard, ensure you've removed or updated any testing variables that might be overriding your passed value. [(2) ]() 3. **Value Type**: All values in
retell_llm_dynamic_variables
must be strings. Numbers, booleans, or other data types are not supported. [(1) ]() Make sure you're passing
"2"
as a string, not
2
as an integer. 4. **Verify the Passed Value**: You can retrieve your chat session details to confirm what dynamic variables were actually received:
Copy code
javascript
const chatResponse = await client.chat.retrieve('your_chat_id') ;
console.log(chatResponse.retell_llm_dynamic_variables) ;
[(3) ]() 5. **Tool Description Check**: If the
12345
appears in your tool/function description as a placeholder or example, the LLM might be picking that up instead of the actual variable value. Could you share how you're passing the dynamic variable when creating the chat session, and confirm whether
12345
appears anywhere in your tool configurations or prompts?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
v
I am using the API to create chat, will that make any difference?
@AI Evy I am using the API to create chat, will that make any difference?
a
Thanks for the follow-up, @VI. I'll get back to you soon.
### Answer --- Using the API to create a chat should work fine for passing dynamic variables. When using the Create Chat API, you pass dynamic variables via the
retell_llm_dynamic_variables
field: [(1) ]()
Copy code
javascript
{
  "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
  "retell_llm_dynamic_variables": {
    "customer_name": "John Doe"
  }
}
A few things to verify: 1. **Check the field name spelling**: A common issue is typos in the field name. One user discovered their variables weren't reaching Retell because of a typo (
retell_lm_dynamic_variables
instead of
retell_llm_dynamic_variables
) . [(2) ]() 2. **Confirm values are strings**: All values must be strings—so pass
"2"
not
2
. [(3) ]() 3. **Verify what Retell received**: You can list your chats to see what dynamic variables were actually stored:
Copy code
javascript
const chatResponses = await client.chat.list() ;
console.log(chatResponses) ;
[(4) ]() The response will include
retell_llm_dynamic_variables
showing exactly what was received. If the API response shows your correct value (
"2"
) but the function still receives
12345
, the issue is likely in your tool configuration or agent-level defaults rather than the API call itself.
​ To learn more, see the sources I considered: [[1] Create Chat](https://docs.retellai.com/api-references/create-chat) [[2] dynamic variables ignored by agent.](https://discord.com/channels/1186424376300679209/1390663797517062204) [[3] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[4] List Chat](https://docs.retellai.com/api-references/list-chat) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.