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/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.10.65"
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

from ..._utils.constants import COMMUNITY_agents_SUFFIX
from .._execution_context import eval_set_run_id_context
from .._helpers.evaluators_helpers import trace_to_str
from .._helpers.helpers import is_empty_value
from ..models import EvaluationResult
from ..models.models import (
AgentExecution,
LLMResponse,
NumericEvaluationResult,
TrajectoryEvaluationTrace,
UiPathEvaluationError,
UiPathEvaluationErrorCategory,
)
Expand Down Expand Up @@ -140,10 +140,7 @@ def _create_evaluation_prompt(
and agent_run_history
and isinstance(agent_run_history[0], ReadableSpan)
):
trajectory_trace = TrajectoryEvaluationTrace.from_readable_spans(
agent_run_history
)
agent_run_history = str(trajectory_trace.spans)
agent_run_history = trace_to_str(agent_run_history)
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 Preserve non-tool history for direct-answer runs

For runs whose trace contains only LLM/CHAIN spans (for example an agent answers directly without invoking any tool), this now replaces {{AgentRunHistory}} with trace_to_str(...), but that helper only emits spans that have a tool.name attribute and otherwise returns an empty string. The legacy trajectory evaluator prompt does not include agent_output, so those direct-answer executions lose all observable run history compared with the previous TrajectoryEvaluationTrace conversion, making the evaluator unable to judge whether the no-tool path matched the expected behavior.

Useful? React with 👍 / 👎.

else:
agent_run_history = str(agent_run_history)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import uuid

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}}",
createdAt="2026-05-14T00:00:00Z",
updatedAt="2026-05-14T00:00:00Z",
)


def test_legacy_trajectory_prompt_uses_compact_tool_history() -> None:
long_prompt = "SYSTEM_PROMPT_" + ("x" * 10_000)
spans = [
ReadableSpan(
name="agent_llm_call",
start_time=0,
end_time=1,
attributes={
"openinference.span.kind": "LLM",
"input.value": f'{{"messages": [{{"role": "system", "content": "{long_prompt}"}}]}}',
"output.value": '{"generations": []}',
},
),
ReadableSpan(
name="search_profiles",
start_time=1,
end_time=2,
attributes={
"openinference.span.kind": "TOOL",
"tool.name": "search_profiles",
"input.value": '{"query": "mentor"}',
"output.value": '{"content": "found mentor profile"}',
"metadata": f'{{"agent_prompt": "{long_prompt}"}}',
},
),
]

prompt = _legacy_trajectory_evaluator()._create_evaluation_prompt(
expected_agent_behavior="The agent should search matching profiles.",
agent_run_history=spans,
)

assert "SYSTEM_PROMPT_" not in prompt
assert "Tool: search_profiles" in prompt
assert '{"query": "mentor"}' in prompt
assert "found mentor profile" in prompt
assert "agent_llm_call" not in prompt
2 changes: 1 addition & 1 deletion packages/uipath/uv.lock

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

Loading