Global variables

Estimated reading: 5 minutes

Global variables allow you to store and reuse input values and credentials across your projects. These variables can be used in any input field marked with the Globe icon.

Robility Flow stores all global variables in its internal database and secures them using encryption with a secret key.

Create a global variable

To create a new global variable, follow these steps.

1. Click Global Variables in the right-side panel of the robilityflow canvas.
2. Click Add New.
3. In the Create Variable dialog, enter a name for your variable in the Variable Name field.
4. Optional: Select a Type for your global variable. The available types are Generic (default) and Credential.

RobilityFlow encrypts both Generic and Credential type global variables. However, Generic variables aren’t masked in the visual editor, whereas Credential variables are masked. Session ID fields don’t accept Credential (masked) variables.

5. Enter the Value for your global variable.
Optional: Use the Apply To Fields menu to select one or more fields that you want RobilityFlowto automatically apply your global variable to. For example, if you select OpenAI API Key,RobilityFlow automatically applies the variable to any OpenAI API Key field.

6. Click Save Variable.

You can now select your global variable from any text input field that displays the  Globe icon.

Edit a global variable

1. Click Global Variables in the right-side panel of the robilityflow canvas.
2. Click on the global variable you want to edit.
3. In the Update Variable dialog, you can edit the following fields: Variable NameValue, and Apply To Fields.
4. Click Update Variable.

Delete a global variable

Deleting a global variable permanently deletes the value from the database. Flows that reference the deleted global variable will fail.

1. Click Global Variables in the right-side panel of the robilityflow canvas.
2. Click the checkbox next to the global variable that you want to delete.
3. Click  Delete.

The global variable is deleted from the database.

Add custom global variables from the environment

RobilityFlow can source custom global variables from your runtime environment. For information about how RobilityFlow detects and applies environment variables, see RobilityFlow environment variables.

RobilityFlow automatically generates global variables based on constants.py if it detects any matching environment variables. For example, if you set OPENAI_API_KEY in your runtime environment, RobilityFlowautomatically generates a global variable using that value.

You can declare additional variables in ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT. For example, ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=WATSONX_PROJECT_ID,WATSONX_API_KEY creates global variables named WATSONX_PROJECT_ID and WATSONX_API_KEY in RobilityFlow’s database. Then, you can use these variables wherever they are needed in your component settings.

Local

If you installed RobilityFlow locally, set ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT in your RobilityFlow .env file:

1. Create or edit your RobilityFlow.env file.
2.  Add the ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT environment variable as follows:

You can specify the variables either as a comma-separated string with no spaces, or as a JSON list:

# Option 1: Comma-separated string (no spaces)
ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=VARIABLE1,VARIABLE2

# Option 2: JSON list format
ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=["VARIABLE1", "VARIABLE2"]
 

Replace VARIABLE1,VARIABLE2 with your additional variables that you want ROBILITYFLOW to source from the environment, such as CUSTOM_API_KEY,INTERNAL_SERVICE_URL or ["CUSTOM_API_KEY", "INTERNAL_SERVICE_URL"].

Save and close the file.

1. Start Robilityflow with the .env file:

uv run Robilityflow run --env-file .env
Alternatively, you can set environment variables directly in the command line:
VARIABLE1="VALUE1" VARIABLE2="VALUE2" uv run Robilityflow run --env-file .env
The command-line variables override matching variables in the .env file. Expose your environment variables to Robilityflow in a manner that best suits your own environment.

1. Confirm that Robilityflow successfully sourced the global variables from the environment: Click Global Variables, and then make sure that your environment variables appear in the Global Variables list.

Docker

If you’re using Docker, there are two ways that you can set ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT:

On the command line:

docker run -it --rm \
-p 7860:7860 \
-e ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT="VARIABLE1,VARIABLE2" \
-e VARIABLE1="VALUE1" \
-e VARIABLE2="VALUE2" \
Robilityflow ai/Robilityflow:latest
In your .env file:
docker run -it --rm \
-p 7860:7860 \
--env-file .env \
-e VARIABLE1="VALUE1" \
-e VARIABLE2="VALUE2" \
Robilityflowai/Robilityflow:latest
The list in ROBILITYFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT includes only the variable names. You must ensure that these environment variables are defined in your Docker environment, such as with -e or otherwise.

After starting Robilityflow, go to your Robilityflow Settings to confirm that the variables were created.

Only the Name and Value are taken from the environment. You can edit the variables in your Robilityflow Settings if you want to configure additional options, such as the Apply To Fields option.

Global variables sourced from the environment are assigned the Credential type, which masks the values in the visual editor. However, Robilityflow automatically encrypts all global variables stored in the database.

Default Environment Variables Automatically Detected

Robility Flow automatically imports the following environment variables as Credential type global variables:

a. ANTHROPIC_API_KEY
b. ASTRA_DB_API_ENDPOINT
c. ASTRA_DB_APPLICATION_TOKEN
d. AWS_ACCESS_KEY_ID
e. AWS_SECRET_ACCESS_KEY
f. AZURE_OPENAI_API_DEPLOYMENT_NAME
g. AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME
h. AZURE_OPENAI_API_INSTANCE_NAME
i. AZURE_OPENAI_API_KEY
j. AZURE_OPENAI_API_VERSION
k. COHERE_API_KEY
l. COMPOSIO_API_KEY
m. GOOGLE_API_KEY
n. GROQ_API_KEY
o. HUGGINGFACEHUB_API_TOKEN
p. NOVITA_API_KEY
q. OPENAI_API_KEY
r. PINECONE_API_KEY
s. SAMBANOVA_API_KEY
t. SEARCHAPI_API_KEY
u. SERPAPI_API_KEY
v. TAVILY_API_KEY
w. UPSTASH_VECTOR_REST_TOKEN
x. UPSTASH_VECTOR_REST_URL
y. VECTARA_API_KEY
z. VECTARA_CORPUS_ID and VECTARA_CUSTOMER_ID

For additional environment configuration options, refer to the Environment Variables documentation.

Share this Doc

Global variables

Or copy link

CONTENTS
Robility Chatbot
Robility Assistant
Online