diff --git a/pyproject.toml b/pyproject.toml index cd11a5ad6..f8c2ec121 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.4.10" +version = "2.4.11" 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/src/uipath/agent/models/agent.py b/src/uipath/agent/models/agent.py index e4532c31a..c608fe67c 100644 --- a/src/uipath/agent/models/agent.py +++ b/src/uipath/agent/models/agent.py @@ -45,6 +45,7 @@ class AgentToolType(str, Enum): PROCESS_ORCHESTRATION = "ProcessOrchestration" INTEGRATION = "Integration" INTERNAL = "Internal" + IXP = "ixp" UNKNOWN = "Unknown" # fallback branch discriminator @@ -196,7 +197,6 @@ class AgentContextSettings(BaseCfg): None, alias="outputColumns" ) - class AgentContextResourceConfig(BaseAgentResourceConfig): """Agent context resource configuration model.""" @@ -361,6 +361,20 @@ class AgentProcessToolResourceConfig(BaseAgentToolResourceConfig): settings: AgentToolSettings = Field(default_factory=AgentToolSettings) arguments: Dict[str, Any] = Field(default_factory=dict) +class AgentIxpExtractionToolProperties(BaseResourceProperties): + """Agent process tool properties model.""" + + project_name: str | None = Field(None, alias="projectName") + version_tag: str | None = Field(None, alias="versionTag") + +class AgentIxpExtractionResourceConfig(BaseAgentToolResourceConfig): + """Agent ixp extraction tool resource configuration model.""" + + type: Literal[AgentToolType.IXP] = AgentToolType.IXP + output_schema: dict[str, Any] = Field(..., alias="outputSchema") + settings: AgentToolSettings = Field(default_factory=AgentToolSettings) + properties: AgentIxpExtractionToolProperties + class AgentIntegrationToolParameter(BaseCfg): """Agent integration tool parameter model.""" diff --git a/tests/agent/models/test_agent.py b/tests/agent/models/test_agent.py index 27924b388..c6961dbb8 100644 --- a/tests/agent/models/test_agent.py +++ b/tests/agent/models/test_agent.py @@ -15,6 +15,7 @@ AgentGuardrailEscalateAction, AgentGuardrailUnknownAction, AgentIntegrationToolResourceConfig, + AgentIxpExtractionResourceConfig, AgentMcpResourceConfig, AgentProcessToolResourceConfig, AgentResourceType, @@ -2221,3 +2222,134 @@ def test_direct_recipient_instantiation( assert isinstance(recipient, recipient_class) assert recipient.type == expected_type + + def test_agent_with_ixp_extraction_tool(self): + """Test agent with IXP extraction tool resource""" + + json_data = { + "version": "1.0.0", + "id": "aaaaaaaa-0000-0000-0000-000000000005", + "name": "Agent with IXP Extraction Tool", + "metadata": {"isConversational": False, "storageVersion": "26.0.0"}, + "messages": [ + {"role": "System", "content": "You are an agentic assistant."}, + ], + "inputSchema": {"type": "object", "properties": {}}, + "outputSchema": { + "type": "object", + "properties": {"content": {"type": "string"}}, + }, + "settings": { + "model": "gpt-4o-2024-11-20", + "maxTokens": 16384, + "temperature": 0, + "engine": "basic-v2", + }, + "resources": [ + { + "$resourceType": "tool", + "id": "43931770-a441-48f7-894d-0792bf45f6b9", + "name": "document_extraction", + "description": "Extract data from input files", + "location": "external", + "type": "ixp", + "inputSchema": { + "type": "object", + "properties": { + "attachment": { + "description": "file to extract the data from", + "$ref": "#/definitions/job-attachment", + } + }, + "required": ["attachment"], + "definitions": { + "job-attachment": { + "type": "object", + "required": ["ID"], + "x-uipath-resource-kind": "JobAttachment", + "properties": { + "ID": { + "type": "string", + "description": "Orchestrator attachment key", + }, + "FullName": { + "type": "string", + "description": "File name", + }, + "MimeType": { + "type": "string", + "description": 'The MIME type of the content, such as "application/json" or "image/png"', + }, + "Metadata": { + "type": "object", + "description": "Dictionary of metadata", + "additionalProperties": {"type": "string"}, + }, + }, + } + }, + }, + "outputSchema": {"type": "object", "properties": {}}, + "settings": {}, + "properties": { + "projectName": "extraction-project", + "versionTag": "latest", + }, + "guardrail": {"policies": []}, + "isEnabled": True, + "argumentProperties": {}, + } + ], + "features": [], + } + + # Test deserialization + config: AgentDefinition = TypeAdapter(AgentDefinition).validate_python( + json_data + ) + + # Validate agent + assert config.id == "aaaaaaaa-0000-0000-0000-000000000005" + assert config.name == "Agent with IXP Extraction Tool" + assert len(config.resources) == 1 + + # Validate IXP extraction tool + tool = config.resources[0] + assert isinstance(tool, AgentIxpExtractionResourceConfig) + assert tool.resource_type == AgentResourceType.TOOL + assert tool.type == AgentToolType.IXP + assert tool.id == "43931770-a441-48f7-894d-0792bf45f6b9" + assert tool.name == "document_extraction" + assert tool.description == "Extract data from input files" + assert tool.is_enabled is True + + # Validate tool properties + assert tool.properties.project_name == "extraction-project" + assert tool.properties.version_tag == "latest" + + # Validate input schema with definitions + assert tool.input_schema is not None + assert tool.input_schema["type"] == "object" + assert "properties" in tool.input_schema + assert "attachment" in tool.input_schema["properties"] + assert tool.input_schema["required"] == ["attachment"] + assert "definitions" in tool.input_schema + assert "job-attachment" in tool.input_schema["definitions"] + + # Validate job-attachment definition + job_attachment_def = tool.input_schema["definitions"]["job-attachment"] + assert job_attachment_def["type"] == "object" + assert job_attachment_def["required"] == ["ID"] + assert job_attachment_def["x-uipath-resource-kind"] == "JobAttachment" + assert "ID" in job_attachment_def["properties"] + assert "FullName" in job_attachment_def["properties"] + assert "MimeType" in job_attachment_def["properties"] + assert "Metadata" in job_attachment_def["properties"] + + # Validate output schema + assert tool.output_schema is not None + assert tool.output_schema["type"] == "object" + assert tool.output_schema["properties"] == {} + + # Validate settings + assert tool.settings is not None diff --git a/uv.lock b/uv.lock index 3cc0c1493..56bba6213 100644 --- a/uv.lock +++ b/uv.lock @@ -2486,7 +2486,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.4.10" +version = "2.4.11" source = { editable = "." } dependencies = [ { name = "applicationinsights" },