def load_environment_variables(path: Path | None = None):
    """Load environment variables from a .env file.
    If path is not provided, we first look for a .env file in the current working
    directory and then in the repository root.
    """
    if path is None:
        cwd_path = Path.cwd() / ".env"
        repo_path = REPO_ROOT / ".env"
        if cwd_path.exists():
            path = cwd_path
        elif repo_path.exists():
            path = REPO_ROOT / ".env"
        else:
            logger.debug("No .env file found")
            return
    if not path.is_file():
        msg = f"No .env file found at {path}"
        raise FileNotFoundError(msg)
    anything_loaded = load_dotenv(dotenv_path=path)
    if anything_loaded:
        logger.info(f"Loaded environment variables from {path}")
Load environment variables from a .env file.
    If path is not provided, we first look for a .env file in the current working
    directory and then in the repository root.
    
sweagent/utils/config.py