Skip to content

Commit bef6bc8

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

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-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: 17 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,
@@ -207,6 +208,7 @@ def test_get_factory_by_name(clean_registry):
207208

208209
def create_factory(
209210
context: UiPathRuntimeContext | None = None,
211+
trace_manager: UiPathTraceManager | None = None,
210212
) -> UiPathRuntimeFactoryProtocol:
211213
return MockLangGraphFactory(context)
212214

@@ -222,6 +224,7 @@ def test_get_factory_by_name_with_context(clean_registry):
222224

223225
def create_factory(
224226
context: UiPathRuntimeContext | None = None,
227+
trace_manager: UiPathTraceManager | None = None,
225228
) -> UiPathRuntimeFactoryProtocol:
226229
return MockLangGraphFactory(context)
227230

@@ -244,11 +247,13 @@ def test_auto_detect_langgraph_json(clean_registry, temp_dir):
244247

245248
def create_functions(
246249
context: UiPathRuntimeContext | None = None,
250+
trace_manager: UiPathTraceManager | None = None,
247251
) -> UiPathRuntimeFactoryProtocol:
248252
return MockFunctionsFactory(context)
249253

250254
def create_langgraph(
251255
context: UiPathRuntimeContext | None = None,
256+
trace_manager: UiPathTraceManager | None = None,
252257
) -> UiPathRuntimeFactoryProtocol:
253258
return MockLangGraphFactory(context)
254259

@@ -269,11 +274,13 @@ def test_auto_detect_llamaindex_json(clean_registry, temp_dir):
269274

270275
def create_functions(
271276
context: UiPathRuntimeContext | None = None,
277+
trace_manager: UiPathTraceManager | None = None,
272278
) -> UiPathRuntimeFactoryProtocol:
273279
return MockFunctionsFactory(context)
274280

275281
def create_llamaindex(
276282
context: UiPathRuntimeContext | None = None,
283+
trace_manager: UiPathTraceManager | None = None,
277284
) -> UiPathRuntimeFactoryProtocol:
278285
return MockLlamaIndexFactory(context)
279286

@@ -294,11 +301,13 @@ def test_auto_detect_uipath_json(clean_registry, temp_dir):
294301

295302
def create_functions(
296303
context: UiPathRuntimeContext | None = None,
304+
trace_manager: UiPathTraceManager | None = None,
297305
) -> UiPathRuntimeFactoryProtocol:
298306
return MockFunctionsFactory(context)
299307

300308
def create_langgraph(
301309
context: UiPathRuntimeContext | None = None,
310+
trace_manager: UiPathTraceManager | None = None,
302311
) -> UiPathRuntimeFactoryProtocol:
303312
return MockLangGraphFactory(context)
304313

@@ -319,11 +328,13 @@ def test_fallback_to_default(clean_registry, temp_dir):
319328

320329
def create_functions(
321330
context: UiPathRuntimeContext | None = None,
331+
trace_manager: UiPathTraceManager | None = None,
322332
) -> UiPathRuntimeFactoryProtocol:
323333
return MockFunctionsFactory(context)
324334

325335
def create_langgraph(
326336
context: UiPathRuntimeContext | None = None,
337+
trace_manager: UiPathTraceManager | None = None,
327338
) -> UiPathRuntimeFactoryProtocol:
328339
return MockLangGraphFactory(context)
329340

@@ -342,6 +353,7 @@ def test_no_default_no_config_raises_error(clean_registry, temp_dir):
342353

343354
def create_factory(
344355
context: UiPathRuntimeContext | None = None,
356+
trace_manager: UiPathTraceManager | None = None,
345357
) -> UiPathRuntimeFactoryProtocol:
346358
return MockFunctionsFactory(context)
347359

@@ -358,11 +370,13 @@ def test_priority_langgraph_over_uipath(clean_registry, temp_dir):
358370

359371
def create_functions(
360372
context: UiPathRuntimeContext | None = None,
373+
trace_manager: UiPathTraceManager | None = None,
361374
) -> UiPathRuntimeFactoryProtocol:
362375
return MockFunctionsFactory(context)
363376

364377
def create_langgraph(
365378
context: UiPathRuntimeContext | None = None,
379+
trace_manager: UiPathTraceManager | None = None,
366380
) -> UiPathRuntimeFactoryProtocol:
367381
return MockLangGraphFactory(context)
368382

@@ -385,6 +399,7 @@ async def test_factory_discover_entrypoints(clean_registry):
385399

386400
def create_factory(
387401
context: UiPathRuntimeContext | None = None,
402+
trace_manager: UiPathTraceManager | None = None,
388403
) -> UiPathRuntimeFactoryProtocol:
389404
return MockLangGraphFactory(context)
390405

@@ -401,6 +416,7 @@ async def test_factory_create_runtime(clean_registry):
401416

402417
def create_factory(
403418
context: UiPathRuntimeContext | None = None,
419+
trace_manager: UiPathTraceManager | None = None,
404420
) -> UiPathRuntimeFactoryProtocol:
405421
return MockLangGraphFactory(context)
406422

@@ -417,6 +433,7 @@ def test_get_all_returns_copy(clean_registry):
417433

418434
def create_factory(
419435
context: UiPathRuntimeContext | None = None,
436+
trace_manager: UiPathTraceManager | None = None,
420437
) -> UiPathRuntimeFactoryProtocol:
421438
return MockFunctionsFactory(context)
422439

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)