App Lifecycle Manager feature flags let you dynamically control feature availability
and runtime behavior in your applications without redeploying code or modifying
infrastructure. You can onboard directly in the Google Cloud console by
designing your system components as App Lifecycle Manager units (see
[App-centric onboarding in the console](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-overview.md.txt#app-centric-usage)), or manage flag
configurations alongside your App Lifecycle Manager application deployments.

Feature flags integrate with App Lifecycle Manager units and rollouts to
deliver configuration updates progressively across your service instances.

For more information about units and rollouts, see the
[App Lifecycle Manager overview](https://docs.cloud.google.com/app-lifecycle-manager/overview.md.txt).

## Why use App Lifecycle Manager feature flags?

When you implement feature flags with App Lifecycle Manager it provides several
benefits for your SaaS development and operations lifecycle:

- **Decouple feature releases from code deployments:** Ship new code to production with features disabled by default. Enable features for specific users or gradually deploy them when ready, reducing the risk associated with large deployments.
- **Increase safety, speed, and reliability:**
  - Test features in production with a limited audience (canary releases).
  - Perform gradual rollouts using App Lifecycle Manager Rollout capabilities, minimizing the impact of potential issues.
- **Enable allow listing and tenant customization:** Turn features on or off for units which can represent tenants, services, or environments.
- **Simplify rollbacks:** When you disable a feature flag, it's often much faster and less disruptive than deploying a previous version of your application. This workflow lets you disable problematic features without rolling back binaries.
- **Unified management of flag configurations:** Manage feature flag definitions and use them to configure rollouts. This workflow provides operational reliability by letting you change your application's functionality by creating feature flag rollouts.

## How App Lifecycle Manager feature flags work

Using feature flags in App Lifecycle Manager involves two main aspects: the
management plane (defining and deploying flags) and the data plane (accessing
flag values within your application).

### App-centric onboarding in the console

Manage App Lifecycle Manager feature flags through the Google Cloud console,
whether App Lifecycle Manager manages your cloud infrastructure or your
application runs elsewhere. The following workflow shows how
Application Design Center, App Lifecycle Manager, and your application work
together across the management plane and data plane:

![App-centric feature flags workflow from Application Design Center composite templates and App Lifecycle Manager rollouts to runtime OpenFeature evaluation.](https://docs.cloud.google.com/static/app-lifecycle-manager/images/app-centric-flags-onboarding.svg)

1. **Create a SaaS offering:** Create a [SaaS offering](https://docs.cloud.google.com/app-lifecycle-manager/create-saas-offering.md.txt) in App Lifecycle Manager and specify the target locations for your deployments.
2. **Connect a composite application template:** From your SaaS offering in
   the Google Cloud console (or directly in
   App Design Center), connect a composite application template
   that represents the services in your architecture. Connecting the composite
   template generates a unit kind for each embedded standard application
   template.

   If you want to manage feature flags without provisioning cloud
   infrastructure through App Lifecycle Manager, embed empty standard
   application templates. You can add cloud resources to those templates later
   if you adopt managed deployments. For more information about composite
   templates, see
   [Design and package units of deployment](https://docs.cloud.google.com/app-lifecycle-manager/design-saas-offering.md.txt).
3. **Create and provision units:** In the Google Cloud console, create
   and provision units for your unit kinds from the **Units** page or through
   the **Provision** flow on the **SaaS offering details** page by using an
   actuation service account and tenant project variables. If you used empty
   standard templates, provisioning runs a no-operation actuation without
   deploying cloud resources and transitions the unit to the **Ready** state.

4. **Define and roll out flags:** In the Google Cloud console, create
   feature flags associated with your unit kind. When you create a flag
   release, the console automatically snapshots the selected flags into flag
   revisions. You can then create a rollout to distribute the flag release to
   your units.

5. **Evaluate flags in your application:** Configure the OpenFeature SDK and
   `flagd` provider in your application to connect to
   `saasconfig.googleapis.com:443` by using your unit's `featureFlagsConfigs`
   resource path and credentials with the SaaS Config Viewer
   (`roles/saasconfig.viewer`) IAM role. For runtime integration
   details, see [Data plane](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-overview.md.txt#data-plane).

For step-by-step instructions, see the
[Deploy feature flags quickstart](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-console-quickstart.md.txt).

### Integrated usage with App Lifecycle Manager

If you use App Lifecycle Manager to manage your application deployments (for example,
deploying infrastructure using Terraform Blueprints):

1. **Define flags:** Create feature flag resources within App Lifecycle Manager, specifying a unique `Flag key` (`enable-new-dashboard`, for example) and associating it with a unit kind. Boolean, integer, string, and double flags are supported.
2. **Provision flag changes:** Changes to flags (creation or updates) are not live until you initiate an App Lifecycle Manager rollout. This lets you use features like batches, supervision, and safety checks for flag deployments. The rollout updates the flag configuration associated with the targeted units.
3. **Access flags in application:** Your application code, running within the provisioned unit (for example, in a container on Cloud Run or Google Kubernetes Engine), uses an OpenFeature SDK configured with the `flagd` provider. This provider connects to the `saasconfig.googleapis.com` service endpoint. Using App Lifecycle Manager, inject the necessary unit identifier into your application environment, letting the SDK fetch the correct flag values for that specific unit.

This deep integration lets you manage feature lifecycles alongside
infrastructure lifecycles. For a practical example, see
[Quickstart: Deploy with the gcloud CLI](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-quickstart.md.txt).

### Management plane

You interact with the management plane to define and control your flags. You can
use the Google Cloud console, the gcloud CLI, or the App Lifecycle Manager API to:

- Create or update flags: To define flags, you specify the `Flag key`, associate it with a unit kind, and set its type and default value.
- Create rollouts: You initiate a rollout to distribute flag changes (creations or updates) to the targeted units belonging to the flag's unit kind. Rollouts ensure changes are applied safely and reliably according to your configured policies.

### Data plane

Your application code interacts with the data plane to consume flag values:

- **OpenFeature SDK:** Integrate the vendor-neutral [OpenFeature](https://openfeature.dev) SDK into your application.
- **`flagd` provider:** Configure the OpenFeature SDK to use the `flagd` provider.
- **Configuration:** Point the `flagd` provider to the App Lifecycle Manager feature flag service endpoint: `saasconfig.googleapis.com:443`.
- **Targeting:** Provide the `provider_id` to identify the flag configuration. This value typically corresponds to the full resource name of the App Lifecycle Manager unit (`projects/PROJECT_ID/locations/LOCATION/featureFlagsConfigs/UNIT_ID`, for example).
- **Authentication:** The provider uses Application Default Credentials (ADC) to securely authenticate requests to the Google Cloud service endpoint. The service account used needs the `roles/saasconfig.viewer` Identity and Access Management role.
- **Flag evaluation:** Use [standard OpenFeature methods (`client.get_boolean_value(...)`)](https://openfeature.dev/docs/reference/concepts/evaluation-api/#basic-evaluation), for example, in your code to check flag values. The provider handles fetching the latest deployed configuration from the service.

App Lifecycle Manager provides reference implementations and examples for integrating with the data plane:

- [Using feature flags with Python](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-console-quickstart.md.txt)

## Feature flag value types

App Lifecycle Manager feature flags support more than standard boolean evaluations. You can define flags with `STRING`, `INTEGER`, or `DOUBLE` values to control complex operational variables such as runtime thresholds, theme parameters, or configuration limits.

When you create any flag (boolean or non-boolean), you must explicitly define its variants (`--variants`) and evaluation specification (`--evaluation-spec`) to dictate the universe of possible return values. For boolean flags, the gcloud CLI also provides the `--with-default-evaluation` shortcut to populate default `Enabled` (`true`) and `Disabled` (`false`) variants with `defaultVariant` set to `Disabled`.

> [!NOTE]
> **Note:** Percentage-based allocations are not supported for non-boolean flags. You must rely on \`defaultVariant\` configuration or use standard CEL-based targeting logic to assign specific values.

### String flags

String flags pass configuration identifiers directly to connected clients.

```bash
gcloud beta app-lifecycle-manager flags create "feature-mode" \
  --key="feature-mode" \
  --flag-value-type=string \
  --location="global" \
  --unit-kind="UNIT_KIND_ID" \
  --variants='[{"id": "standard", "stringValue": "STANDARD"}, {"id": "advanced", "stringValue": "ADVANCED"}]' \
  --evaluation-spec='{"defaultVariant": "standard"}'
```

### Integer flags

Integer flags govern exact numerical limits and payload boundaries.

```bash
gcloud beta app-lifecycle-manager flags create "max-retry-count" \
  --key="max-retry-count" \
  --flag-value-type=int \
  --location="global" \
  --unit-kind="UNIT_KIND_ID" \
  --variants='[{"id": "low", "integerValue": 3}, {"id": "high", "integerValue": 10}]' \
  --evaluation-spec='{"defaultVariant": "low"}'
```

### Double flags

Double flags deliver high-precision values used for probability thresholds or
float parameters.

```bash
gcloud beta app-lifecycle-manager flags create "sampling-rate" \
  --key="sampling-rate" \
  --flag-value-type=double \
  --location="global" \
  --unit-kind="demo-test-unitkind" \
  --variants='[{"id": "minimal", "doubleValue": 0.01}, {"id": "full", "doubleValue": 1.0}]' \
  --evaluation-spec='{"defaultVariant": "minimal"}'
```

## Provision feature flags using rollouts

App Lifecycle Manager ensures safe changes or updates at scale by using rollouts to
provision feature flag updates.

Without staged rollouts, a minor flag configuration change (enabling a feature
for 1% of users, for example) propagates instantaneously across all application
instances. If this feature introduces a regression, issues can occur simultaneously across
your entire infrastructure. This global propagation significantly elevates your
risk of widespread service impact.

App Lifecycle Manager rollouts mitigate this risk by enabling gradual, controlled
distribution of flag changes, limiting the potential scope of any unforeseen
problems.

## Feature flag sets

Feature flag sets group multiple feature flags together and lets you manage
them as a single logical resource. This is useful for releasing features that
require multiple flags to be coordinated.

[Learn more about flag sets](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-sets.md.txt).

## Manifests

Manifests let you define and manage feature flags using JSON files. You
can push these definitions to the App Lifecycle Manager API, or pull existing
configurations to generate type-safe accessors for your application.

[Learn more about manifests](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-manifests.md.txt).

## Complex targeting

You can use Common Expression Language (CEL) to create sophisticated targeting
rules based on user or request attributes for precise control over which users
see which features.

[Learn more about complex targeting](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-targeting.md.txt).

## Multi-tenant architecture

You can use multi-tenant deployments with App Lifecycle Manager if you target
flags to specific units or groups of units (using labels, or tenants). You can
also implement gradual rollouts across your tenant fleet.

[Learn more about multi-tenant architecture](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-multi-tenant.md.txt).

## Allocate feature flags

Define *allocations* (such as *experimental* or *baseline*) and use traffic
splitting to perform tests, or randomized rollouts.

[Learn more about feature flag allocations](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-experimentation.md.txt).

## What's next

- Try the [Deploy feature flags quickstart](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-console-quickstart.md.txt) to onboard and manage feature flags in the Google Cloud console by using App Design Center templates.
- Try [Quickstart: Deploy with the gcloud CLI](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-quickstart.md.txt) to integrate flags with an App Lifecycle Manager-managed deployment.
- Review the main [App Lifecycle Manager overview](https://docs.cloud.google.com/app-lifecycle-manager/overview.md.txt) if you are new to the platform.