From 84b9571d9f5568fe8b50843080d3cd722c1fe68f Mon Sep 17 00:00:00 2001 From: Deep Koluguri Date: Sun, 21 Jun 2026 11:16:03 -0400 Subject: [PATCH] Bypass Temporal for direct agent execution --- src/api.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api.py b/src/api.py index a83b134..2d21e57 100644 --- a/src/api.py +++ b/src/api.py @@ -11,15 +11,15 @@ class WebhookPayload(BaseModel): sender: str targetJid: str +from src.agent import run_agent_activity + async def trigger_workflow(payload: dict): try: - client = await Client.connect("localhost:7233") - await client.execute_workflow( - CentralOrchestratorWorkflow.run, - payload, - id=f"whatsapp-cmd-{payload['sender']}-{asyncio.get_event_loop().time()}", - task_queue="agent-task-queue" - ) + # Bypass Temporal for now since it's not deployed in the cluster + print(f"Directly invoking agent for payload: {payload}") + # run_agent_activity is a synchronous function, so run in thread or just call it directly + result = await asyncio.to_thread(run_agent_activity, payload) + print(f"Agent finished. Result: {result}") except Exception as e: print(f"Failed to trigger workflow: {e}")