liveBook · Manning

Global variable

As explained in Grokking AI Applications

A named value managed centrally so it can be reused across multiple Langflow flows.

A global variable is a centrally managed value that can be reused across Langflow flows. It is useful for shared settings such as API keys, so each flow does not require the same value to be entered repeatedly. section 2.2

Manage a global variable through a short lifecycle:

  • Create it from a component parameter, such as the OpenAI API Key field, or from the Global Variables settings. section 2.3
  • Give it a recognizable name and enter its value. section 2.3
  • Choose the credential type for API keys; Langflow encrypts credentials. section 2.3
  • Update, delete, or display unencrypted variables from Settings. section 2.3

Reuse an OpenAI API key

Create an OpenAI secret key, open the globe icon beside the OpenAI component’s API Key parameter, choose Add New Variable, name it “OpenAI Key,” paste the value, select Credential, and save it. The key can then be reused across multiple flows. section 2.3

Figure 2.15 You can save all of your keys as global variables and reuse them as needed.

Shows the Langflow interface for saving keys as global variables and reusing them. section 2.3

How Grokking AI Applications covers it

How deep it goes
Explains creation, naming, credential selection, encryption, reuse, updating, deletion, and display limits for encrypted values.
Examples
Demonstrates storing an OpenAI API key as an encrypted credential and reusing it across flows.
What it assumes
Assumes familiarity with Langflow’s Settings and components while teaching API-key storage and credential selection through the interface.
What you can do after
Operate/configure Langflow to store shared API keys once and reuse them across flows.
How it connects
Connects global variables with Langflow flows, API keys, credentials, components, Settings, and model providers.

Also explained in

Compare how 12 books explain global variable →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.