import asyncio import os import sys import logging from temporalio.client import Client from temporalio.worker import Worker # Configure basic logging so we can see output in Kubernetes logs logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s") logger = logging.getLogger(__name__) from curaflow_agent.workflows import ClinicalIntakeWorkflow from curaflow_agent.activities import structure_note_activity, generate_billing_codes_activity async def main(): temporal_url = os.environ.get("TEMPORAL_URL", "temporal-frontend.ai-core.svc.cluster.local:7233") temporal_namespace = os.environ.get("TEMPORAL_NAMESPACE", "default") task_queue = os.environ.get("CURAFLOW_TASK_QUEUE", "curaflow-tasks") logger.info(f"Connecting to Temporal cluster at {temporal_url} (Namespace: {temporal_namespace})") try: client = await Client.connect(temporal_url, namespace=temporal_namespace) logger.info("Successfully connected to Temporal!") except Exception as e: logger.error(f"Failed to connect to Temporal: {e}") sys.exit(1) worker = Worker( client, task_queue=task_queue, workflows=[ClinicalIntakeWorkflow], activities=[structure_note_activity, generate_billing_codes_activity], ) logger.info(f"Starting CuraFlow agent worker on queue '{task_queue}'...") await worker.run() if __name__ == "__main__": asyncio.run(main()) # Trigger CI/CD # Trigger CI/CD again