Skip to content

Commit 79756aa

Browse files
feat: add is_case_manager field in agent declaration (#1594)
Add is_case_manager field in agent declaration
1 parent ae5dac0 commit 79756aa

4 files changed

Lines changed: 121 additions & 2 deletions

File tree

packages/uipath/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.58"
3+
version = "2.10.59"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath/src/uipath/agent/models/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ class AgentMetadata(BaseCfg):
11561156
"""Agent metadata model."""
11571157

11581158
is_conversational: bool = Field(alias="isConversational")
1159+
is_case_manager: bool = Field(default=False, alias="isCaseManager")
11591160
storage_version: str = Field(alias="storageVersion")
11601161

11611162

@@ -1216,6 +1217,11 @@ def is_conversational(self) -> bool:
12161217
return metadata.is_conversational
12171218
return False
12181219

1220+
@property
1221+
def is_case_manager(self) -> bool:
1222+
"""Checks if the agent is a case manager agent."""
1223+
return self.metadata.is_case_manager if self.metadata else False
1224+
12191225
@staticmethod
12201226
def _normalize_guardrails(v: Dict[str, Any]) -> None:
12211227
guards = v.get("guardrails")

packages/uipath/tests/agent/models/test_agent.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,6 +3283,119 @@ def test_is_conversational_false_by_default(self):
32833283
assert config.is_conversational is False
32843284

32853285

3286+
class TestAgentDefinitionIsCaseManager:
3287+
"""Tests for AgentDefinition.is_case_manager property."""
3288+
3289+
def test_is_case_manager_true_when_metadata_set(self):
3290+
"""Returns True when metadata.is_case_manager is True."""
3291+
json_data = {
3292+
"id": "test-case-manager",
3293+
"name": "Case Manager Agent",
3294+
"version": "1.0.0",
3295+
"metadata": {
3296+
"isConversational": False,
3297+
"isCaseManager": True,
3298+
"storageVersion": "1.0.0",
3299+
},
3300+
"settings": {
3301+
"model": "gpt-4o",
3302+
"maxTokens": 4096,
3303+
"temperature": 0,
3304+
"engine": "basic-v1",
3305+
},
3306+
"inputSchema": {"type": "object", "properties": {}},
3307+
"outputSchema": {"type": "object", "properties": {}},
3308+
"resources": [],
3309+
"messages": [
3310+
{"role": "system", "content": "You are a case manager agent."}
3311+
],
3312+
}
3313+
3314+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3315+
json_data
3316+
)
3317+
3318+
assert config.is_case_manager is True
3319+
3320+
def test_is_case_manager_false_when_metadata_set_false(self):
3321+
"""Returns False when metadata.is_case_manager is False."""
3322+
json_data = {
3323+
"id": "test-non-case-manager",
3324+
"name": "Regular Agent",
3325+
"version": "1.0.0",
3326+
"metadata": {
3327+
"isConversational": False,
3328+
"isCaseManager": False,
3329+
"storageVersion": "1.0.0",
3330+
},
3331+
"settings": {
3332+
"model": "gpt-4o",
3333+
"maxTokens": 4096,
3334+
"temperature": 0,
3335+
"engine": "basic-v1",
3336+
},
3337+
"inputSchema": {"type": "object", "properties": {}},
3338+
"outputSchema": {"type": "object", "properties": {}},
3339+
"resources": [],
3340+
"messages": [{"role": "system", "content": "You are an agent."}],
3341+
}
3342+
3343+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3344+
json_data
3345+
)
3346+
3347+
assert config.is_case_manager is False
3348+
3349+
def test_is_case_manager_false_when_not_in_metadata(self):
3350+
"""Returns False when isCaseManager is not present in metadata."""
3351+
json_data = {
3352+
"id": "test-no-case-manager-field",
3353+
"name": "Agent Without CM Field",
3354+
"version": "1.0.0",
3355+
"metadata": {"isConversational": False, "storageVersion": "1.0.0"},
3356+
"settings": {
3357+
"model": "gpt-4o",
3358+
"maxTokens": 4096,
3359+
"temperature": 0,
3360+
"engine": "basic-v1",
3361+
},
3362+
"inputSchema": {"type": "object", "properties": {}},
3363+
"outputSchema": {"type": "object", "properties": {}},
3364+
"resources": [],
3365+
"messages": [{"role": "system", "content": "You are an agent."}],
3366+
}
3367+
3368+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3369+
json_data
3370+
)
3371+
3372+
assert config.is_case_manager is False
3373+
3374+
def test_is_case_manager_false_when_no_metadata(self):
3375+
"""Returns False when agent has no metadata."""
3376+
json_data = {
3377+
"id": "test-no-metadata",
3378+
"name": "Agent Without Metadata",
3379+
"version": "1.0.0",
3380+
"settings": {
3381+
"model": "gpt-4o",
3382+
"maxTokens": 4096,
3383+
"temperature": 0,
3384+
"engine": "basic-v1",
3385+
},
3386+
"inputSchema": {"type": "object", "properties": {}},
3387+
"outputSchema": {"type": "object", "properties": {}},
3388+
"resources": [],
3389+
"messages": [{"role": "system", "content": "You are an agent."}],
3390+
}
3391+
3392+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3393+
json_data
3394+
)
3395+
3396+
assert config.is_case_manager is False
3397+
3398+
32863399
class TestAgentBuilderConfigResources:
32873400
"""Tests for AgentDefinition resource configuration parsing."""
32883401

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)