diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index c6a998262..3883b3d84 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -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" diff --git a/packages/uipath/src/uipath/agent/models/agent.py b/packages/uipath/src/uipath/agent/models/agent.py index 7694a861e..8f8b8a207 100644 --- a/packages/uipath/src/uipath/agent/models/agent.py +++ b/packages/uipath/src/uipath/agent/models/agent.py @@ -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") @@ -1216,6 +1217,11 @@ 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.""" + return self.metadata.is_case_manager if self.metadata else False + @staticmethod def _normalize_guardrails(v: Dict[str, Any]) -> None: guards = v.get("guardrails") diff --git a/packages/uipath/tests/agent/models/test_agent.py b/packages/uipath/tests/agent/models/test_agent.py index d00e5a42b..6c4c0519a 100644 --- a/packages/uipath/tests/agent/models/test_agent.py +++ b/packages/uipath/tests/agent/models/test_agent.py @@ -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.""" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index b85d0fb8d..10b7e683b 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2543,7 +2543,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.10.58" +version = "2.10.59" source = { editable = "." } dependencies = [ { name = "applicationinsights" },