"""Execution backend selection. inline: legacy mode; FastAPI spawns a local background thread. dsh: workbench only creates CampaignRun/TaskQueueItem rows; an external DSH (default) worker leases and executes the content production pipeline. """ from __future__ import annotations import os def execution_backend() -> str: value = os.getenv("YAWAN_EXECUTION_BACKEND", "dsh").strip().lower() return "dsh" if value == "dsh" else "inline" def is_dsh_backend() -> bool: return execution_backend() == "dsh"