File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
src/agentex/lib/core/temporal/workers Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 44import uuid
55from collections .abc import Callable
66from concurrent .futures import ThreadPoolExecutor
7- from typing import Any
7+ from typing import Any , overload
88
99from aiohttp import web
1010from 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 ,
You can’t perform that action at this time.
0 commit comments