Sistava

What is Feature Flag?

Also called feature toggle, flag.

A feature flag is a runtime switch that determines whether a piece of behavior is active, letting teams change what a system does without deploying new code. Flags can be global, or evaluated per user, tenant, or request, which allows a change to be enabled for a subset of traffic and reversed immediately.

Flags serve several distinct purposes that are often conflated. Release flags decouple deployment from exposure, letting unfinished code ship dark. Experiment flags assign variants for measurement. Operational flags let responders disable an expensive or misbehaving path during an incident. Permission flags gate access by plan or entitlement. The four have different lifetimes and different owners, and treating them identically is a common source of confusion.

The cost is combinatorial. Each independent boolean doubles the number of possible system states, so a codebase with dozens of live flags has more configurations than any test suite covers. Untested interactions between flags are a recurring source of defects. Disciplined teams therefore remove release flags shortly after full rollout and keep only the long-lived operational and entitlement flags.

Evaluation must be safe under failure. If the flag service is unreachable, the client needs a defined default, either a cached last-known value or a compiled-in fallback, and it must never block request handling waiting for a flag lookup. A configuration system that can take down the application it configures is a poor trade for the flexibility it offers.

In AI systems, flags commonly select prompt versions, model configurations, retrieval strategies, and whether a given tool is available to an agent. This makes them the fastest available control when a behavioral regression appears: switching a flag reverts agent behavior in seconds, where a code deploy takes minutes. It also means a flag change alters agent behavior in production and deserves the same review and audit trail as a code change.

Key points

In practice

A team ships a rewritten planning prompt behind a flag defaulting to off. They enable it for internal workspaces, then for 5 percent of tenants, watching a quality metric and tool error rate. At 25 percent, retry rates on one tool climb noticeably. Flipping the flag off restores the previous behavior within seconds, well before a code revert could have been built and deployed.

Related terms

Back to the AI Glossary