From b01412ed24479422fa0fad15db904a13c2b0cde2 Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Tue, 29 Sep 2026 09:36:59 +0200 Subject: [PATCH] feat(agent): add generate-file internal tool type --- packages/uipath/pyproject.toml | 2 +- .../uipath/src/uipath/agent/models/agent.py | 10 ++++ .../uipath/tests/agent/models/test_agent.py | 48 +++++++++++++++++++ packages/uipath/uv.lock | 6 +-- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index bb12bfa6f..1ce573930 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -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" diff --git a/packages/uipath/src/uipath/agent/models/agent.py b/packages/uipath/src/uipath/agent/models/agent.py index 303a35c4d..23038568b 100644 --- a/packages/uipath/src/uipath/agent/models/agent.py +++ b/packages/uipath/src/uipath/agent/models/agent.py @@ -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): @@ -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"), diff --git a/packages/uipath/tests/agent/models/test_agent.py b/packages/uipath/tests/agent/models/test_agent.py index 50efde34f..265a5e1ac 100644 --- a/packages/uipath/tests/agent/models/test_agent.py +++ b/packages/uipath/tests/agent/models/test_agent.py @@ -28,6 +28,7 @@ AgentIntegrationToolResourceConfig, AgentInternalBatchTransformToolProperties, AgentInternalDeepRagToolProperties, + AgentInternalGenerateFileToolProperties, AgentInternalHttpRequestToolProperties, AgentInternalToolResourceConfig, AgentInternalToolType, @@ -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""" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index bc92233bb..04b2fe80d 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -7,10 +7,10 @@ exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for exclude-newer-span = "P2D" [options.exclude-newer-package] +uipath-core = false uipath-ipc = false -uipath-runtime = false uipath-platform = false -uipath-core = false +uipath-runtime = false [[package]] name = "aiohappyeyeballs" @@ -2599,7 +2599,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.14.25" +version = "2.14.26" source = { editable = "." } dependencies = [ { name = "applicationinsights" },