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

# Variables and Test Data

> Use variables to create dynamic, reusable workflows.

Variables allow you to pass dynamic data into your workflows at runtime, making workflows reusable across different contexts. This is how you connect your existing databases and internal systems to Simplex — pass patient records, policy details, invoice data, or any structured information directly into form-filling workflows.

Test data is what you use to build the flow in the editor.

## Setting test data

In the workflow editor, go to **Settings > Test Data**.

A Test Data tab will appear in the editor, and you'll be able to type or paste a test data JSON that the agent can use to write scripts in editor mode.

## How the agent uses test data and variables

In the editor, you'll see a `data/variables.json` file. When using the editor, this file contains the test data you give it in **Settings > Test Data**. In production, this file contains the variables JSON you pass to it when [running a workflow](/docs/integrating-simplex/typescript-sdk-examples#basic-workflow-execution).

Let's say you set the test data to be the following JSON:

```json data/variables.json theme={null}
{
  "PO_Number": "4729183",
}
```

If the agent then needs to fill in a search bar with a PO\_Number, it's likely to write code like this:

```python scratch_work/fill_search_bar_and_submit.py theme={null}
import asyncio
import json
from servers.browser_tools import click, type, screenshot

async def main():
    # Load variables
    with open("/home/chrome_user/agent/data/variables.json", "r") as f:
        variables = json.load(f)

    # Click and fill PO number field
    await click(selector="input#searchBar")
    await type(text=variables["PO_Number"])

asyncio.run(main())

```

## Advantages of using a variables file

Since the agent writes python code, it can manipulate variables before using them. A simple example is when a form requires separate first and last name fields, but the data source you're setting variables from (e.g., your internal database) only returns a full name:

```python scratch_work/fill_name_fields.py theme={null}
import asyncio
import json
from servers.browser_tools import click, type

async def main():
    with open("/home/chrome_user/agent/data/variables.json", "r") as f:
        variables = json.load(f)

    full_name = variables.get("full_name")
    first_name = full_name.split(" ")[0]
    last_name = full_name.split(" ")[1]

    await click(selector="input#firstname")
    await type(text=first_name)

    await click(selector="input#lastname")
    await type(text=last_name)

asyncio.run(main())
```

## Productionizing variables

As you build in the editor, Simplex uses the test data format to create the Variables schema (found in **Settings > Variables**). You can further edit the Variables schema manually as needed.

## Variables as feature flags

One way you can use variables is to treat them like feature flags. You'll likely need to be testing web automations on live portals, and often won't want to do form submissions during test time.

Given the following test data:

```json data/variables.json theme={null}
{
  "submit": false
}
```

The agent can conditionally submit based on the flag:

```python scratch_work/submit.py theme={null}
import asyncio
import json
from servers.browser_tools import click, screenshot

async def main():
    with open("/home/chrome_user/agent/data/variables.json", "r") as f:
        variables = json.load(f)

    if variables.get("submit"):
        await click(selector="button#submit")
        await screenshot()

asyncio.run(main())
```
