diff --git a/pyproject.toml b/pyproject.toml index 65ec21878..10b6d4d35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.7.2" +version = "2.7.3" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/tracing/_otel_exporters.py b/src/uipath/tracing/_otel_exporters.py index 2496d9331..a47c3acd1 100644 --- a/src/uipath/tracing/_otel_exporters.py +++ b/src/uipath/tracing/_otel_exporters.py @@ -285,7 +285,7 @@ def _map_tool_call_attributes(self, attributes: Dict[str, Any]) -> Dict[str, Any result["arguments"] = _safe_parse_json( attributes.get("input", attributes.get("input.value", "{}")) ) - result["toolType"] = "Integration" + result["toolType"] = result.get("toolType") or "Integration" result["result"] = _safe_parse_json( attributes.get("output", attributes.get("output.value")) ) diff --git a/tests/tracing/test_otel_exporters.py b/tests/tracing/test_otel_exporters.py index bd3569ca5..40aaa3938 100644 --- a/tests/tracing/test_otel_exporters.py +++ b/tests/tracing/test_otel_exporters.py @@ -411,6 +411,26 @@ def test_tool_span_mapping_issue(self): self.assertIn("input", attributes) self.assertEqual(attributes["input"], {}) + def test_tool_span_preserves_existing_tool_type(self): + """Test that existing toolType in attributes is preserved, not overwritten.""" + span_data = { + "Id": "test-span-id", + "TraceId": "test-trace-id", + "Attributes": { + "openinference.span.kind": "TOOL", + "tool.name": "my_custom_tool", + "input.value": "{}", + "output.value": '"result"', + "toolType": "Escalation", + }, + } + + self.exporter._process_span_attributes(span_data) + + attributes = span_data["Attributes"] + assert isinstance(attributes, dict) + self.assertEqual(attributes["toolType"], "Escalation") + def test_llm_span_mapping_consistency(self): """ Test that LLM spans are consistently mapped to completion type. diff --git a/uv.lock b/uv.lock index 8d6a06b75..0a5493884 100644 --- a/uv.lock +++ b/uv.lock @@ -2491,7 +2491,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.7.2" +version = "2.7.3" source = { editable = "." } dependencies = [ { name = "applicationinsights" },