Skip to content

Commit 5962fb9

Browse files
committed
accept workflows list
1 parent eff0516 commit 5962fb9

File tree

1 file changed

+17
-2
lines changed
  • src/agentex/lib/core/temporal/workers

1 file changed

+17
-2
lines changed

src/agentex/lib/core/temporal/workers/worker.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import uuid
55
from collections.abc import Callable
66
from concurrent.futures import ThreadPoolExecutor
7-
from typing import Any
7+
from typing import Any, overload
88

99
from aiohttp import web
1010
from temporalio.client import Client
@@ -99,10 +99,25 @@ def __init__(
9999
self.healthy = False
100100
self.health_check_port = health_check_port
101101

102+
@overload
102103
async def run(
103104
self,
104105
activities: list[Callable],
105106
workflow: type,
107+
) -> None: ...
108+
109+
@overload
110+
async def run(
111+
self,
112+
activities: list[Callable],
113+
workflows: list[type],
114+
) -> None: ...
115+
116+
async def run(
117+
self,
118+
activities: list[Callable],
119+
workflow: type | None = None,
120+
workflows: list[type] | None = None,
106121
):
107122
await self.start_health_check_server()
108123
await self._register_agent()
@@ -119,7 +134,7 @@ async def run(
119134
client=temporal_client,
120135
task_queue=self.task_queue,
121136
activity_executor=ThreadPoolExecutor(max_workers=self.max_workers),
122-
workflows=[workflow],
137+
workflows=[workflow] if workflows is None else workflows,
123138
activities=activities,
124139
workflow_runner=UnsandboxedWorkflowRunner(),
125140
max_concurrent_activities=self.max_concurrent_activities,

0 commit comments

Comments
 (0)