<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/8.3-environment-variables -->

# Environment Variables

- docker/Dockerfile
- docker/Dockerfile.chat
- docker/Dockerfile.dev
- docker/Dockerfile.ui
- docker/README.md
- examples/python/performance_monitoring_demo.py
- src/praisonai-agents/TELEMETRY_SUMMARY.md
- src/praisonai-agents/debug_auto_instrument.py
- src/praisonai-agents/debug_telemetry.py
- src/praisonai-agents/debug_telemetry_double.py
- src/praisonai-agents/praisonaiagents/telemetry/README.md
- src/praisonai-agents/praisonaiagents/telemetry/__init__.py
- src/praisonai-agents/praisonaiagents/telemetry/integration.py
- src/praisonai-agents/praisonaiagents/telemetry/performance_cli.py
- src/praisonai-agents/praisonaiagents/telemetry/performance_monitor.py
- src/praisonai-agents/praisonaiagents/telemetry/performance_utils.py
- src/praisonai-agents/praisonaiagents/telemetry/telemetry.py
- src/praisonai-agents/pyproject.toml
- src/praisonai-agents/telemetry_analysis.md
- src/praisonai-agents/test_telemetry_performance.py
- src/praisonai-agents/uv.lock
- src/praisonai/praisonai.rb
- src/praisonai/praisonai/cli/main.py
- src/praisonai/praisonai/deploy.py
- src/praisonai/praisonai/version.py
- src/praisonai/pyproject.toml
- src/praisonai/uv.lock

This document describes all environment variables used by PraisonAI for configuration. Environment variables provide the primary mechanism for configuring API keys, model selection, directory paths, service ports, and feature flags across both development and production deployments.

For information about consolidated configuration parameters (memory, output, execution, etc.), see [Consolidated Parameters](/MervinPraison/PraisonAI/8.1-consolidated-parameters). For preset configurations, see [Presets and Defaults](/MervinPraison/PraisonAI/8.2-presets-and-defaults).

## Overview

PraisonAI uses environment variables for three primary purposes:

1. LLM Provider Configuration - API keys, base URLs, model selection
2. Directory and Path Management - Config directories, database locations, application roots
3. Service and Runtime Configuration - Port numbers, hosts, logging levels, telemetry flags

Environment variables can be set via:

- .env files (loaded via python-dotenv )
- Shell exports ( export VAR_NAME=value )
- Docker environment declarations ( ENV in Dockerfiles, environment: in docker-compose)
- CI/CD secrets (GitHub Actions secrets)

## LLM Provider Configuration

### Model Selection

PraisonAI supports multiple environment variables for model configuration with a specific precedence order:

```

```

**Sources:** [src/praisonai/praisonai/cli/main.py224-232](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L224-L232)

**Example Usage:**

```

```

**Sources:** [src/praisonai/praisonai/cli/main.py214-242](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L214-L242) [src/praisonai/praisonai/deploy.py92-96](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L92-L96)

### Provider-Specific Keys

PraisonAI supports multiple LLM providers through environment-specific API keys:

**Sources:** [.github/workflows/test-real.yml67-69](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-real.yml#L67-L69) [src/praisonai/pyproject.toml37-42](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L37-L42)

## Directory and Path Configuration

PraisonAI consolidates configuration files and runtime data into a single directory to prevent clutter in the working directory:

```

```

**Sources:** [docker/README.md59-67](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L59-L67)

### Configuration Directory Variables

**Docker Configuration:**

```

```

**Sources:** [docker/Dockerfile.dev40-44](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L40-L44) [docker/Dockerfile.ui26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L26-L30) [docker/Dockerfile.chat26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L26-L30)

**CLI Dynamic Configuration:**

The CLI dynamically sets `CHAINLIT_APP_ROOT` if not already present:

```

```

**Sources:** [src/praisonai/praisonai/cli/main.py109-113](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L109-L113)

### Path Resolution

The directory structure created by these variables:

```
~/.praison/
|-- database.sqlite      # Chainlit conversation history (CHAINLIT_DB_DIR)
|-- chainlit.md         # Chainlit welcome message (CHAINLIT_CONFIG_DIR)
|-- .chainlit/          # Chainlit runtime files (CHAINLIT_CONFIG_DIR)
|-- .files/             # Uploaded files storage (CHAINLIT_APP_ROOT)
|-- config/             # PraisonAI agent configurations (PRAISON_CONFIG_DIR)
`-- public/             # Static assets (CHAINLIT_APP_ROOT)
```

**Sources:** [docker/README.md62-67](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L62-L67)

## Service Configuration

PraisonAI's multi-service architecture uses environment variables for service-specific configuration:

```

```

**Sources:** [docker/README.md76-100](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L76-L100)

### Service-Specific Variables

**Docker Compose Example:**

```

```

**Sources:** [docker/README.md79-99](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L79-L99)

## Logging and Debugging

### Log Level Configuration

**Log Level Impact:**

```

```

**Sources:** [src/praisonai/praisonai/cli/main.py173-184](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L173-L184)

**CI/CD Usage:**

GitHub Actions workflows set `LOGLEVEL=DEBUG` for detailed test output:

```

```

**Sources:** [.github/workflows/unittest.yml39](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/unittest.yml#L39-L39) [.github/workflows/test-core.yml46](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-core.yml#L46-L46)

## Telemetry and Tracking

PraisonAI respects user privacy through multiple telemetry control variables:

```

```

**Sources:** [.github/workflows/test-extended.yml47-49](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-extended.yml#L47-L49) [.github/workflows/test-extended.yml107-109](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-extended.yml#L107-L109)

**Example: Disable All Telemetry**

```

```

**Sources:** [.github/workflows/test-extended.yml47-49](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-extended.yml#L47-L49)

## Development and Testing

### Test Environment Variables

```

```

**Sources:** [.github/workflows/unittest.yml34-40](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/unittest.yml#L34-L40) [.github/workflows/test-core.yml41-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-core.yml#L41-L47)

### Test Configuration Variables

**GitHub Actions Test Setup:**

```

```

**Sources:** [.github/workflows/unittest.yml34-40](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/unittest.yml#L34-L40)

### Mock vs Real Test Distinction

PraisonAI uses pytest markers to distinguish between tests:

- Mock Tests ( -m 'not real' ): Run with fake API keys, use mocked responses, safe for CI/CD
- Real Tests ( -m real ): Make actual API calls, require valid API keys, incur costs

**Sources:** [.github/workflows/test-real.yml1-24](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/.github/workflows/test-real.yml#L1-L24) [src/praisonai/tests/test.py16-21](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/tests/test.py#L16-L21)

## Cloud Deployment Configuration

### GCP Cloud Run Deployment

The `CloudDeployer` class uses environment variables for deployment configuration:

```

```

**Sources:** [src/praisonai/praisonai/deploy.py1-186](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L1-L186)

**Environment Variable Propagation:**

```

```

**Sources:** [src/praisonai/praisonai/deploy.py92-96](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L92-L96) [src/praisonai/praisonai/deploy.py131-149](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L131-L149)

## Environment Variable Precedence

PraisonAI resolves environment variables with the following precedence (highest to lowest):

```

```

**Resolution Examples:**

1. Shell export overrides .env:
2. Docker ENV overrides compose:

**Sources:** [src/praisonai/praisonai/cli/main.py56-58](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L56-L58) [src/praisonai/praisonai/deploy.py32-34](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L32-L34)

## Complete Reference Table

*Required for real API operations; tests use mock values if not provided.

**Sources:** All sources cited throughout this document.
