Skip to content
Open
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 pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
16 changes: 15 additions & 1 deletion src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AgentToolType(str, Enum):
PROCESS_ORCHESTRATION = "ProcessOrchestration"
INTEGRATION = "Integration"
INTERNAL = "Internal"
IXP = "ixp"
UNKNOWN = "Unknown" # fallback branch discriminator


Expand Down Expand Up @@ -196,7 +197,6 @@ class AgentContextSettings(BaseCfg):
None, alias="outputColumns"
)


class AgentContextResourceConfig(BaseAgentResourceConfig):
"""Agent context resource configuration model."""

Expand Down Expand Up @@ -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."""
Expand Down
132 changes: 132 additions & 0 deletions tests/agent/models/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AgentGuardrailEscalateAction,
AgentGuardrailUnknownAction,
AgentIntegrationToolResourceConfig,
AgentIxpExtractionResourceConfig,
AgentMcpResourceConfig,
AgentProcessToolResourceConfig,
AgentResourceType,
Expand Down Expand Up @@ -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<string, string> 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
2 changes: 1 addition & 1 deletion uv.lock

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

Loading