Enterprise Data apps need a valid
LIGHTDASH_LICENSE_KEY set on your instance before any of the configuration below takes effect. See enterprise features for applying the key.Prerequisites
- Enterprise license -
LIGHTDASH_LICENSE_KEYmust be set on your instance. - S3-compatible storage - a bucket Lightdash can write to for app source and built artifacts. If your instance isn’t already using S3, set that up first.
- A configured sandbox provider - see sandboxes.
- A coding-agent provider - Anthropic, OpenAI, or an AWS Bedrock account with access to the model used by your selected agent.
Configuration
Add the following environment variables to your Lightdash deployment:
Choose one of the coding-agent and provider combinations below.
Claude through Anthropic (default)
LeaveAPPS_CODING_AGENT unset or set it to claude, then provide an Anthropic API key.
Users can choose Sonnet, Opus, or Haiku for each generation. Sonnet is the default.
With
ANTHROPIC_BASE_URL, Lightdash uses ANTHROPIC_API_KEY as a bearer token and allows the gateway hostname through the sandbox firewall. The gateway must implement Anthropic Messages. See Corporate LLM gateways for authentication and API-path requirements.
Codex through OpenAI
SetAPPS_CODING_AGENT=codex and provide an OpenAI API key. Codex uses OpenAI directly whenever AI_DEFAULT_PROVIDER is not bedrock. You do not need an Anthropic API key for Data app generation in this mode.
Users can choose GPT-5.6 Sol, Terra, or Luna for each generation. Terra is the default.
Claude or Codex through Bedrock
SetAI_DEFAULT_PROVIDER=bedrock to route the selected coding agent through AWS Bedrock or a Bedrock-compatible gateway. Set APPS_CODING_AGENT to claude or codex, then configure the region and credentials used by the selected route.
For Claude, enable the Claude models you want to use in the selected region. For Codex, enable the corresponding OpenAI model IDs, such as
openai.gpt-5.6-terra, through the Amazon Bedrock Mantle path. See OpenAI’s Amazon Bedrock guide for supported models and authentication requirements.
The Bedrock credentials are the same ones used by AI Analyst - see AWS Bedrock configuration for the full reference. The sandbox firewall automatically allows only the provider endpoints required for the selected agent and region.
When BEDROCK_BASE_URL is set, the gateway must support the protocol used by each selected consumer. Claude uses Bedrock’s streaming Invoke API, while Codex uses the OpenAI Responses API through a custom gateway provider. Codex requires BEDROCK_API_KEY in gateway mode and sends model IDs with the openai. prefix, such as openai.gpt-5.6-terra; the gateway must register or translate those names. See the required gateway APIs matrix.
Gateway networking
The Lightdash backend and the Data app sandbox make separate connections to the gateway. E2B and Azure Sandboxes receive the configured gateway hostname in their dynamic egress allowlist. AWS Lambda MicroVMs use a pre-provisioned egress connector instead, soLAMBDA_MICROVM_EGRESS_CONNECTOR_ARN must permit the gateway hostname. Docker and Cloud Run follow their existing runtime network policy. See LLM gateway egress.
Restart the backend. The “Data apps” entry will appear in the New menu for users with the appropriate permission scope.
Optional configuration
Costs
Self-hosting data apps means you pay your sandbox provider and your selected model provider directly:- Your sandbox provider bills for sandbox runtime. A typical build runs for 1–15 minutes; sandboxes are paused between iterations and resumed on follow-up prompts.
- Anthropic, OpenAI, or AWS Bedrock bills per token. Each generation sends the project’s dbt catalog and the user’s prompt to the selected coding agent, plus any attached charts, dashboards, or images.
Permissions
Data apps follow the same space-based permission model as charts and dashboards. The relevant scopes (view:DataApp, create:DataApp, manage:DataApp) are bundled into the default system roles - but on enterprise instances using custom roles, you’ll need to grant them explicitly. See Custom roles for details.
Troubleshooting
The “Data apps” entry doesn’t appear in the New menu. Check thatAPPS_RUNTIME_ENABLED=true, LIGHTDASH_LICENSE_KEY is set, and the signed-in user has the create:DataApp scope.
Builds fail immediately with a sandbox creation error.
Check your sandbox provider’s credentials and template configuration — see sandboxes.
Builds fail mid-generation with an Anthropic error.
For direct Anthropic, check account usage limits and confirm ANTHROPIC_API_KEY is valid. With ANTHROPIC_BASE_URL, confirm the sandbox can reach the gateway and that it accepts bearer authentication at /v1/messages.
Codex builds fail with an OpenAI authentication or model error.
Confirm APPS_CODING_AGENT=codex. For OpenAI, verify OPENAI_API_KEY; if OPENAI_BASE_URL is set, the gateway must support the Responses API and the model IDs shown in the Data app model picker. For a Bedrock gateway, verify BEDROCK_API_KEY, /responses support, and the openai.-prefixed model ID.
Builds fail mid-generation with a Bedrock error.
Confirm BEDROCK_REGION is set to a region where the selected agent’s model is available, and that either BEDROCK_API_KEY or the BEDROCK_ACCESS_KEY_ID / BEDROCK_SECRET_ACCESS_KEY pair is valid. If you use IAM credentials, the principal must have permission to invoke the selected model. With BEDROCK_BASE_URL, also confirm the gateway and sandbox allowlist support the selected agent’s API wire. Codex requires an exact OpenAI Bedrock model ID such as openai.gpt-5.6-terra.