https://retellai.com/?utm_source=discord&utm_medium=seo logo
Some times, the agent is using some variable value...
# ❓・ai-evy-support
a
Thanks for tagging me @manucmt_18551. I'll look through relevant sources and get back to you shortly.
### Answer Based on the documentation, dynamic variables in Retell AI are designed to be call-specific and should not persist between calls [(1) ]() . Each call should receive its own set of dynamic variables through either the outbound call API or inbound webhook response . For outbound calls, you set variables in the
retell_llm_dynamic_variables
field when creating the call :
Copy code
javascript
const agentResponse = await client.agent.create({
 response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
 voice_id: '11labs-Adrian',
}) ;
[(2) ]() For inbound calls, you supply dynamic variables through the Inbound Call Webhook response [(1) ]() . The documentation shows that when dynamic variables are not provided, they remain in their raw form with curly braces intact . For example: - 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 prevent variable carryover issues: 1. Set agent-level defaults carefully - Configure fallback values in agent settings that are generic rather than specific to any caller 2. Use defensive prompting - Design prompts that work with or without variables 3. Ensure proper variable passing - Make sure each call properly sets its own variables through the API or webhook If you're experiencing variable persistence between calls, this suggests an implementation issue rather than expected behavior. Each call should start fresh with only the variables you explicitly provide for that specific call .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.