Skip to content

Commit 643e691

Browse files
committed
feat: apply overwrites
1 parent 03a4ae9 commit 643e691

File tree

4 files changed

+44
-18
lines changed

4 files changed

+44
-18
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "UiPath Langchain"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"
77
dependencies = [
8-
"uipath>=2.1.123, <2.2.0",
8+
"uipath>=2.1.131, <2.2.0",
99
"langgraph>=0.5.0, <0.7.0",
1010
"langchain-core>=0.3.34",
1111
"langgraph-checkpoint-sqlite>=2.0.3",

src/uipath_langchain/_cli/cli_debug.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
from uipath._cli._runtime._contracts import (
1212
UiPathRuntimeFactory,
1313
)
14+
from uipath._cli._utils._console import ConsoleLogger
15+
from uipath._cli._utils._studio_project import StudioClient
1416
from uipath._cli.middlewares import MiddlewareResult
17+
from uipath._config import UiPathConfig
18+
from uipath._utils._bindings import ResourceOverwritesContext
1519
from uipath.tracing import LlmOpsHttpExporter
1620

1721
from .._tracing import _instrument_traceable_attributes
@@ -22,7 +26,7 @@
2226
)
2327
from ._utils._graph import LangGraphConfig
2428

25-
29+
console = ConsoleLogger.get_instance()
2630
def langgraph_debug_middleware(
2731
entrypoint: Optional[str], input: Optional[str], resume: bool, **kwargs
2832
) -> MiddlewareResult:
@@ -65,17 +69,29 @@ def generate_runtime(
6569
runtime_factory.add_span_exporter(
6670
LlmOpsHttpExporter(extra_process_spans=True)
6771
)
72+
async def execute_debug_runtime():
73+
async with UiPathDebugRuntime.from_debug_context(
74+
factory=runtime_factory,
75+
context=context,
76+
debug_bridge=debug_bridge,
77+
) as debug_runtime:
78+
await debug_runtime.execute()
6879

6980
runtime_factory.add_instrumentor(LangChainInstrumentor, get_current_span)
7081

7182
debug_bridge: UiPathDebugBridge = get_debug_bridge(context)
72-
73-
async with UiPathDebugRuntime.from_debug_context(
74-
factory=runtime_factory,
75-
context=context,
76-
debug_bridge=debug_bridge,
77-
) as debug_runtime:
78-
await debug_runtime.execute()
83+
project_id = UiPathConfig.project_id
84+
85+
if project_id:
86+
studio_client = StudioClient(project_id)
87+
88+
async with ResourceOverwritesContext(
89+
lambda: studio_client.get_resource_overwrites()
90+
) as ctx:
91+
console.info(f"Applied {ctx.overwrites_count} overwrite(s)")
92+
await execute_debug_runtime()
93+
else:
94+
await execute_debug_runtime()
7995

8096
asyncio.run(execute())
8197

src/uipath_langchain/_cli/cli_run.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
UiPathRuntimeFactory,
1212
UiPathRuntimeResult,
1313
)
14+
from uipath._cli._utils._common import read_resource_overwrites_from_file
15+
from uipath._cli._utils._console import ConsoleLogger
1416
from uipath._cli.middlewares import MiddlewareResult
1517
from uipath._events._events import UiPathAgentStateEvent
18+
from uipath._utils._bindings import ResourceOverwritesContext
1619
from uipath.tracing import JsonLinesFileExporter, LlmOpsHttpExporter
1720

1821
from .._tracing import (
@@ -25,6 +28,7 @@
2528
)
2629
from ._utils._graph import LangGraphConfig
2730

31+
console = ConsoleLogger.get_instance()
2832

2933
def langgraph_run_middleware(
3034
entrypoint: Optional[str],
@@ -72,10 +76,16 @@ def generate_runtime(
7276
runtime_factory.add_span_exporter(JsonLinesFileExporter(trace_file))
7377

7478
if context.job_id:
75-
runtime_factory.add_span_exporter(
76-
LlmOpsHttpExporter(extra_process_spans=True)
77-
)
78-
await runtime_factory.execute(context)
79+
async with ResourceOverwritesContext(
80+
lambda: read_resource_overwrites_from_file(context.runtime_dir)
81+
) as ctx:
82+
console.info(
83+
f"Applied {ctx.overwrites_count} resource overwrite(s)"
84+
)
85+
runtime_factory.add_span_exporter(
86+
LlmOpsHttpExporter(extra_process_spans=True)
87+
)
88+
await runtime_factory.execute(context)
7989
else:
8090
debug_bridge: UiPathDebugBridge = ConsoleDebugBridge()
8191
await debug_bridge.emit_execution_started(context.execution_id)

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)