# Set Values Block

The Set Values Block allows you to **assign values to specific** [**variables**](/getting-started/workspace/variables.md) during a conversation. It’s an essential tool for **customizing the assistant’s behavior based on conditions, inputs, or internal logic**.

You can use it to:

* Assign values manually based on logic
* Preload or reset variable values at the start of a conversation
* Modify or clear data stored in the assistant’s memory.

<figure><img src="/files/4ITV97xlCnJ4Es8S9nJh" alt=""><figcaption></figcaption></figure>

## How it Works

When using the Set Values Block, you define:

* **The target variable** you want to update
* **The value** to assign to it.

Supported operations include:

* **Set to a fixed value**
* **Set to null or empty**
* **Set to true or false**.

## Best Practices

#### 1. Use it to **initialize variables** at the start of the conversation

We recommend using a Set Values Block in your **Welcome Workflow** to set or reset all the key variables, **ensuring every new session starts fresh**. For more on how to do this, see: [Configure Your AI Agents](/build-your-ai-agents/configure-your-ai-agents.md).

You can clear previous values by setting:

* Text variables to **empty**
* Boolean variables to **false**
* Any variable to **null**.

#### 2. Advanced Use: Regex Functions

The Set Values Block also supports **regex-based expressions** to transform values dynamically. This is especially useful for:

* **Extracting specific patterns from a user input** (e.g., cleaning a user ID)
* **Validating or transforming data before storing it**

**Example:**

You collect a raw user ID in `user_id_raw`. Using a regex function in the Set Values Block, you can extract the clean ID: `user_id_clean = REGEX(user_id_raw, 'pattern')`

You can also apply regex to check if an email format is valid, extract postal codes, or format date strings.

To insert a regex, simply type it in the “value” field using the supported syntax.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.indigo.ai/getting-started/agents-workflows-and-triggers/blocks/logic-blocks/set-values-block.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
