Skip to main content

Environment Variables

Environment Variables allow you to store and manage configuration values that can be used across your Flows. These variables can be accessed from various nodes including Code, Code Interpreter, and Prompt nodes. They are helpful for storing values that need to be accessed across multiple Flows and allow a place to store API keys for custom integrations to external systems.

Managing Environment Variables

Environment Variables can be configured in your project's Settings page under the Environment Variables section. You can create variables of different types:

  • String
  • Number
  • Boolean
  • Secret
  • Data (JSON/Object)

Note: Secret variables are encrypted and their values cannot be used in Prompts. They are strings.

Using Environment Variables

In Prompts

You can reference environment variables in prompts using the syntax:

This is my Environment Variable named MY_VAR {{env.MY_VAR}}

Warning: Environment Variables of type Secret cannot be used in prompts.

In Code Nodes

Environment variables can be accessed in Code Nodes through the context.env object:

let value = await context.env("MY_VAR")

Important: To use environment variables in Code Nodes, you must first enable them by turning on "Allow Environment Variables" in the node settings.

In Code Interpreter Nodes

Environment variables can be accessed in Code Interpreter Nodes through Python's os.environ dictionary. However, you must first enable environment variables by turning on "Environment Variables" in the node settings.

To use environment variables in Code Interpreter Nodes:

  1. Enable Environment Variables in the node settings
  2. Access variables using Python's os.environ:

value = os.environ.get('MY_VARIABLE')

Note: All environment variables are converted to strings when used in Code Interpreter.