---
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 %}

All Datadog server SDKs support agentless delivery. The SDK loads configuration from the Datadog-managed CDN over HTTPS and evaluates flags locally. A Datadog Agent is not required.

Use the [server SDK getting-started guides](https://docs.datadoghq.com/feature_flags/server.md#getting-started) for the canonical versions and minimum configuration. This guide covers serverless deployment and event delivery.

## Set up agentless delivery{% #set-up-agentless-delivery %}

1. Install the SDK and provider for the language. Java uses standalone `dd-openfeature`. .NET requires automatic instrumentation. PHP requires the native extension and a subprocess sidecar.
1. Configure `DD_API_KEY` and `DD_ENV` in the application before startup. If your organization uses a site other than `datadoghq.com`, set `DD_SITE`.
1. For PHP, set `DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=agentless` before startup. Other new setups do not require source or enablement settings.
1. Initialize the provider and wait for initial configuration where supported. PHP waits during its first evaluation.

Store API keys in the platform's secret manager. Allow outbound HTTPS to the Datadog flag configuration service. Each evaluation uses local configuration; it does not send a configuration request.

The SDK polls every 30 seconds by default. It retains the last accepted configuration during temporary delivery errors. Before the first configuration arrives, evaluations return caller-provided defaults.

See [Configuration Sources](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md) for endpoint, polling, and timeout settings. See [Migrate an existing Remote Configuration setup](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md#migrate-an-existing-remote-configuration-setup) if the application uses legacy enablement settings.

## Send feature flag telemetry{% #send-feature-flag-telemetry %}

Flag configuration, experiment exposures, aggregated evaluation events, and OTLP metrics use separate delivery paths.

| SDK     | Experiment exposures | Aggregated flag evaluation events                | Event path with agentless delivery                                     |
| ------- | -------------------- | ------------------------------------------------ | ---------------------------------------------------------------------- |
| Java    | Supported            | Supported                                        | Direct HTTPS; a compatible local relay can be used with the Java agent |
| Node.js | Supported            | Supported                                        | Prefer a compatible relay; use direct HTTPS fallback                   |
| Python  | Supported            | Supported                                        | Prefer a compatible relay; use direct HTTPS fallback                   |
| .NET    | Supported            | Not supported by provider versions through 2.3.2 | Prefer a compatible relay; use direct HTTPS fallback for exposures     |
| Ruby    | Supported            | Supported                                        | Prefer a compatible relay; use direct HTTPS fallback                   |
| Go      | Supported            | Supported                                        | Prefer a compatible relay; use direct HTTPS fallback                   |
| PHP     | Supported            | Supported                                        | Prefer a compatible relay; use direct HTTPS fallback                   |

These capabilities apply to the [documented SDK versions](https://docs.datadoghq.com/feature_flags/server.md#getting-started). Direct event delivery uses the application's API key and Datadog site. With Agent delivery, events go through the Agent. See [Server-Side Evaluation Events and Privacy](https://docs.datadoghq.com/feature_flags/guide/server_evaluation_events.md) for collection controls, targeting-key hashing, `DD_FLAGGING_EVALUATION_COUNTS_ENABLED`, and direct-delivery limits.

Experiment exposures are generated only for flags associated with an experiment. Aggregated evaluation events and the separate `feature_flag.evaluations` OTLP metric are different signals. Configure the metric through [Server-Side Flag Evaluation Metrics](https://docs.datadoghq.com/feature_flags/guide/server_flag_evaluation_metrics.md). Agentless delivery does not configure an OTLP exporter.

### Use a local telemetry relay{% #use-a-local-telemetry-relay %}

`serverless-init` is an optional local relay for supported event paths. It is not a Feature Flags configuration source. Keep the source set to `agentless` to continue using agentless delivery.

Follow [Serverless Monitoring](https://docs.datadoghq.com/serverless.md) to configure a supported relay for the platform. Use `serverless-init` 1.9.13 or later for EVP event delivery. Configure its API key and site separately from the application credentials.

### Verify event delivery{% #verify-event-delivery %}

1. Confirm that a known flag evaluates from received configuration.
1. Evaluate a flag associated with an experiment and confirm that the experiment receives an exposure.
1. If the language supports aggregated evaluation events, confirm that evaluation data appears in Datadog.
1. If using a local relay, check its connection and forwarding logs.
1. Verify the OTLP path separately if the application uses `feature_flag.evaluations`.

## Agent delivery{% #agent-delivery %}

Use this path when the application should receive configuration from an existing Datadog Agent. `serverless-init` does not replace the Agent for Remote Configuration.

Configure the application:

```bash
export DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config
export DD_AGENT_HOST='<PRIVATE_AGENT_HOSTNAME_OR_IP>'
export DD_TRACE_AGENT_PORT=8126
export DD_ENV='<YOUR_ENVIRONMENT>'
```

Configure the Agent with its API key, site, and Remote Configuration. The application must reach the Agent over a private network. The Agent must reach Datadog over HTTPS.

For Java, load `dd-java-agent` 1.69.0 or later with `-javaagent`, alongside `dd-openfeature` 1.69.0 or later. Use the Java command or `JAVA_TOOL_OPTIONS` to set the JVM option. See [Java Remote Configuration](https://docs.datadoghq.com/feature_flags/server/java.md#use-agent-delivery).

## Runtime considerations{% #runtime-considerations %}

- **Cold starts:** Blocking initialization adds the time needed to receive initial configuration. Use background initialization if the application can serve default values during startup.
- **Java:** Standalone `dd-openfeature` does not require a Java agent or a tracing layer for agentless delivery.
- **.NET:** The runtime must support the Datadog native profiler. The provider package alone is insufficient.
- **Ruby:** Use a supported runtime and native extension. See [Ruby requirements](https://docs.datadoghq.com/feature_flags/server/ruby.md#getting-started).
- **PHP:** The runtime must support the extension and subprocess sidecar. Pass deployment variables to PHP workers before startup.
- **Edge runtimes:** Verify that the platform supports the selected SDK and its native dependencies. Browser-only runtimes cannot use the Node.js tracer provider.

Agentless delivery is not available for Datadog for Government. Use a supported configuration source for the selected site.

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

The public Feature Flags API manages flags and environments. Use the server SDK to evaluate flags locally instead of querying the management API for each application request.

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

Additional helpful documentation, links, and articles:

- [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)
