https://retellai.com/?utm_source=discord&utm_medium=seo logo
Dynamic variables extracted from tool calls and th...
# ❓・ai-evy-support
n
@AI Evy Dynamic variables extracted from tool calls and the default system dyamic varaibles like current time will always be present and will always be correct right or is thier a room for halucations for these as well?
a
Thanks for tagging me @neerajjoshi_. I'll look through relevant sources and get back to you shortly.
### Answer Dynamic variables in Retell AI work differently depending on their source: Default System Variables - These are automatically provided by Retell and don't require configuration [(1) ]() . They include variables like
{{current_time}}
,
{{current_time_[timezone]}}
,
{{call_type}}
,
{{direction}}
,
{{user_number}}
, and
{{agent_number}}
. These system variables are reliably populated by Retell's infrastructure. Extracted Dynamic Variables - When you use the Extract Dynamic Variables tool, the LLM extracts values from user responses and saves them [(2) ]() . You can extract different types including Text, Number, Enum, or Boolean . Since this extraction relies on the LLM interpreting user input, there is potential for the LLM to misinterpret or incorrectly extract values. Dynamic Variables from Tool Calls - When you set response variables in MCP tools or custom functions, you extract values from the tool response and save them as dynamic variables [(3) ]() . The accuracy here depends on what your external tool returns. Handling Missing Variables - When a dynamic variable has no assigned value, it remains in its raw form with the curly braces intact [(1) ]() . For example, if
user_name
is not provided, the prompt would show
"Hello {{user_name}}, how can I help you today?"
. To minimize issues with extracted variables, it's recommended to include explicit instructions in your prompt about when to invoke extraction functions [(2) ]() . For example: "When user states his name and phone number, please extract the information by calling the `extract_user_detai
ls` function" .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[3] MCP](https://docs.retellai.com/build/single-multi-prompt/mcp) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy Let's assume we got 3 booking ids from a tool call xyz abc qwe And now I want to use it in different tool call can I use them relaibally?
a
Thanks for the follow-up, @neerajjoshi_. I'll get back to you soon.
### Answer Yes, you can use booking IDs from a tool call response in subsequent tool calls by extracting them as response variables [(1) ]() [(2) ]() . How to set this up: When configuring your custom function or MCP tool, you can extract values from the API response and save them as dynamic variables . For example, if your tool returns:
Copy code
json
{
  "booking_ids": ["xyz", "abc", "qwe"]
}
You would set up response variables using JSON path notation to extract specific values [(3) ]() . For arrays, you can use syntax like
booking_ids[0]
to extract the first booking ID . Reliability considerations: The extracted values will be stored as dynamic variables and can be referenced later using
{{variable_name}}
syntax [(4) ]() . However, there are some important points: 1. All dynamic variable values must be strings . If your tool returns an array or complex object, you'll need to extract individual elements or handle the structure appropriately. 2. Variable extraction depends on correct JSON path mapping [(3) ]() . You need to specify the exact path to each value you want to extract. 3. Missing variables remain in raw form - if a variable isn't set, it will appear as
{{variable_name}}
with curly braces intact [(4) ]() . Best practice: Extract each booking ID as a separate dynamic variable (e.g.,
{{booking_id_1}}
,
{{booking_id_2}}
,
{{booking_id_3}}
) using the response variables feature, then reference them in subsequent tool calls [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[2] MCP](https://docs.retellai.com/build/single-multi-prompt/mcp) [[3] Code Tool](https://docs.retellai.com/build/single-multi-prompt/code-tool) [[4] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy Got it like the only thing I want to know is will the data for next tool call be correct or will the llm loose this value? Will LLM loose any of the dynamic varaibles in general
a
Thanks for the follow-up, @neerajjoshi_. I'll get back to you soon.
### Answer Based on the available documentation, dynamic variables in Retell AI are persistent throughout a call session once they are set [(1) ]() . The LLM should not "lose" dynamic variables during a call. How dynamic variables work: Dynamic variables are injected into your agent's prompts and tool descriptions using the
{{variable_name}}
syntax . Once set (either through the API, webhooks, or extracted during the call) , they remain available for the duration of that call session. For variables from tool responses: When you use the "Store Fields as Variables" feature in custom functions or MCP tools, values extracted from API responses are saved as dynamic variables [(2) ]() . These can then be referenced in subsequent tool calls using
{{variable_name}}
. Important considerations: 1. All dynamic variable values must be strings [(1) ]() [(3) ]() 2. Variables are call-scoped - they persist for the duration of the call 3. Missing variables remain in raw form - if a variable isn't set, it appears as
{{variable_name}}
with curly braces [(1) ]() Potential issue with agent transfers: There is one documented case where dynamic variables may not persist: during agent transfers. A community discussion indicates that dynamic variables set in one agent may not automatically transfer to the swapped agent [(4) ]() . However, this appears to have been resolved in that specific case. Bottom line: For normal tool-to-tool calls within the same agent during a single call session, dynamic variables
should remain reliable and not be lost by the LLM.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Code Tool](https://docs.retellai.com/build/single-multi-prompt/code-tool) [[3] Update Retell LLM](https://docs.retellai.com/api-references/update-retell-llm) [[4] Dynamic Variables not persisted](https://discord.com/channels/1186424376300679209/1432409107393937589) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
n
@AI Evy please tell me about finetune examples - Do they work for for both single prompt and conversational agent?
a
Thanks for the follow-up, @neerajjoshi_. I'll get back to you soon.
### Answer I don't have specific information about "finetune examples" in the available sources. The sources provided cover API references for creating, updating, getting, and listing Retell LLMs [(1) ]() [(2) ]() [(3) ]() [(4) ]() , as well as deployment guidance [(5) ]() , but they don't contain details about finetune examples or whether they work for both single prompt and conversational flow agents. For information about fine-tuning capabilities and how they apply to different agent types, I'd recommend checking out these potentially useful sources: - [Create Retell LLM]() - [Update Retell LLM]() - [How to Deploy Conversational AI | Retell AI]() Could you clarify what specific aspect of fine-tuning you're interested in? That would help me provide more targeted guidance if the information becomes available.
​ To learn more, see the sources I considered: [[1] Update Retell LLM](https://docs.retellai.com/api-references/update-retell-llm) [[2] Get Retell LLM](https://docs.retellai.com/api-references/get-retell-llm) [[3] Create Retell LLM](https://docs.retellai.com/api-references/create-retell-llm) [[4] List Retell LLMs](https://docs.retellai.com/api-references/list-retell-llms) [[5] How to Deploy Conversational AI | Retell AI](https://www.retellai.com/blog/how-to-deploy-conversational-ai) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.