> ## Documentation Index
> Fetch the complete documentation index at: https://docs.retellai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Extract Dynamic Variables

This tool lets you extract values from a user’s response and save them as dynamic variables.

## Steps

<Steps>
  <Step title="Add a Extract Dynamic Variable Tool">
    This would give your agent the ability to extract variable. The description is optional here.

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/rxvYffEkEJPRL1KD/images/extract-dv/dropdown.png?fit=max&auto=format&n=rxvYffEkEJPRL1KD&q=85&s=49f0432ef7c2341ae1d8f3c6db45cbaa" data-path="images/extract-dv/dropdown.png" />
    </Frame>
  </Step>

  <Step title="Add Variables">
    Click "+Add" at the bottom and fill in the following details:

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/rxvYffEkEJPRL1KD/images/extract-dv/modal.png?fit=max&auto=format&n=rxvYffEkEJPRL1KD&q=85&s=302f541fdcbf9953dec485f91b0a6424" data-path="images/extract-dv/modal.png" />
    </Frame>

    * **Variable Name** – A short name to reference this variable.
    * **Description** – A brief explanation of what this value should be.
    * **Variable Type** – Choose from `Text`, `Number`, `Enum`, or `Boolean`.
    * **Enum Options** - Options to choose from. Only when type is enum

    #### Variable Types

    You can create variables of the following types:

    * **Text** - Any word or sentence. Examples: `"headache"`, `"John Smith"`
    * **Number** - A numeric value. Examples: `42`, `98.6`
    * **Enum** - A value from a predefined list. Examples: `"Yes"`, `"No"`, `"Maybe"`
    * **Boolean** - True or false.

    Click **Save** to add variable.

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/rxvYffEkEJPRL1KD/images/extract-dv/add-variable.png?fit=max&auto=format&n=rxvYffEkEJPRL1KD&q=85&s=1186a4aafcbfadd4702dd8579dcddb5b" data-path="images/extract-dv/add-variable.png" />
    </Frame>

    Add more variables as per requirement
  </Step>

  <Step title="Save the Extract Dynamic Variable Tool">
    Click the save button

    <Frame>
      <img height="200" src="https://mintcdn.com/retellai/rxvYffEkEJPRL1KD/images/extract-dv/variable-added.png?fit=max&auto=format&n=rxvYffEkEJPRL1KD&q=85&s=bb02abc71dcc49c80ecde11c93dc42df" data-path="images/extract-dv/variable-added.png" />
    </Frame>
  </Step>

  <Step title="Update prompt for function">
    It’s best to include in the prompt explicitly when is the best time to invoke the extract variable function. For example:

    ```
    When user states his name and phone number, please extract the information by calling the `extract_user_details` function.
    ```
  </Step>
</Steps>
