Bypass Temporal for direct agent execution
Build Agents Runtime / build (push) Successful in 4m17s Details

This commit is contained in:
Deep Koluguri 2026-06-21 11:16:03 -04:00
parent 31576a1feb
commit 84b9571d9f
1 changed files with 7 additions and 7 deletions

View File

@ -11,15 +11,15 @@ class WebhookPayload(BaseModel):
sender: str sender: str
targetJid: str targetJid: str
from src.agent import run_agent_activity
async def trigger_workflow(payload: dict): async def trigger_workflow(payload: dict):
try: try:
client = await Client.connect("localhost:7233") # Bypass Temporal for now since it's not deployed in the cluster
await client.execute_workflow( print(f"Directly invoking agent for payload: {payload}")
CentralOrchestratorWorkflow.run, # run_agent_activity is a synchronous function, so run in thread or just call it directly
payload, result = await asyncio.to_thread(run_agent_activity, payload)
id=f"whatsapp-cmd-{payload['sender']}-{asyncio.get_event_loop().time()}", print(f"Agent finished. Result: {result}")
task_queue="agent-task-queue"
)
except Exception as e: except Exception as e:
print(f"Failed to trigger workflow: {e}") print(f"Failed to trigger workflow: {e}")