Skip to content
Merged
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.14.25"
version = "2.14.26"
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 @@ -128,6 +128,7 @@ class AgentInternalToolType(str, CaseInsensitiveEnum):
DEEP_RAG = "deep-rag"
BATCH_TRANSFORM = "batch-transform"
HTTP_REQUEST = "http-request"
GENERATE_FILE = "generate-file"


class AgentEscalationRecipientType(str, CaseInsensitiveEnum):
Expand Down Expand Up @@ -1066,12 +1067,21 @@ class AgentInternalHttpRequestToolProperties(BaseResourceProperties):
)


class AgentInternalGenerateFileToolProperties(BaseResourceProperties):
"""Agent internal generate file tool properties model."""

tool_type: Literal[AgentInternalToolType.GENERATE_FILE] = Field(
alias="toolType", default=AgentInternalToolType.GENERATE_FILE, frozen=True
)


AgentInternalToolProperties = Annotated[
Union[
AgentInternalAnalyzeFilesToolProperties,
AgentInternalDeepRagToolProperties,
AgentInternalBatchTransformToolProperties,
AgentInternalHttpRequestToolProperties,
AgentInternalGenerateFileToolProperties,
],
Field(discriminator="tool_type"),
_case_insensitive_enum_validator("tool_type", AgentInternalToolType, "toolType"),
Expand Down
48 changes: 48 additions & 0 deletions packages/uipath/tests/agent/models/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
AgentIntegrationToolResourceConfig,
AgentInternalBatchTransformToolProperties,
AgentInternalDeepRagToolProperties,
AgentInternalGenerateFileToolProperties,
AgentInternalHttpRequestToolProperties,
AgentInternalToolResourceConfig,
AgentInternalToolType,
Expand Down Expand Up @@ -1757,6 +1758,53 @@ def test_agent_with_unknown_resource_type(self):
assert unknown_resource.name == "Future Resource"
assert unknown_resource.description == "A resource type that doesn't exist yet"

def test_agent_with_generate_file_tool(self):
json_data = {
"id": "test-generate-file",
"name": "Agent with Generate File",
"version": "1.0.0",
"settings": {
"model": "gpt-4o-2024-11-20",
"maxTokens": 16384,
"temperature": 0,
"engine": "basic-v1",
},
"inputSchema": {"type": "object", "properties": {}},
"outputSchema": {"type": "object", "properties": {}},
"resources": [
{
"$resourceType": "tool",
"type": "internal",
"referenceKey": None,
"name": "Generate File",
"isEnabled": True,
"description": "Create a file and attach it to the job.",
"properties": {"toolType": "generate-file"},
"inputSchema": {
"type": "object",
"properties": {"file_name": {"type": "string"}},
"required": ["file_name"],
},
"outputSchema": {"type": "object", "properties": {}},
"settings": {},
"argumentProperties": {},
"guardrail": {"policies": []},
}
],
"messages": [{"role": "system", "content": "Test system message"}],
}

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

tool_resource = config.resources[0]
assert isinstance(tool_resource, AgentInternalToolResourceConfig)
assert isinstance(
tool_resource.properties, AgentInternalGenerateFileToolProperties
)
assert tool_resource.properties.tool_type == AgentInternalToolType.GENERATE_FILE

def test_agent_with_unknown_tool_type(self):
"""Test that AgentDefinition handles unknown tool types gracefully"""

Expand Down
6 changes: 3 additions & 3 deletions packages/uipath/uv.lock

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

Loading