From f1f55b3cb7d02784d1bc1d44328c28e30c9e544e Mon Sep 17 00:00:00 2001 From: Dmitry Paramonov Date: Tue, 17 Sep 2024 17:10:29 +0300 Subject: [PATCH] fix: Start workflows asynchronously --- agents-api/agents_api/clients/temporal.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/agents-api/agents_api/clients/temporal.py b/agents-api/agents_api/clients/temporal.py index 9cd5fbe47..75d6f796b 100644 --- a/agents-api/agents_api/clients/temporal.py +++ b/agents-api/agents_api/clients/temporal.py @@ -75,10 +75,12 @@ async def get_workflow_handle( async def run_truncation_task( token_count_threshold: int, developer_id: UUID, session_id: UUID, job_id: UUID ): + from ..workflows.truncation import TruncationWorkflow + client = await get_client() - await client.execute_workflow( - "TruncationWorkflow", + await client.start_workflow( + TruncationWorkflow.run, args=[str(developer_id), str(session_id), token_count_threshold], task_queue="memory-task-queue", id=str(job_id), @@ -86,10 +88,12 @@ async def run_truncation_task( async def run_summarization_task(session_id: UUID, job_id: UUID): + from ..workflows.summarization import SummarizationWorkflow + client = await get_client() - await client.execute_workflow( - "SummarizationWorkflow", + await client.start_workflow( + SummarizationWorkflow.run, args=[str(session_id)], task_queue="memory-task-queue", id=str(job_id),