Skip to content

Commit 1b81042

Browse files
feat(agent): add Function tool type for agent process tools (#1689)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4cea46b commit 1b81042

4 files changed

Lines changed: 74 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.71"
3+
version = "2.10.72"
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class AgentToolType(str, CaseInsensitiveEnum):
113113
API = "Api"
114114
PROCESS_ORCHESTRATION = "ProcessOrchestration"
115115
FLOW = "Flow"
116+
FUNCTION = "Function"
116117
INTEGRATION = "Integration"
117118
INTERNAL = "Internal"
118119
IXP = "Ixp"
@@ -792,6 +793,7 @@ class AgentProcessToolResourceConfig(BaseAgentToolResourceConfig):
792793
AgentToolType.API,
793794
AgentToolType.PROCESS_ORCHESTRATION,
794795
AgentToolType.FLOW,
796+
AgentToolType.FUNCTION,
795797
]
796798
output_schema: Dict[str, Any] = Field(EMPTY_SCHEMA, alias="outputSchema")
797799
properties: AgentProcessToolProperties
@@ -1336,6 +1338,7 @@ def _normalize_resources(v: Dict[str, Any]) -> None:
13361338
"api": "Api",
13371339
"processorchestration": "ProcessOrchestration",
13381340
"flow": "Flow",
1341+
"function": "Function",
13391342
"integration": "Integration",
13401343
"internal": "Internal",
13411344
"ixp": "Ixp",

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

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,6 +3627,75 @@ def test_flow_tool_resource_case_insensitive(self):
36273627
assert isinstance(tool_resource, AgentProcessToolResourceConfig)
36283628
assert tool_resource.type == AgentToolType.FLOW
36293629

3630+
def test_function_tool_type_enum_value(self):
3631+
"""AgentToolType.FUNCTION exists with the wire value 'Function' and is case-insensitive."""
3632+
assert AgentToolType.FUNCTION.value == "Function"
3633+
assert AgentToolType("function") is AgentToolType.FUNCTION
3634+
assert AgentToolType("FUNCTION") is AgentToolType.FUNCTION
3635+
3636+
def test_function_tool_resource_deserialization(self):
3637+
"""A resource with type='Function' is parsed as AgentProcessToolResourceConfig."""
3638+
resources = [
3639+
{
3640+
"$resourceType": "tool",
3641+
"type": "Function",
3642+
"id": "function-tool-1",
3643+
"inputSchema": {
3644+
"type": "object",
3645+
"properties": {"input": {"type": "string"}},
3646+
},
3647+
"outputSchema": {"type": "object", "properties": {}},
3648+
"arguments": {},
3649+
"settings": {"timeout": 0, "maxAttempts": 0, "retryDelay": 0},
3650+
"properties": {
3651+
"processName": "MyFunction",
3652+
"folderPath": "/Shared/Functions",
3653+
},
3654+
"name": "Function Tool",
3655+
"description": "Test Function tool",
3656+
}
3657+
]
3658+
3659+
json_data = self._agent_dict_with_resources(resources)
3660+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3661+
json_data
3662+
)
3663+
3664+
tool_resource = config.resources[0]
3665+
assert isinstance(tool_resource, AgentProcessToolResourceConfig)
3666+
assert tool_resource.type == AgentToolType.FUNCTION
3667+
assert tool_resource.properties.process_name == "MyFunction"
3668+
assert tool_resource.properties.folder_path == "/Shared/Functions"
3669+
3670+
def test_function_tool_resource_case_insensitive(self):
3671+
"""A resource with lowercase type='function' also deserializes via CaseInsensitiveEnum."""
3672+
resources = [
3673+
{
3674+
"$resourceType": "tool",
3675+
"type": "function",
3676+
"id": "function-tool-2",
3677+
"inputSchema": {"type": "object", "properties": {}},
3678+
"outputSchema": {"type": "object", "properties": {}},
3679+
"arguments": {},
3680+
"settings": {"timeout": 0, "maxAttempts": 0, "retryDelay": 0},
3681+
"properties": {
3682+
"processName": "MyFunction",
3683+
"folderPath": "/Shared/Functions",
3684+
},
3685+
"name": "Function Tool",
3686+
"description": "Test Function tool",
3687+
}
3688+
]
3689+
3690+
json_data = self._agent_dict_with_resources(resources)
3691+
config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python(
3692+
json_data
3693+
)
3694+
3695+
tool_resource = config.resources[0]
3696+
assert isinstance(tool_resource, AgentProcessToolResourceConfig)
3697+
assert tool_resource.type == AgentToolType.FUNCTION
3698+
36303699
def test_escalation_missing_escalation_type_defaults_to_zero(self):
36313700
"""Test that missing escalationType defaults to 0."""
36323701
resources = [

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)