INNER CODE UNIT · Python
fatal_exit
caipe-io/ai-platform-engineering · ai_platform_engineering/autonomous_agents/src/autonomous_agents/main.py:47
def fatal_exit(message: str, exit_code: int = 1) -> None:
"""Logs a critical error and terminate the process with exit_code.
Uses SystemExit so that pytest/reload loops can catch
it without killing their whole harness, while uvicorn main:app
still terminates normally.
"""
logger.critical(message)
raise SystemExit(exit_code)
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Application lifespan handler."""
settings = get_settings()
logger.info("Starting Autonomous Agents service...")
# Load webhook provider adapters (pointed at by WEBHOOK_PROVIDERS_FILE).