Skip to content
Closed
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 packages/uipath-platform/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-platform"
version = "0.1.48"
version = "0.1.51"
description = "HTTP client library for programmatic access to UiPath Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

logger = logging.getLogger(__name__)

# SourceEnum.Robots = 4 (default for Python SDK / coded agents)
DEFAULT_SOURCE = 4
# SourceEnum.CodedAgents = 10 (default for Python SDK / coded agents)
DEFAULT_SOURCE = 10


class AttachmentProvider(IntEnum):
Expand Down Expand Up @@ -283,7 +283,7 @@ def otel_span_to_uipath_span(
# Top-level fields for internal tracing schema
execution_type = attributes_dict.get("executionType")
agent_version = attributes_dict.get("agentVersion")
reference_id = attributes_dict.get("referenceId")
reference_id = attributes_dict.get("agentId")

# Source: override via uipath.source attribute, else DEFAULT_SOURCE
uipath_source = attributes_dict.get("uipath.source")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ class Job(BaseModel):
has_errors: Optional[bool] = Field(default=None, alias="HasErrors")
has_warnings: Optional[bool] = Field(default=None, alias="HasWarnings")
job_error: Optional[JobErrorInfo] = Field(default=None, alias="JobError")
folder_key: str = Field(alias="FolderKey")
folder_key: Optional[str] = Field(default=None, alias="FolderKey")
id: int = Field(alias="Id")
12 changes: 6 additions & 6 deletions packages/uipath-platform/tests/services/test_span_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ def test_uipath_span_missing_execution_type_and_agent_version(self):
assert span_dict["AgentVersion"] is None

@patch.dict(os.environ, {"UIPATH_ORGANIZATION_ID": "test-org"})
def test_uipath_span_source_defaults_to_robots(self):
"""Test that Source defaults to 4 (Robots) and ignores attributes.source."""
def test_uipath_span_source_defaults_to_coded_agents(self):
"""Test that Source defaults to 10 (CodedAgents) and ignores attributes.source."""
mock_span = Mock(spec=OTelSpan)

trace_id = 0x123456789ABCDEF0123456789ABCDEF0
Expand All @@ -387,9 +387,9 @@ def test_uipath_span_source_defaults_to_robots(self):
uipath_span = _SpanUtils.otel_span_to_uipath_span(mock_span)
span_dict = uipath_span.to_dict()

# Top-level Source should be 4 (Robots), string "runtime" is ignored
assert uipath_span.source == 4
assert span_dict["Source"] == 4
# Top-level Source should be 10 (CodedAgents), string "runtime" is ignored
assert uipath_span.source == 10
assert span_dict["Source"] == 10

# attributes.source string should still be in Attributes JSON
attrs = json.loads(span_dict["Attributes"])
Expand All @@ -408,7 +408,7 @@ def test_uipath_span_source_override_with_uipath_source(self):
mock_span.name = "test-span"
mock_span.parent = None
mock_span.status.status_code = StatusCode.OK
# uipath.source=1 (Agents) overrides default of 4 (Robots)
# uipath.source=1 (Agents) overrides default of 10 (CodedAgents)
mock_span.attributes = {"uipath.source": 1, "source": "runtime"}
mock_span.events = []
mock_span.links = []
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath-platform/uv.lock

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

2 changes: 1 addition & 1 deletion packages/uipath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.10.63"
version = "2.10.66"
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"
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath/src/uipath/tracing/_otel_exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def _process_span_attributes(self, span_data: Dict[str, Any]) -> None:
def _build_url(self, span_list: list[Dict[str, Any]]) -> str:
"""Construct the URL for the API request."""
trace_id = str(span_list[0]["TraceId"])
return f"{self.base_url}/api/Traces/spans?traceId={trace_id}&source=Robots"
return f"{self.base_url}/api/Traces/spans?traceId={trace_id}&source=CodedAgents"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require the matching platform package for coded-agent traces

When users upgrade uipath in an environment that already has uipath-platform 0.1.47/0.1.48, packages/uipath/pyproject.toml:10 still considers that dependency satisfied, and python -m pip install --help shows the default upgrade strategy is only-if-needed (dependencies upgrade only when they no longer satisfy requirements). In that common upgrade path this new URL sends source=CodedAgents, but _SpanUtils is still loaded from the old platform package and emits Source=4/old reference mapping, so traces can be classified inconsistently; bump the minimum dependency to the platform version that contains the companion DEFAULT_SOURCE=10 change.

Useful? React with 👍 / 👎.


def _send_with_retries(
self, url: str, payload: list[Dict[str, Any]], max_retries: int = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
from opentelemetry.sdk.trace import ReadableSpan

from uipath.eval.evaluators import LegacyTrajectoryEvaluator
from uipath.eval.evaluators.base_legacy_evaluator import LegacyEvaluationCriteria
from uipath.eval.evaluators.legacy_trajectory_evaluator import (
LegacyTrajectoryEvaluatorConfig,
)
from uipath.eval.models.models import LegacyEvaluatorCategory, LegacyEvaluatorType


def _legacy_trajectory_evaluator() -> LegacyTrajectoryEvaluator:
return LegacyTrajectoryEvaluator(
id=str(uuid.uuid4()),
name="Legacy trajectory",
config_type=LegacyTrajectoryEvaluatorConfig,
evaluation_criteria_type=LegacyEvaluationCriteria,
justification_type=str,
category=LegacyEvaluatorCategory.Trajectory,
type=LegacyEvaluatorType.Trajectory,
prompt="History:\n{{AgentRunHistory}}\nExpected:\n{{ExpectedAgentBehavior}}",
Expand Down
6 changes: 3 additions & 3 deletions packages/uipath/tests/tracing/test_otel_exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def exporter(mock_env_vars):
exporter = LlmOpsHttpExporter()
# Mock _build_url to include query parameters as in the actual implementation
exporter._build_url = MagicMock( # type: ignore
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots"
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents"
)
yield exporter

Expand Down Expand Up @@ -107,7 +107,7 @@ def test_export_success(exporter, mock_span):
[{"span": "data", "TraceId": "test-trace-id"}]
)
exporter.http_client.post.assert_called_once_with(
"https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots",
"https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents",
json=[{"span": "data", "TraceId": "test-trace-id"}],
)

Expand Down Expand Up @@ -685,7 +685,7 @@ def exporter_with_mocks(self, mock_env_vars):
with patch("uipath.tracing._otel_exporters.httpx.Client"):
exporter = LlmOpsHttpExporter()
exporter._build_url = MagicMock( # type: ignore
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=Robots"
return_value="https://test.uipath.com/org/tenant/llmopstenant_/api/Traces/spans?traceId=test-trace-id&source=CodedAgents"
)
yield exporter

Expand Down
4 changes: 2 additions & 2 deletions packages/uipath/uv.lock

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

Loading