Skip to main content

Environment Variables

Complete reference for all environment variables used in the STELLA platform. Variables are organized by category and include default values, requirements, and detailed descriptions.

Quick Reference​

Jump to a specific category:

CategoryDescription
Core ServerNode environment, ports
DatabasePostgreSQL configuration
SecurityJWT, encryption keys
LiveKitWebRTC server configuration
AI APIsOpenAI and other AI services
Speech-to-TextSTT provider configuration
Text-to-SpeechTTS provider configuration
GPU AccelerationGPU/CUDA settings
KubernetesK8s namespace, DNS configuration
Agent ConfigurationAgent images and directories
Agent SDK (Pod-Level)TTS, turn management, debouncing inside agent pods
Public URLsFrontend URLs and API endpoints
StorageTemporary directories and paths

Core Server​

Basic server configuration for the STELLA backend.

VariableRequiredDefaultDescription
NODE_ENVNolocalEnvironment mode. Use local for development with localhost URLs, production for deployment with custom domains
PORTNo3000HTTP server port for the backend API
GRPC_PORTNo50051gRPC server port for internal service communication
PRODUCTION_DOMAINNo-Your domain for production deployment (e.g., yourdomain.com). Only used when NODE_ENV=production

Database​

PostgreSQL database connection settings.

VariableRequiredDefaultDescription
DATABASE_URLYes-PostgreSQL connection string. Format: postgresql://user:password@host:port/database?schema=public
POSTGRES_DBNosession_managementDatabase name
POSTGRES_USERNopostgresDatabase username
POSTGRES_PASSWORDYes-Database password. Use a strong, unique password in production

Example Configuration:

POSTGRES_DB=session_management
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your-secure-db-password
DATABASE_URL="postgresql://postgres:your-secure-db-password@localhost:5432/session_management?schema=public"

Security​

Authentication and encryption settings.

VariableRequiredDefaultDescription
JWT_SECRETYes-Secret key for signing JWT tokens. Use 64+ characters in production
ENV_VAR_ENCRYPTION_KEYYes (prod)-AES-256 encryption key for sensitive environment variables stored in database. Generate with: openssl rand -hex 32
Encryption Key Security

The ENV_VAR_ENCRYPTION_KEY must be exactly 64 hex characters (32 bytes). Losing this key means losing access to all encrypted environment variables! Store it securely in a secrets manager.


LiveKit​

WebRTC server configuration for real-time audio/video communication.

VariableRequiredDefaultDescription
LIVEKIT_URLYesws://localhost:7880Internal LiveKit URL for services running in K8s pods
PUBLIC_LIVEKIT_URLYesws://localhost:7880Public LiveKit URL for browser clients
LIVEKIT_API_KEYYesdevkeyLiveKit API key for authentication
LIVEKIT_API_SECRETYessecretLiveKit API secret
LIVEKIT_TURN_ENABLEDNofalseEnable TURN server for NAT traversal in production
LIVEKIT_TURN_DOMAINNo-Domain for TURN server (e.g., turn.yourdomain.com)

URL Configuration:

  • Local development: Both URLs typically point to ws://localhost:7880
  • Production: LIVEKIT_URL uses internal addressing (e.g., ws://host.minikube.internal:7880), while PUBLIC_LIVEKIT_URL uses your public domain with TLS (e.g., wss://livekit.yourdomain.com)

AI APIs​

API keys for AI services used by agents.

VariableRequiredDefaultDescription
OPENAI_API_KEYYes-OpenAI API key for agent conversations. Format: sk-proj-xxxxx
OPENAI_PLAN_GENERATOR_API_KEYNo-Separate OpenAI key for plan generation (cost isolation)

Speech-to-Text​

Configure the speech recognition provider and settings.

VariableRequiredDefaultDescription
STT_PROVIDERNosherpaSTT provider: sherpa (lightweight CPU) or whisper (GPU-accelerated, best accuracy)
Whisper Configuration

These settings only apply when STT_PROVIDER=whisper:

VariableRequiredDefaultDescription
WHISPER_MODELNolarge-v3Model size. Options: tiny.en, base.en, small.en, medium.en (English-only) or tiny, base, small, medium, large-v3 (multilingual)
WHISPER_DEVICENocpuCompute device: cpu or cuda
WHISPER_COMPUTE_TYPENoint8Quantization type: float16, int8, int8_float16
WHISPER_BEAM_SIZENo5Beam search width. Higher = more accurate but slower
WHISPER_LANGUAGENo(auto-detect)Force specific language code (e.g., en, de, fr). Empty for auto-detection
VAD (Voice Activity Detection) Configuration

Silero VAD settings for the whisper provider:

VariableRequiredDefaultDescription
VAD_THRESHOLDNo0.5Voice detection threshold (0.0-1.0). Higher = less sensitive
VAD_MIN_SILENCE_MSNo500Minimum silence duration (ms) before considering speech ended
PARTIAL_INTERVAL_MSNo1000Interval for partial transcription updates

Text-to-Speech​

Configure the speech synthesis provider and settings.

VariableRequiredDefaultDescription
TTS_PROVIDERNopiperTTS provider: piper (fast local CPU), kokoro (fast local GPU), chatterbox (multilingual), elevenlabs (best quality), or auto (fallback chain)

Provider Comparison:

ProviderLatencyQualityCostNotes
piper30-80msGoodFreeCPU-only, lowest latency
kokoro50-100msGoodFreeGPU-accelerated
chatterbox100-200msGoodFreeMultilingual
elevenlabs200-300msExcellentPaidBest voice quality
autoVariesVariesMixedFallback: piper β†’ chatterbox β†’ kokoro
ElevenLabs Configuration

These settings only apply when TTS_PROVIDER=elevenlabs:

VariableRequiredDefaultDescription
ELEVENLABS_API_KEYYes-ElevenLabs API key
ELEVENLABS_VOICE_IDNoXb7hH8MSUJpSbSDYk0k2Voice ID from ElevenLabs
ELEVENLABS_MODEL_IDNoeleven_turbo_v2_5Model ID. eleven_turbo_v2_5 offers best latency
Kokoro Configuration

Kokoro is automatically configured based on GPU settings. When ENABLE_GPU=true, Kokoro uses CUDA acceleration for best performance.


GPU Acceleration​

Configure GPU support for STT and TTS services.

VariableRequiredDefaultDescription
ENABLE_GPUNofalseEnable GPU support. Set to true for CUDA-accelerated inference
ONNX_PROVIDERNoCUDAExecutionProvider,CPUExecutionProviderONNX Runtime execution providers for STT/TTS

Requirements for GPU mode:

  • Linux with NVIDIA GPU (Tesla T4, RTX 3000+, etc.)
  • NVIDIA drivers installed (nvidia-smi should work)
  • K3s with NVIDIA Container Toolkit
macOS

macOS automatically falls back to CPU mode as NVIDIA GPUs are not supported.


Kubernetes​

Kubernetes cluster and DNS configuration.

VariableRequiredDefaultDescription
KUBERNETES_NAMESPACENoai-agentsNamespace for agent pods
CUSTOM_DNS_SERVERSNo-Custom DNS servers for CoreDNS (space-separated). Example: "8.8.8.8 8.8.4.4"
AUTO_DETECT_K8S_DNSNofalseAuto-detect CoreDNS IP in production
KUBERNETES_DNS_NAMESERVERNo10.96.0.10Fallback DNS IP for pod DNS resolution

DNS Configuration:

Custom DNS is useful for bypassing network DNS interception (e.g., corporate SSL inspection):

# Google DNS (recommended for production)
CUSTOM_DNS_SERVERS="8.8.8.8 8.8.4.4"

# Cloudflare DNS
CUSTOM_DNS_SERVERS="1.1.1.1 1.0.0.1"

# Use system default (local development)
CUSTOM_DNS_SERVERS=""

Agent Configuration​

Settings for agent deployment and management.

VariableRequiredDefaultDescription
AGENT_IMAGENoconversational-ai-server:latestDocker image for agent pods
AGENTS_DIRNo./agentsDirectory containing agent definitions

Public URLs​

URLs exposed to clients and frontend applications.

VariableRequiredDefaultDescription
PUBLIC_API_URLNohttp://localhost:3000Public URL for the backend API
VITE_API_URLNohttp://localhost:3000API URL for Vite frontend build
VITE_LIVEKIT_URLNows://localhost:7880LiveKit URL for Vite frontend build

Storage​

File storage and temporary directory configuration.

VariableRequiredDefaultDescription
STELLA_AI_TEMP_DIRNo/tmpTemporary directory for build artifacts, logs, and Docker image exports

Use Cases:

  • Docker build logs
  • K3s image import/export (can be several GB)
  • Temporary K8s manifests
  • PID files for daemon mode

For production with limited root filesystem space:

STELLA_AI_TEMP_DIR=/mnt/stella-ai-temp

Agent SDK (Pod-Level)​

These environment variables are read by the STELLA Agent SDK inside each agent pod. They control audio pipeline behavior, turn management, and TTS. Agents declare them in their agent.yaml manifest under x-stella-optional-env-vars so the frontend deploy modal can expose them.

VariableRequiredDefaultDescription
TTS_ENABLEDNotrueEnable text-to-speech audio output. Set to false for text-only mode (skips TTS connection entirely)
INTERRUPT_MODENononeTranscript interrupt behavior. none = strict turn-based gating (user speech suppressed while agent processes/narrates). smart = reserved for future barge-in with re-prompting
TRANSCRIPT_DEBOUNCE_MSNo300Debounce window in milliseconds for aggregating rapid successive final transcripts. Set to 0 to disable debouncing
DISABLE_AECNofalseDisable Acoustic Echo Cancellation (AEC) for debugging audio feedback issues
STT_WARMUP_ENABLEDNotrueWarm up the STT model on agent start and when participants join. Set to false to skip warmup

Turn Management​

When TTS_ENABLED=true (the default), the SDK enforces strict turn-based flow:

User speaks β†’ Final transcript β†’ Gate CLOSES β†’ Agent processes β†’ TTS narrates β†’ Gate OPENS

While the gate is closed:

  • No partials published to LiveKit (user speech invisible in frontend)
  • No finals queued for the agent (prevents stale/fragmented input)
  • No barge-in callbacks fired (when INTERRUPT_MODE=none)
  • STT stream stays alive (no reconnection cost when gate re-opens)

When TTS_ENABLED=false, the gate still discards finals during processing but allows partials through to LiveKit (lighter turn management since processing completes quickly without narration).

Manifest Declaration​

Agents declare these in agent.yaml so the frontend deploy modal can display them:

configSchema:
# ...
x-stella-optional-env-vars:
- name: TTS_ENABLED
description: "Enable text-to-speech audio output. Set to 'false' for text-only mode."
default: "true"
- name: INTERRUPT_MODE
description: "Transcript interrupt behavior: 'none' (turn-based gating) or 'smart' (barge-in)"
default: "none"
- name: TRANSCRIPT_DEBOUNCE_MS
description: "Debounce window (ms) for aggregating rapid successive final transcripts."
default: "300"

Agent Environment Variable Injection​

STELLA provides a secure mechanism for injecting environment variables into agent pods. This allows users to configure API keys and secrets without exposing them in code.

Flow Diagram​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Frontend UI β”‚ β”‚ STELLA Backend β”‚ β”‚ Kubernetes β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ Create Env │───▢│ Encrypt with │───▢│ Store as β”‚
β”‚ Template β”‚ β”‚ AES-256-GCM β”‚ β”‚ K8s Secret β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Agent Pod │◀───│ Mount Secret │◀───│ Pod Creation β”‚
β”‚ β”‚ β”‚ as Env Vars β”‚ β”‚ β”‚
β”‚ Access via β”‚ β”‚ β”‚ β”‚ Session Start β”‚
β”‚ os.environ β”‚ β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How It Works​

  1. Template Creation: Users create environment variable templates in the Frontend UI
  2. Encrypted Storage: Variables are encrypted with AES-256-GCM using ENV_VAR_ENCRYPTION_KEY
  3. Pod Creation: When a session starts, the backend creates a Kubernetes Secret
  4. Secret Mounting: The secret is mounted into the agent pod as environment variables
  5. Agent Access: Agents access variables via os.environ in Python

Required Agent Variables​

VariableRequiredDescription
OPENAI_API_KEYYesOpenAI API key for conversation
ELEVENLABS_API_KEYNoElevenLabs API key (if using ElevenLabs TTS)

SDK Usage​

Agents using the STELLA SDK can access environment variables through the standard Python os.environ:

import os
from stella_agent import run_agent_from_env

# Access environment variables
openai_key = os.environ.get("OPENAI_API_KEY")
elevenlabs_key = os.environ.get("ELEVENLABS_API_KEY")

# Or use the SDK helper that configures everything
run_agent_from_env()

Security Features​

  • AES-256-GCM encryption: All sensitive variables encrypted at rest
  • Per-session secrets: Each session gets its own Kubernetes Secret
  • Automatic cleanup: Secrets are deleted when the session ends
  • Namespace isolation: Agent pods run in isolated namespace
  • No plaintext storage: Variables never stored in plaintext in database

Example Configurations​

Development Environment​

Minimal configuration for local development:

# .env (Development)
NODE_ENV=local

# Database
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/stella?schema=public"

# LiveKit (local)
LIVEKIT_URL=ws://localhost:7880
PUBLIC_LIVEKIT_URL=ws://localhost:7880
LIVEKIT_API_KEY=devkey
LIVEKIT_API_SECRET=secret

# AI
OPENAI_API_KEY=sk-your-openai-key

# Security (can be simple for local dev)
JWT_SECRET=local-dev-secret-change-in-production

Production Environment​

Full configuration for production deployment:

# .env (Production)
NODE_ENV=production
PRODUCTION_DOMAIN=stella.yourdomain.com

# Database
POSTGRES_DB=stella
POSTGRES_USER=stella_user
POSTGRES_PASSWORD=<strong-password>
DATABASE_URL="postgresql://stella_user:<strong-password>@postgres:5432/stella?schema=public"

# Security
JWT_SECRET=<64+-character-secret>
ENV_VAR_ENCRYPTION_KEY=<output-of-openssl-rand-hex-32>

# LiveKit (production with TLS)
LIVEKIT_URL=ws://host.minikube.internal:7880
PUBLIC_LIVEKIT_URL=wss://livekit.stella.yourdomain.com
LIVEKIT_API_KEY=<your-livekit-key>
LIVEKIT_API_SECRET=<your-livekit-secret>
LIVEKIT_TURN_ENABLED=true
LIVEKIT_TURN_DOMAIN=turn.stella.yourdomain.com

# AI
OPENAI_API_KEY=sk-proj-xxxxx

# GPU (if available)
ENABLE_GPU=true
STT_PROVIDER=whisper
WHISPER_MODEL=large-v3
WHISPER_DEVICE=cuda
TTS_PROVIDER=kokoro

# Kubernetes
KUBERNETES_NAMESPACE=ai-agents
CUSTOM_DNS_SERVERS="8.8.8.8 8.8.4.4"

# Storage
STELLA_AI_TEMP_DIR=/mnt/stella-ai-temp

Security Considerations​

  1. Never commit .env files - The .env file is gitignored by default
  2. Use strong secrets - Generate cryptographic secrets with openssl rand
  3. Rotate keys periodically - Especially JWT_SECRET and ENV_VAR_ENCRYPTION_KEY
  4. Use secrets managers - In production, consider HashiCorp Vault or cloud-native solutions
  5. Limit API key scope - Use API keys with minimal required permissions
  6. Separate keys per environment - Use different API keys for development and production