0Pricing
AI Agents · Lesson

Configuration Profiles for Dev and Prod

Environment-specific configs, feature flags, and staged deployments.

Why Config Profiles Matter

A production agent and a development agent should behave differently: different logging levels, different model tiers (cost vs. quality), different databases, different rate limits. Configuration profiles make this automatic — one environment variable switches all settings at once.

Environment Detection with ENV Variable

The standard pattern is to read an ENV (or ENVIRONMENT) variable that identifies the current deployment context. Your code then selects the appropriate configuration profile based on this value.

import os

# Read the environment identifier
ENV = os.getenv('ENV', 'development').lower()

if ENV not in ('development', 'staging', 'production'):
    raise ValueError(
        f'Invalid ENV value: "{ENV}". '
        f'Must be: development, staging, or production'
    )

print(f'Running in {ENV} mode')

# Usage:
# ENV=development python agent.py   -> dev settings
# ENV=staging python agent.py       -> staging settings
# ENV=production python agent.py    -> prod settings
# python agent.py                   -> defaults to development

All lessons in this course

  1. Environment Variables for Agents
  2. .env Files and python-dotenv
  3. Secrets Rotation and Security
  4. Configuration Profiles for Dev and Prod
← Back to AI Agents