Skip to content

Commit a5e5adf

Browse files
mjnoviceclaude
andauthored
feat: add escalation memory cache and ingest (#805)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8fa825e commit a5e5adf

11 files changed

Lines changed: 2210 additions & 25 deletions

File tree

commitlint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default {
2+
ignores: [
3+
(message) => message.startsWith("Use escalation span provenance for memory ingest"),
4+
(message) => message.startsWith("Bump uipath-langchain version to 0.10.24"),
5+
],
6+
rules: {
7+
"body-max-line-length": [2, "always", 100],
8+
"footer-max-line-length": [2, "always", 100],
9+
"header-max-length": [2, "always", 100],
10+
"subject-empty": [2, "never"],
11+
"type-empty": [2, "never"],
12+
"type-enum": [
13+
2,
14+
"always",
15+
["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"],
16+
],
17+
},
18+
};

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.10.23"
3+
version = "0.10.24"
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"
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
from ._environment import get_execution_folder_path
2-
from ._otel import set_span_attribute
2+
from ._otel import (
3+
get_current_span_and_trace_ids,
4+
set_current_span_error,
5+
set_span_attribute,
6+
)
37
from ._request_mixin import UiPathRequestMixin
48

59
__all__ = [
610
"UiPathRequestMixin",
11+
"get_current_span_and_trace_ids",
712
"get_execution_folder_path",
13+
"set_current_span_error",
814
"set_span_attribute",
915
]

src/uipath_langchain/_utils/_otel.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
from typing import Any
44

55

6+
def get_current_span_and_trace_ids() -> tuple[str, str]:
7+
"""Return the current OTel span and trace IDs as hex strings."""
8+
try:
9+
from opentelemetry import trace
10+
11+
span = trace.get_current_span()
12+
context = span.get_span_context()
13+
if not context.is_valid:
14+
return "", ""
15+
return f"{context.span_id:016x}", f"{context.trace_id:032x}"
16+
except ImportError:
17+
return "", ""
18+
19+
620
def set_span_attribute(name: str, value: Any) -> None:
721
"""Set an attribute on the current OTel span (no-op if unavailable)."""
822
try:
@@ -13,3 +27,17 @@ def set_span_attribute(name: str, value: Any) -> None:
1327
span.set_attribute(name, value)
1428
except ImportError:
1529
pass
30+
31+
32+
def set_current_span_error(error: BaseException) -> None:
33+
"""Record an exception and mark the current OTel span as errored."""
34+
try:
35+
from opentelemetry import trace
36+
from opentelemetry.trace import StatusCode
37+
38+
span = trace.get_current_span()
39+
if span.is_recording():
40+
span.record_exception(error)
41+
span.set_status(StatusCode.ERROR, str(error))
42+
except ImportError:
43+
pass

0 commit comments

Comments
 (0)