Issue 13 · Nov 2–8, 2026Editions · Glossary · Archive · Method · RSS · HU / ENG

News of the AI era, curated weekly

Glossary › Developer basics

environment variable

advancedwidespread

An environment variable is a named setting that is not contained in the program's code but is provided to the program from outside, by the environment running it, at startup; the program reads from it how to operate.

In plain terms

Imagine that in an office, the Wi-Fi password, the printer name, and the on-duty person are written on a bulletin board. The new colleague does not ask anyone but just looks at the board. An environment variable is such a bulletin board note for programs: a name and its associated value, for example LANGUAGE=Hungarian.

It is useful for making the same program behave differently on different machines without anyone rewriting the code. On the developer's machine, it connects to the test database; on the live server, it connects to the real one, because what is on the 'bulletin board' differs.

You most often encounter it when you need to provide a secret key (API key) for an AI service. You do not write this into the program's text but place it in an environment variable, allowing the code to be shared without the key going with it.

Unlike a simple menu setting, it does not belong to a specific program but to the environment in which the program runs. Multiple programs can read the same value.

How it works

  1. Someone (you, the system administrator, or an installer) provides a name–value pair, for example API_KEY=abc123, in the command line or system settings. A common solution is also a file named .env: this is not managed by the operating system but is read at startup by the program or a helper tool.
  2. When a program starts, the operating system passes it a copy of the currently valid variables; this is the program's 'environment'.
  3. The program asks by name for what it needs and decides based on the value: which server to connect to, what language to write in, where to save.
  4. If the program itself launches another program, the new program by default inherits a copy of the environment. For example, commands run by a coding agent also see the same variables.
  5. The change does not propagate backwards: the running program sees the old value, so it usually needs to be restarted after modification. Additionally, a value specified in the command line typically exists only in that window and is lost when the window is closed.

An everyday example

You want to try an AI tool on your own computer, and the installation guide asks you to "set your API key as an environment variable". You enter a line in the command line or a .env file, and from then on the tool knows in whose name and on whose account it is working. You never had to type the key into the program.

Who is affected

developerOn a daily basis, this separates code from passwords, keys, and machine-specific settings. → Code
entrepreneur, executiveThe company's AI subscription keys often reside here, so poor handling poses direct financial and data security risks.
employeeIf you install an AI tool or agent on your work computer, the guide will almost certainly ask you to set one or two environment variables. → Work & HR
parent, student, teacherAnyone learning or teaching programming will encounter the need to provide a key during their first AI exercise. → Education & Family

A common misconception

MythIf I put the password or key in an environment variable, it is safe.
In realityThe environment variable is not encrypted: it only ensures the secret is not in the code. Programs started in the same environment, including an agent, can read it, and it can easily end up in error logs or screenshots.

Limits and risks

Similar, but not the same

Related concepts

Broader

configuration, operating system, runtime environment

Narrower

.env file, PATH variable

On the edge

API key, command line, secret management, configuration file, container

A brief history

The current form of environment variables appeared in 1979 with the seventh release of the Unix operating system (Version 7 Unix). Since then, every major operating system has adopted it, from Windows to macOS to Linux.

Where things stand

As of late 2026, it is still one of the basic tools for configuring software, and the keys for AI tools and agents are typically provided this way. The emphasis is shifting toward security: more and more companies load the values from a secrets management system and restrict what an agent can see of them.

Status: 2026 November

Also known as

environment variable · environment variables · environment variable · env var · environment variable · ENV · .env · system variable

Sources

This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.