Skip to content
Open
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.58"
version = "2.10.59"
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
10 changes: 10 additions & 0 deletions packages/uipath/src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ class AgentMetadata(BaseCfg):
"""Agent metadata model."""

is_conversational: bool = Field(alias="isConversational")
is_case_manager: bool = Field(default=False, alias="isCaseManager")
storage_version: str = Field(alias="storageVersion")


Expand Down Expand Up @@ -1216,6 +1217,15 @@ def is_conversational(self) -> bool:
return metadata.is_conversational
return False

@property
def is_case_manager(self) -> bool:
"""Checks if the agent is a case manager agent."""
if hasattr(self, "metadata") and self.metadata:
metadata = self.metadata
if hasattr(metadata, "is_case_manager"):
return metadata.is_case_manager
return False

@staticmethod
def _normalize_guardrails(v: Dict[str, Any]) -> None:
guards = v.get("guardrails")
Expand Down
113 changes: 113 additions & 0 deletions packages/uipath/tests/agent/models/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,119 @@ def test_is_conversational_false_by_default(self):
assert config.is_conversational is False


class TestAgentDefinitionIsCaseManager:
"""Tests for AgentDefinition.is_case_manager property."""

def test_is_case_manager_true_when_metadata_set(self):
"""Returns True when metadata.is_case_manager is True."""
json_data = {
"id": "test-case-manager",
"name": "Case Manager Agent",
"version": "1.0.0",
"metadata": {
"isConversational": False,
"isCaseManager": True,
"storageVersion": "1.0.0",
},
"settings": {
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0,
"engine": "basic-v1",
},
"inputSchema": {"type": "object", "properties": {}},
"outputSchema": {"type": "object", "properties": {}},
"resources": [],
"messages": [
{"role": "system", "content": "You are a case manager agent."}
],
}

config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
json_data
)

assert config.is_case_manager is True

def test_is_case_manager_false_when_metadata_set_false(self):
"""Returns False when metadata.is_case_manager is False."""
json_data = {
"id": "test-non-case-manager",
"name": "Regular Agent",
"version": "1.0.0",
"metadata": {
"isConversational": False,
"isCaseManager": False,
"storageVersion": "1.0.0",
},
"settings": {
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0,
"engine": "basic-v1",
},
"inputSchema": {"type": "object", "properties": {}},
"outputSchema": {"type": "object", "properties": {}},
"resources": [],
"messages": [{"role": "system", "content": "You are an agent."}],
}

config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
json_data
)

assert config.is_case_manager is False

def test_is_case_manager_false_when_not_in_metadata(self):
"""Returns False when isCaseManager is not present in metadata."""
json_data = {
"id": "test-no-case-manager-field",
"name": "Agent Without CM Field",
"version": "1.0.0",
"metadata": {"isConversational": False, "storageVersion": "1.0.0"},
"settings": {
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0,
"engine": "basic-v1",
},
"inputSchema": {"type": "object", "properties": {}},
"outputSchema": {"type": "object", "properties": {}},
"resources": [],
"messages": [{"role": "system", "content": "You are an agent."}],
}

config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
json_data
)

assert config.is_case_manager is False

def test_is_case_manager_false_when_no_metadata(self):
"""Returns False when agent has no metadata."""
json_data = {
"id": "test-no-metadata",
"name": "Agent Without Metadata",
"version": "1.0.0",
"settings": {
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0,
"engine": "basic-v1",
},
"inputSchema": {"type": "object", "properties": {}},
"outputSchema": {"type": "object", "properties": {}},
"resources": [],
"messages": [{"role": "system", "content": "You are an agent."}],
}

config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
json_data
)

assert config.is_case_manager is False


class TestAgentBuilderConfigResources:
"""Tests for AgentDefinition resource configuration parsing."""

Expand Down
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