Skip to content

Commit 96e9695

Browse files
authored
Merge pull request #367 from UiPath/fix/pass_callbacks
fix: extend runtime with callbacks
2 parents e3671ab + 84d0a13 commit 96e9695

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

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-langchain"
3-
version = "0.1.36"
3+
version = "0.1.37"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/runtime/runtime.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Any, AsyncGenerator
44
from uuid import uuid4
55

6+
from langchain_core.callbacks import BaseCallbackHandler
67
from langchain_core.runnables.config import RunnableConfig
78
from langgraph.errors import EmptyInputError, GraphRecursionError, InvalidUpdateError
89
from langgraph.graph.state import CompiledStateGraph
@@ -41,6 +42,7 @@ def __init__(
4142
graph: CompiledStateGraph[Any, Any, Any, Any],
4243
runtime_id: str | None = None,
4344
entrypoint: str | None = None,
45+
callbacks: list[BaseCallbackHandler] | None = None,
4446
):
4547
"""
4648
Initialize the runtime.
@@ -53,6 +55,7 @@ def __init__(
5355
self.graph: CompiledStateGraph[Any, Any, Any, Any] = graph
5456
self.runtime_id: str = runtime_id or "default"
5557
self.entrypoint: str | None = entrypoint
58+
self.callbacks: list[BaseCallbackHandler] = callbacks or []
5659
self.chat = UiPathChatMessagesMapper()
5760
self._middleware_node_names: set[str] = self._detect_middleware_nodes()
5861

@@ -196,7 +199,7 @@ def _get_graph_config(self) -> RunnableConfig:
196199
"""Build graph execution configuration."""
197200
graph_config: RunnableConfig = {
198201
"configurable": {"thread_id": self.runtime_id},
199-
"callbacks": [],
202+
"callbacks": self.callbacks,
200203
}
201204

202205
# Add optional config from environment

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)