Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 24 additions & 8 deletions src/uipath_langchain/_cli/cli_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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())

Expand Down
18 changes: 14 additions & 4 deletions src/uipath_langchain/_cli/cli_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -25,6 +28,7 @@
)
from ._utils._graph import LangGraphConfig

console = ConsoleLogger.get_instance()

def langgraph_run_middleware(
entrypoint: Optional[str],
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading