Skip to content

Commit d5e15f2

Browse files
committed
fix: send started/completed runtime state events
1 parent 7f95ae0 commit d5e15f2

3 files changed

Lines changed: 38 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.5.62"
3+
version = "0.5.63"
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"
77
dependencies = [
88
"uipath>=2.8.31, <2.9.0",
9-
"uipath-runtime>=0.8.4, <0.9.0",
9+
"uipath-runtime>=0.8.6, <0.9.0",
1010
"langgraph>=1.0.0, <2.0.0",
1111
"langchain-core>=1.2.11, <2.0.0",
1212
"langgraph-checkpoint-sqlite>=3.0.3, <4.0.0",

src/uipath_langchain/runtime/runtime.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
UiPathRuntimeEvent,
2222
UiPathRuntimeMessageEvent,
2323
UiPathRuntimeStateEvent,
24+
UiPathRuntimeStatePhase,
2425
)
2526
from uipath.runtime.schema import UiPathRuntimeSchema
2627

@@ -131,7 +132,7 @@ async def stream(
131132
graph_input,
132133
graph_config,
133134
interrupt_before=options.breakpoints if options else None,
134-
stream_mode=["messages", "updates"],
135+
stream_mode=["messages", "updates", "tasks"],
135136
subgraphs=True,
136137
):
137138
namespace, chunk_type, data = stream_chunk
@@ -178,6 +179,32 @@ async def stream(
178179
),
179180
)
180181
yield state_event
182+
elif chunk_type == "tasks":
183+
if isinstance(data, dict):
184+
task_name = data.get("name", "")
185+
186+
if "input" in data:
187+
phase = UiPathRuntimeStatePhase.STARTED
188+
elif "result" in data:
189+
phase = (
190+
UiPathRuntimeStatePhase.FAULTED
191+
if data.get("error")
192+
else UiPathRuntimeStatePhase.COMPLETED
193+
)
194+
else:
195+
phase = None
196+
197+
if phase is not None:
198+
state_event = UiPathRuntimeStateEvent(
199+
payload=serialize_output(data),
200+
node_name=task_name,
201+
qualified_node_name=self._build_node_name(
202+
namespace,
203+
task_name,
204+
),
205+
phase=phase,
206+
)
207+
yield state_event
181208

182209
# Extract output from final chunk
183210
graph_output = self._extract_graph_result(final_chunk)

uv.lock

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

0 commit comments

Comments
 (0)