diff --git a/pyproject.toml b/pyproject.toml index cd0941cb..0e2b51b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "UiPath Langchain" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.10" dependencies = [ - "uipath>=2.1.123, <2.2.0", + "uipath>=2.1.131, <2.2.0", "langgraph>=0.5.0, <0.7.0", "langchain-core>=0.3.34", "langgraph-checkpoint-sqlite>=2.0.3", diff --git a/src/uipath_langchain/_cli/cli_debug.py b/src/uipath_langchain/_cli/cli_debug.py index 3c0c526f..6e15f6d1 100644 --- a/src/uipath_langchain/_cli/cli_debug.py +++ b/src/uipath_langchain/_cli/cli_debug.py @@ -11,7 +11,11 @@ from uipath._cli._runtime._contracts import ( UiPathRuntimeFactory, ) +from uipath._cli._utils._console import ConsoleLogger +from uipath._cli._utils._studio_project import StudioClient from uipath._cli.middlewares import MiddlewareResult +from uipath._config import UiPathConfig +from uipath._utils._bindings import ResourceOverwritesContext from uipath.tracing import LlmOpsHttpExporter from .._tracing import _instrument_traceable_attributes @@ -22,7 +26,7 @@ ) from ._utils._graph import LangGraphConfig - +console = ConsoleLogger.get_instance() def langgraph_debug_middleware( entrypoint: Optional[str], input: Optional[str], resume: bool, **kwargs ) -> MiddlewareResult: @@ -65,17 +69,29 @@ def generate_runtime( runtime_factory.add_span_exporter( LlmOpsHttpExporter(extra_process_spans=True) ) + async def execute_debug_runtime(): + async with UiPathDebugRuntime.from_debug_context( + factory=runtime_factory, + context=context, + debug_bridge=debug_bridge, + ) as debug_runtime: + await debug_runtime.execute() runtime_factory.add_instrumentor(LangChainInstrumentor, get_current_span) debug_bridge: UiPathDebugBridge = get_debug_bridge(context) - - async with UiPathDebugRuntime.from_debug_context( - factory=runtime_factory, - context=context, - debug_bridge=debug_bridge, - ) as debug_runtime: - await debug_runtime.execute() + project_id = UiPathConfig.project_id + + if project_id: + studio_client = StudioClient(project_id) + + async with ResourceOverwritesContext( + lambda: studio_client.get_resource_overwrites() + ) as ctx: + console.info(f"Applied {ctx.overwrites_count} overwrite(s)") + await execute_debug_runtime() + else: + await execute_debug_runtime() asyncio.run(execute()) diff --git a/src/uipath_langchain/_cli/cli_run.py b/src/uipath_langchain/_cli/cli_run.py index 819c2ae9..ae815ae4 100644 --- a/src/uipath_langchain/_cli/cli_run.py +++ b/src/uipath_langchain/_cli/cli_run.py @@ -11,8 +11,11 @@ UiPathRuntimeFactory, UiPathRuntimeResult, ) +from uipath._cli._utils._common import read_resource_overwrites_from_file +from uipath._cli._utils._console import ConsoleLogger from uipath._cli.middlewares import MiddlewareResult from uipath._events._events import UiPathAgentStateEvent +from uipath._utils._bindings import ResourceOverwritesContext from uipath.tracing import JsonLinesFileExporter, LlmOpsHttpExporter from .._tracing import ( @@ -25,6 +28,7 @@ ) from ._utils._graph import LangGraphConfig +console = ConsoleLogger.get_instance() def langgraph_run_middleware( entrypoint: Optional[str], @@ -72,10 +76,16 @@ def generate_runtime( runtime_factory.add_span_exporter(JsonLinesFileExporter(trace_file)) if context.job_id: - runtime_factory.add_span_exporter( - LlmOpsHttpExporter(extra_process_spans=True) - ) - await runtime_factory.execute(context) + async with ResourceOverwritesContext( + lambda: read_resource_overwrites_from_file(context.runtime_dir) + ) as ctx: + console.info( + f"Applied {ctx.overwrites_count} resource overwrite(s)" + ) + runtime_factory.add_span_exporter( + LlmOpsHttpExporter(extra_process_spans=True) + ) + await runtime_factory.execute(context) else: debug_bridge: UiPathDebugBridge = ConsoleDebugBridge() await debug_bridge.emit_execution_started(context.execution_id) diff --git a/uv.lock b/uv.lock index c239f305..94e6a712 100644 --- a/uv.lock +++ b/uv.lock @@ -3322,7 +3322,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.1.119" +version = "2.1.131" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "azure-monitor-opentelemetry" }, @@ -3344,14 +3344,14 @@ dependencies = [ { name = "tomli" }, { name = "truststore" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/0c/c3/4e3c4a8a5e623d4bd1ee8cd52a9b4c94379196374484a9eb0ee13d14e9c5/uipath-2.1.119.tar.gz", hash = "sha256:a7ac5c6cc6299e024b8b4a8d76fe10413972a5ebe089a5c7eedb7b4f60f212bb", size = 2340717, upload-time = "2025-10-29T09:29:37.207Z" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/2a/9c0a31e05319aa14c3e7ffddacc46ad079b817cd2320937af35e9cc6c545/uipath-2.1.131.tar.gz", hash = "sha256:1bacd586b53b64b774a9f3b85fa2a570251b76b884bd6b44834468a616df0847", size = 2362015, upload-time = "2025-10-31T13:03:39.812Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/71/eb/be1dac1b7c8bb966cfa734d2d3eb4831c70a5fa85d9d4fb67fdef39eb6a4/uipath-2.1.119-py3-none-any.whl", hash = "sha256:999600d1f1d611d4f7adbae269b8af2f615afddf8b5e2bae6db91c33e62218e7", size = 359218, upload-time = "2025-10-29T09:29:35.377Z" }, + { url = "https://files.pythonhosted.org/packages/19/ba/ff45f84337a9451f05b368e85886589075891a902a4664a33ef3d7a0201f/uipath-2.1.131-py3-none-any.whl", hash = "sha256:5ef8144a9bc51814e26db461fd329dff60dfd7e8fabc76e715302e1199382950", size = 368873, upload-time = "2025-10-31T13:03:38.171Z" }, ] [[package]] name = "uipath-langchain" -version = "0.0.147" +version = "0.0.148" source = { editable = "." } dependencies = [ { name = "httpx" }, @@ -3397,7 +3397,7 @@ requires-dist = [ { name = "openinference-instrumentation-langchain", specifier = ">=0.1.50" }, { name = "pydantic-settings", specifier = ">=2.6.0" }, { name = "python-dotenv", specifier = ">=1.0.1" }, - { name = "uipath", specifier = ">=2.1.110,<2.2.0" }, + { name = "uipath", specifier = ">=2.1.131,<2.2.0" }, { name = "uipath-langchain", marker = "extra == 'langchain'", specifier = ">=0.0.2" }, ] provides-extras = ["langchain"]