Skip to content

Commit 0325c71

Browse files
committed
fix: add trace manager to registry
1 parent df8936e commit 0325c71

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-runtime"
3-
version = "0.0.16"
3+
version = "0.0.17"
44
description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/runtime/registry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
from pathlib import Path
44
from typing import Callable, TypeAlias
55

6+
from uipath.core.tracing import UiPathTraceManager
7+
68
from uipath.runtime.context import UiPathRuntimeContext
79
from uipath.runtime.factory import UiPathRuntimeFactoryProtocol
810

911
FactoryCallable: TypeAlias = Callable[
10-
[UiPathRuntimeContext | None], UiPathRuntimeFactoryProtocol
12+
[UiPathRuntimeContext | None, UiPathTraceManager | None],
13+
UiPathRuntimeFactoryProtocol,
1114
]
1215

1316

@@ -41,6 +44,7 @@ def get(
4144
name: str | None = None,
4245
search_path: str = ".",
4346
context: UiPathRuntimeContext | None = None,
47+
trace_manager: UiPathTraceManager | None = None,
4448
) -> UiPathRuntimeFactoryProtocol:
4549
"""Get factory instance by name or auto-detect from config files.
4650
@@ -56,20 +60,20 @@ def get(
5660
if name not in cls._factories:
5761
raise ValueError(f"Factory '{name}' not registered")
5862
factory_callable, _ = cls._factories[name]
59-
return factory_callable(context)
63+
return factory_callable(context, trace_manager)
6064

6165
# Auto-detect based on config files in reverse registration order
6266
search_dir = Path(search_path)
6367
for factory_name in reversed(cls._registration_order):
6468
factory_callable, config_file = cls._factories[factory_name]
6569
if (search_dir / config_file).exists():
66-
return factory_callable(context)
70+
return factory_callable(context, trace_manager)
6771

6872
# Fallback to default
6973
if cls._default_name is None:
7074
raise ValueError("No default factory registered and no config file found")
7175
factory_callable, _ = cls._factories[cls._default_name]
72-
return factory_callable(context)
76+
return factory_callable(context, trace_manager)
7377

7478
@classmethod
7579
def set_default(cls, name: str) -> None:

tests/test_registry.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Any, AsyncGenerator, Optional, cast
44

55
import pytest
6+
from uipath.core.tracing import UiPathTraceManager
67

78
from uipath.runtime import (
89
UiPathExecuteOptions,
@@ -139,6 +140,7 @@ def test_register_single_factory(clean_registry):
139140

140141
def create_factory(
141142
context: UiPathRuntimeContext | None = None,
143+
trace_manager: UiPathTraceManager | None = None,
142144
) -> UiPathRuntimeFactoryProtocol:
143145
return MockFunctionsFactory(context)
144146

@@ -154,16 +156,19 @@ def test_register_multiple_factories(clean_registry):
154156

155157
def create_functions(
156158
context: UiPathRuntimeContext | None = None,
159+
trace_manager: UiPathTraceManager | None = None,
157160
) -> UiPathRuntimeFactoryProtocol:
158161
return MockFunctionsFactory(context)
159162

160163
def create_langgraph(
161164
context: UiPathRuntimeContext | None = None,
165+
trace_manager: UiPathTraceManager | None = None,
162166
) -> UiPathRuntimeFactoryProtocol:
163167
return MockLangGraphFactory(context)
164168

165169
def create_llamaindex(
166170
context: UiPathRuntimeContext | None = None,
171+
trace_manager: UiPathTraceManager | None = None,
167172
) -> UiPathRuntimeFactoryProtocol:
168173
return MockLlamaIndexFactory(context)
169174

@@ -187,6 +192,7 @@ def test_set_default_factory(clean_registry):
187192

188193
def create_factory(
189194
context: UiPathRuntimeContext | None = None,
195+
trace_manager: UiPathTraceManager | None = None,
190196
) -> UiPathRuntimeFactoryProtocol:
191197
return MockFunctionsFactory(context)
192198

@@ -207,6 +213,7 @@ def test_get_factory_by_name(clean_registry):
207213

208214
def create_factory(
209215
context: UiPathRuntimeContext | None = None,
216+
trace_manager: UiPathTraceManager | None = None,
210217
) -> UiPathRuntimeFactoryProtocol:
211218
return MockLangGraphFactory(context)
212219

@@ -222,6 +229,7 @@ def test_get_factory_by_name_with_context(clean_registry):
222229

223230
def create_factory(
224231
context: UiPathRuntimeContext | None = None,
232+
trace_manager: UiPathTraceManager | None = None,
225233
) -> UiPathRuntimeFactoryProtocol:
226234
return MockLangGraphFactory(context)
227235

@@ -244,11 +252,13 @@ def test_auto_detect_langgraph_json(clean_registry, temp_dir):
244252

245253
def create_functions(
246254
context: UiPathRuntimeContext | None = None,
255+
trace_manager: UiPathTraceManager | None = None,
247256
) -> UiPathRuntimeFactoryProtocol:
248257
return MockFunctionsFactory(context)
249258

250259
def create_langgraph(
251260
context: UiPathRuntimeContext | None = None,
261+
trace_manager: UiPathTraceManager | None = None,
252262
) -> UiPathRuntimeFactoryProtocol:
253263
return MockLangGraphFactory(context)
254264

@@ -269,11 +279,13 @@ def test_auto_detect_llamaindex_json(clean_registry, temp_dir):
269279

270280
def create_functions(
271281
context: UiPathRuntimeContext | None = None,
282+
trace_manager: UiPathTraceManager | None = None,
272283
) -> UiPathRuntimeFactoryProtocol:
273284
return MockFunctionsFactory(context)
274285

275286
def create_llamaindex(
276287
context: UiPathRuntimeContext | None = None,
288+
trace_manager: UiPathTraceManager | None = None,
277289
) -> UiPathRuntimeFactoryProtocol:
278290
return MockLlamaIndexFactory(context)
279291

@@ -294,11 +306,13 @@ def test_auto_detect_uipath_json(clean_registry, temp_dir):
294306

295307
def create_functions(
296308
context: UiPathRuntimeContext | None = None,
309+
trace_manager: UiPathTraceManager | None = None,
297310
) -> UiPathRuntimeFactoryProtocol:
298311
return MockFunctionsFactory(context)
299312

300313
def create_langgraph(
301314
context: UiPathRuntimeContext | None = None,
315+
trace_manager: UiPathTraceManager | None = None,
302316
) -> UiPathRuntimeFactoryProtocol:
303317
return MockLangGraphFactory(context)
304318

@@ -319,11 +333,13 @@ def test_fallback_to_default(clean_registry, temp_dir):
319333

320334
def create_functions(
321335
context: UiPathRuntimeContext | None = None,
336+
trace_manager: UiPathTraceManager | None = None,
322337
) -> UiPathRuntimeFactoryProtocol:
323338
return MockFunctionsFactory(context)
324339

325340
def create_langgraph(
326341
context: UiPathRuntimeContext | None = None,
342+
trace_manager: UiPathTraceManager | None = None,
327343
) -> UiPathRuntimeFactoryProtocol:
328344
return MockLangGraphFactory(context)
329345

@@ -342,6 +358,7 @@ def test_no_default_no_config_raises_error(clean_registry, temp_dir):
342358

343359
def create_factory(
344360
context: UiPathRuntimeContext | None = None,
361+
trace_manager: UiPathTraceManager | None = None,
345362
) -> UiPathRuntimeFactoryProtocol:
346363
return MockFunctionsFactory(context)
347364

@@ -358,11 +375,13 @@ def test_priority_langgraph_over_uipath(clean_registry, temp_dir):
358375

359376
def create_functions(
360377
context: UiPathRuntimeContext | None = None,
378+
trace_manager: UiPathTraceManager | None = None,
361379
) -> UiPathRuntimeFactoryProtocol:
362380
return MockFunctionsFactory(context)
363381

364382
def create_langgraph(
365383
context: UiPathRuntimeContext | None = None,
384+
trace_manager: UiPathTraceManager | None = None,
366385
) -> UiPathRuntimeFactoryProtocol:
367386
return MockLangGraphFactory(context)
368387

@@ -385,6 +404,7 @@ async def test_factory_discover_entrypoints(clean_registry):
385404

386405
def create_factory(
387406
context: UiPathRuntimeContext | None = None,
407+
trace_manager: UiPathTraceManager | None = None,
388408
) -> UiPathRuntimeFactoryProtocol:
389409
return MockLangGraphFactory(context)
390410

@@ -401,6 +421,7 @@ async def test_factory_create_runtime(clean_registry):
401421

402422
def create_factory(
403423
context: UiPathRuntimeContext | None = None,
424+
trace_manager: UiPathTraceManager | None = None,
404425
) -> UiPathRuntimeFactoryProtocol:
405426
return MockLangGraphFactory(context)
406427

@@ -417,6 +438,7 @@ def test_get_all_returns_copy(clean_registry):
417438

418439
def create_factory(
419440
context: UiPathRuntimeContext | None = None,
441+
trace_manager: UiPathTraceManager | None = None,
420442
) -> UiPathRuntimeFactoryProtocol:
421443
return MockFunctionsFactory(context)
422444

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)