CTCaliberTek
Course: Langflow: Visual AI Builder (10 Modules) · Lesson 7 of 10Log in to track your progress and earn a certificate when you finish the course.
AI & Machine Learning

Langflow Module 7: Global Variables, Export, and Version History

Published September 12, 2026·Updated October 29, 2026·7 min read
Like SaveLog in to like, save, and track progress.

Introduction

As your flows grow, you need a safe way to handle secrets, a way to move flows between environments, and a safety net for changes. Global variables, export and import, and version history cover these. This module explains each.

Prerequisites

  • At least one flow you have built

Step-by-Step Guide

Step 1: Create a global variable

Open your profile icon, then Settings, then Global Variables, and click Add New. Give it a Variable Name, choose a Type, enter the Value, and click Save Variable. Use the Credential type for secrets, since credential values are masked, and Generic for ordinary values.

Step 2: Use variables in components

Fields that show a Globe icon can reference a global variable. Select the variable instead of typing the value. If you rotate a secret, you change it once in Settings and every flow that references it picks up the new value. Deleting a variable breaks flows that use it.

Step 3: Load variables from the environment

Langflow can also read values from environment variables, such as OPENAI_API_KEY, and expose them as global variables. LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT lists extra names to import, and LANGFLOW_FALLBACK_TO_ENV_VAR controls falling back to the environment when no global variable exists. This is how you configure containers without clicking through the UI.

export OPENAI_API_KEY="your-key"
export LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT="MY_SERVICE_TOKEN"

Step 4: Export and import flows

To export, open the flow and choose Share, then Export, or use More, then Export on the Projects page. The result is a JSON file. A checkbox, Save with my API keys, decides whether literal keys typed into components are included, so leave it off when sharing. Keys stored as global variables export only the variable name, so the destination needs variables with the same names. To import, use Upload a flow on the Projects page, or drag a JSON file into the window.

Step 5: Use version history

The flow editor's sidebar has Version History, where you can save snapshots and restore earlier ones. Save a version before a risky change such as rewiring a prompt, and use Duplicate on the Projects page to experiment on a copy.

FAQs

Is it safe to share an exported flow?
Yes if you leave Save with my API keys unchecked and keep secrets in global variables. Always open the JSON and check it before sharing, since a literal key typed into a field would be exported as-is.
How do I move flows between development and production?
Export from one instance, import into the other, and create global variables with the same names in the destination so references resolve.

Summary

Keep secrets in Credential global variables, export flows without keys, recreate the variables where you import them, and use version history and duplication to change flows safely.

Related tutorials

Comments

Log in or create a free account to join the discussion.

  • No comments yet. Be the first to comment.