---
title: Serverless Environments
description: >-
  Use Datadog Feature Flags server SDKs in serverless environments with or
  without a Datadog Agent.
breadcrumbs: Docs > Feature Flags > Implementation Patterns > Serverless Environments
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Serverless Environments

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

The Datadog Feature Flags Node.js SDK can receive flag configuration directly from the Datadog-managed CDN. This *agentless* configuration source does not require a Datadog Agent, which makes it the default delivery mode for supported Node.js serverless applications.

After configuration is loaded, flag evaluation happens locally in the application. The SDK does not make a network request for each evaluation.

Agentless configuration delivery is available in:

| SDK                   | Minimum version |
| --------------------- | --------------- |
| Node.js `dd-trace` v5 | 5.116.0         |
| Node.js `dd-trace` v6 | 6.5.0           |

Other server SDKs and `dd-trace` versions earlier than those listed require Agent Remote Configuration for flag delivery.

{% alert level="warning" %}
The initial Node.js agentless releases load configuration and evaluate flags locally. They do not support evaluation metrics, exposure logging, or experimentation use cases.
{% /alert %}

## Agentless architecture{% #agentless-architecture %}

Use agentless delivery when the serverless runtime can make outbound HTTPS requests to Datadog:

1. Use a supported SDK version.

1. Configure the API key, Datadog site, and environment in the serverless application:

   ```bash
      DD_API_KEY=<DATADOG_API_KEY>
      DD_SITE=<code class="js-region-param region-param" data-region-param="dd_site"></code>
      DD_ENV=<YOUR_ENVIRONMENT>
```

1. Initialize or access the Datadog OpenFeature provider as described in [Node.js setup](https://docs.datadoghq.com/feature_flags/server/nodejs.md). This starts CDN polling. No Feature Flags enablement or source setting is required.

1. Store `DD_API_KEY` in the serverless platform's secret manager and expose it only to the application process.

The SDK polls the Datadog-managed CDN every 30 seconds by default and uses ETags for unchanged configuration. It preserves the last accepted configuration during temporary errors. If no configuration has been accepted, OpenFeature evaluations return the caller-provided default value.

Tracer installation and initialization alone do not start CDN polling. Requests to the CDN contribute to server Feature Flags billing only after application code activates the provider.

Agentless mode removes the Agent dependency for *flag configuration*. It does not change your APM or serverless telemetry setup. You can continue to use the Datadog Lambda Extension, `serverless-init`, an Agent sidecar, or another supported telemetry path independently.

## Agent-backed Remote Configuration{% #agent-backed-remote-configuration %}

Set `DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config` to explicitly use the existing Agent Remote Configuration path:

```bash
# Serverless application
DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config
DD_AGENT_HOST=<PRIVATE_AGENT_HOSTNAME_OR_IP>
DD_TRACE_AGENT_PORT=8126
```

Configure the Agent with Remote Configuration and the API key:

```bash
DD_REMOTE_CONFIGURATION_ENABLED=true
DD_API_KEY=<DATADOG_API_KEY>
DD_SITE=<DATADOG_SITE>
```

The serverless workload must be able to reach the Agent on a private network, and the Agent must be able to reach Datadog over HTTPS. Do not expose the Agent trace intake publicly.

Explicitly selecting `remote_config` enables the Feature Flags Remote Configuration subscription, even if application code does not initialize the provider. These requests contribute to server Feature Flags billing.

## Operational considerations{% #operational-considerations %}

- **Cold starts**: Blocking provider initialization waits for the first configuration and can add cold-start latency. Initialize asynchronously if serving caller-provided default values during startup is acceptable.
- **Outbound connectivity**: Agentless delivery requires outbound HTTPS access to the Datadog-managed flag configuration service.
- **API key ownership**: In agentless mode, the application owns `DD_API_KEY`. In `remote_config` mode, the Agent owns the API key.
- **Flag updates**: Delivery is eventually consistent. Allow for the SDK polling interval and application startup time when testing changes.
- **Last-known-good behavior**: After a configuration has been accepted, temporary network failures or malformed responses do not replace it.
- **Runtime support**: Agentless configuration removes the Agent requirement, but it does not make an otherwise unsupported Node.js runtime compatible with the tracer. Check the tracer's compatibility requirements.
- **Kill switch**: `DD_FEATURE_FLAGS_ENABLED` defaults to `true`. Set it to `false` to disable the provider and both configuration delivery paths. Evaluations then return caller-provided default values.

Datadog-managed agentless delivery is not available for Datadog for Government in these versions. Use Agent Remote Configuration on that site.

If your deployment uses `DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED`, see [Migrate from the legacy provider setting](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md#migrate-an-existing-remote-configuration-setup).

## Environment notes{% #environment-notes %}

### AWS Lambda{% #aws-lambda %}

Node.js Lambda functions can use agentless configuration delivery when they run a minimum SDK version and can reach Datadog over HTTPS. The Datadog Lambda Extension is not required for flag configuration, but you can continue to use it for supported serverless telemetry.

### Google Cloud serverless environments{% #google-cloud-serverless-environments %}

Node.js workloads can use agentless configuration delivery when the tracer is supported in the selected runtime and outbound HTTPS is available. This applies independently of in-container or sidecar telemetry instrumentation.

### Azure Functions{% #azure-functions %}

Node.js function apps can use agentless configuration delivery when the tracer is supported and outbound HTTPS is available. An external Agent is only required when `remote_config` is selected.

### Edge runtimes{% #edge-runtimes %}

Some edge runtimes do not support the Datadog Node.js tracer APIs required by the Feature Flags provider. Verify tracer compatibility for the target platform before relying on agentless configuration delivery.

## Public API and local evaluation{% #public-api-and-local-evaluation %}

The public [Feature Flags API](https://docs.datadoghq.com/api/latest/feature-flags.md) is intended for managing flags and environments. It is not a per-request flag evaluation API for server-side applications.

Do not query Datadog APIs from each serverless invocation to evaluate flags. Use the server SDK, which periodically loads flag configuration and evaluates locally.

## Validate your setup{% #validate-your-setup %}

Before enabling Feature Flags in production:

1. Confirm the application uses a minimum supported SDK version.
1. For agentless delivery, confirm the application has `DD_API_KEY`, `DD_SITE`, and `DD_ENV`. For Agent Remote Configuration, confirm the Agent has its API key and Remote Configuration enabled.
1. Initialize the OpenFeature provider and check that it reaches a ready state.
1. Change a non-production flag in Datadog and confirm that the workload receives the updated value after the polling interval.
1. Confirm that your application handles caller-provided defaults if configuration is unavailable during a cold start.
1. For the initial Node.js agentless releases, do not plan experimentation workflows around evaluation metrics or exposure data. These uses are not supported.

## Further reading{% #further-reading %}

- [Server-Side Feature Flags](https://docs.datadoghq.com/feature_flags/server.md)
- [Server SDK Configuration Sources](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md)
- [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md)
- [Serverless Monitoring](https://docs.datadoghq.com/serverless.md)
