https://retellai.com/?utm_source=discord&utm_medium=seo logo
Dynamic Variable in chat is going unrecognized
# ❓・bug-report
t
@Omar Ashraf | Community Lead - Hi - Chat agent (agent_e993412c0a735a59ab24944ca0) doesn't seem to be recognizing the dynamic variable (transfer_preselect) it's being provided at start of chat (eg - chat_056150c912905c4991b51c96507). I tried probing it to shake loose what it knows, and it claimed the info was empty. I'm wondering if I'm referencing these variables the wrong way. If so, I'm not finding instructions on the correct way in documentation. Can you guide me? * This agent also has a function that will update the value of this dynamic variable. Is there anything special I need to do to get it to check for new/updated values on variables? I'm almost ready to demo my setup, but this is holding me up a little. Thanks for any help on this! https://cdn.discordapp.com/attachments/1467628427434524966/1467628428114137201/variable_testing.png?ex=698112fc&is=697fc17c&hm=925a79d1da8fdbe534508715b6029f70436dd22ac4da79632bb9b24956776b91& https://cdn.discordapp.com/attachments/1467628427434524966/1467628428625973278/dynamic_variables_prompt.png?ex=698112fc&is=697fc17c&hm=d1a9a773f4a0ab3134da14fd0eb65b7c57f660607925cb806510b73ba0b119e6&
s
Hey @teezecrost
Make sure the variable name matches exactly when passed via retell_llm_dynamic_variables For updating variables mid-chat: Use the Update Chat API (PATCH /update-chat/{chat_id}) with override_dynamic_variables.
t
Thanks, @Shehroze -Support @Retell @Shehroze -Support @Retell - I think the variable names were copy/pasted exactly. Do I need to prepend "retell_llm_dynamic_variables" or anything like that when using them? And can I reference them without the {{}} so that the prompt isn't just dumping a random word in the middle of my instructions?
Also, for the custom function, it's actually a different variable we want updated. Is my screenshot showing the correct setup to accomplish this, or is there a separate "override_dynamic_variables" we need to trigger after the values are received? If there's docs on this, happy to read them 🙂 https://cdn.discordapp.com/attachments/1467628427434524966/1467956738174222467/response_variables_custom_function.png?ex=698244bf&is=6980f33f&hm=b97cccd9ff459eeaffbc540415e0deef55edc14173c573278dda5e4047751386&
s
You must use the double curly braces are required. You cannot reference variables without them.
When passing variables via API, you use the retell_llm_dynamic_variables field as a JSON object
Dynamic Variables - Retell AI https://share.google/ZMc6UJmliRpR5CDnG
For more you can see this
Your screenshot setup looks correct!
Response Variables in custom functions automatically save extracted API response values as dynamic variables - no separate "override_dynamic_variables" trigger is needed.
t
Ok, maybe I'm not understanding how to construct these prompts. I'm going to ignore the custom function variable updating for now. Let's just figure out what I'm doing wrong with the initial variable values. Here's another one with a number of issues. This is an outbound call from a multi-prompt agent Call# call_c63ef1f1bb314660d3fe470fd9e to agent: agent_5641a5e80e400b7ff5fa34b150 It SHOULD see the dynamic variable transfer_preselect, and transfer automatically to agent agent_4670417028b46705a86e4e21d7. It doesn't do this, and when I do ASK it to transfer me, I get a girl with a British accent (who starts the call with "sure, no problem" for some reason) instead of "Lily" who is the correct voice for the agent, and has no accent. Here's a sample of the how I start the prompt for both the initial prompt and the starting state of the prompt tree: --- Sometimes calls will arrive with a pre-selected transfer option. In this case it's [[start of desired transfer]]{{transfer_preselect}}[[end of desired transfer]]] If the pre-selected "desired transfer" above is not empty, please use this value to transfer the call to the most appropriate agent out of the available options. Do so as soon as user picks up-without speaking or waiting for a response from the user. --- Any help you can offer would really help me in getting close to a demo I can show prospective clients. Thanks!
s
Pass transfer_preselect correctly via retell_llm_dynamic_variables in the Create Phone Call API; prompts alone won’t carry this Agent transfers require an Agent Transfer tool—prompts can guide when to trigger it, not replace it.
The wrong voice indicates a fallback/incorrect agent—verify the agent ID, Lily’s configuration, and the transfer tool’s target agent.
t
No, the dynamic variables are being passed at call creation. If you look at the call history, the transfer_preselect is right there (see attached). Also, if you press the agent that makes the call, she'll tell you that she sees that she should transfer to the beauty salon demo. The wrong voice is not being applied to an agent that I've specified programmatically. It is a setting on one of the first states of the multi-prompt agent. I added an agent transfer under tools, and then selected the latest version of the one I wanted. So not something I've misspelled. See other attached screenshot. https://cdn.discordapp.com/attachments/1467628427434524966/1468080544528072726/transfer_preselect.png?ex=6982b80d&is=6981668d&hm=f1d5aa3cd61eb35cceaf673b771d1dd66d5f743382b3cf83a2be0cb8adee63d0& https://cdn.discordapp.com/attachments/1467628427434524966/1468080545350291509/not_evie.png?ex=6982b80d&is=6981668d&hm=bd33f4e3fe641c71eaf2493b3f01fa9761a2db33531b5efd101d42b1a093383a&
Here's a newer call with the same agent with similar results. ( had to whisper cause my kids just got to sleep, but I was hoping it was just going to transfer without saying anything). call_3139e14267a44ef2cb761fd28e2
@Shehroze -Support @Retell are you able to help with this? Kinda stuck. Please let me know if I'm using this agent type incorrectly.
@Omar Ashraf | Community Lead ?
s
Hi @teezecrost
I sent your call to team to look and get back to you
t
Wonderful - thank you!
s
Hi @teezecrost so the team have checked this, in the "Select Agent" tab, you have a V0 agent selected with voice Evie, but their latest version is V12 with voice Lily, so they selected an outdated version of the agent with a different voice, which is why the voice miss-match. Regarding the transfer not triggering from the prompt, they believe either the agent transfer should be included in the starting state as a tool, or it should be specifically prompted in the starting state to move to the state where the transfer tool is available, and not be prompted in welcome to "transfer the call", as it isn’t in the starting state.
t
Thanks, but "V0" is what it locks in when you select "latest version", which is what I want. So maybe it's not recognizing latest version properly. Is that something you can check? I'll try your succestion regarding triggering from an earlier state, but "Latest" is what I'm after with the agent selection. Thanks!
After some tinkering and testing, I did not in any way require a multi-prompt agent. Once I switched to a single-prompt and started calling the agent transfers by the function names, things started clicking. But regarding the V0 -- is this a bug? "Latest Version" is something I would want to dependably resolve to the current latest version, not V0 Thanks again!