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.2.30"
version = "2.2.31"
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
77 changes: 77 additions & 0 deletions src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ class AgentGuardrailActionType(str, Enum):
UNKNOWN = "unknown" # fallback branch discriminator


class AgentToolArgumentPropertiesVariant(str, Enum):
"""Agent tool argument properties variant enumeration."""

DYNAMIC = "dynamic"
ARGUMENT = "argument"
STATIC = "static"
TEXT_BUILDER = "textBuilder"


class TextTokenType(str, Enum):
"""Text token type enumeration."""

SIMPLE_TEXT = "simpleText"
VARIABLE = "variable"
EXPRESSION = "expression"


class BaseCfg(BaseModel):
"""Base configuration model with common settings."""

Expand All @@ -83,6 +100,59 @@ class BaseCfg(BaseModel):
)


class TextToken(BaseCfg):
"""Text token model."""

type: TextTokenType
raw_string: str = Field(alias="rawString")


class BaseAgentToolArgumentProperties(BaseCfg):
"""Base tool argument properties model."""

variant: AgentToolArgumentPropertiesVariant
is_sensitive: bool = Field(alias="isSensitive")


class AgentToolStaticArgumentProperties(BaseAgentToolArgumentProperties):
"""Static tool argument properties model."""

variant: Literal[AgentToolArgumentPropertiesVariant.STATIC] = Field(
default=AgentToolArgumentPropertiesVariant.STATIC, frozen=True
)
value: Optional[Any]


class AgentToolArgumentArgumentProperties(BaseAgentToolArgumentProperties):
"""Agent argument argument properties model."""

variant: Literal[AgentToolArgumentPropertiesVariant.ARGUMENT] = Field(
default=AgentToolArgumentPropertiesVariant.ARGUMENT,
frozen=True,
)
argument_path: str = Field(alias="argumentPath")


class AgentToolTextBuilderArgumentProperties(BaseAgentToolArgumentProperties):
"""Agent text builder argument properties model."""

variant: Literal[AgentToolArgumentPropertiesVariant.TEXT_BUILDER] = Field(
default=AgentToolArgumentPropertiesVariant.TEXT_BUILDER,
frozen=True,
)
tokens: List[TextToken]


AgentToolArgumentProperties = Annotated[
Union[
AgentToolStaticArgumentProperties,
AgentToolArgumentArgumentProperties,
AgentToolTextBuilderArgumentProperties,
],
Field(discriminator="variant"),
]


class BaseResourceProperties(BaseCfg):
"""Base resource properties model."""

Expand Down Expand Up @@ -189,6 +259,9 @@ class AgentMcpTool(BaseCfg):
name: str = Field(..., alias="name")
description: str = Field(..., alias="description")
input_schema: Dict[str, Any] = Field(..., alias="inputSchema")
argument_properties: Dict[str, AgentToolArgumentProperties] = Field(
{}, alias="argumentProperties"
)


class AgentMcpResourceConfig(BaseAgentResourceConfig):
Expand Down Expand Up @@ -282,6 +355,9 @@ class AgentProcessToolProperties(BaseResourceProperties):

folder_path: Optional[str] = Field(None, alias="folderPath")
process_name: Optional[str] = Field(None, alias="processName")
argument_properties: Dict[str, AgentToolArgumentProperties] = Field(
{}, alias="argumentProperties"
)


class AgentProcessToolResourceConfig(BaseAgentToolResourceConfig):
Expand Down Expand Up @@ -594,6 +670,7 @@ class AgentMessage(BaseCfg):

role: Literal[AgentMessageRole.SYSTEM, AgentMessageRole.USER]
content: str
content_tokens: Optional[List[TextToken]] = Field(None, alias="contentTokens")

@field_validator("role", mode="before")
@classmethod
Expand Down
52 changes: 51 additions & 1 deletion tests/agent/models/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,41 @@ def test_agent_with_all_tool_types_loads(self):
"name": "Agent with All Tools",
"metadata": {"isConversational": False, "storageVersion": "22.0.0"},
"messages": [
{"role": "System", "content": "You are an agentic assistant."},
{
"role": "System",
"content": "You are an agentic assistant.",
"contentTokens": [
{
"type": "simpleText",
"rawString": "You are an agentic assistant.",
}
],
},
{
"role": "User",
"content": "Use the provided tools. Execute {{task}} the number of {{times}}.",
"contentTokens": [
{
"type": "simpleText",
"rawString": "Use the provided tools. Execute ",
},
{
"type": "variable",
"rawString": "input.task",
},
{
"type": "simpleText",
"rawString": " the number of ",
},
{
"type": "variable",
"rawString": "input.times",
},
{
"type": "simpleText",
"rawString": ".",
},
],
},
],
"inputSchema": {
Expand Down Expand Up @@ -225,6 +256,13 @@ def test_agent_with_all_tool_types_loads(self):
"properties": {"output": {"type": "string"}},
},
"settings": {},
"argumentProperties": {
"task": {
"variant": "argument",
"argumentPath": "$['task']",
"isSensitive": False,
}
},
"properties": {
"processName": "Basic RPA Process",
"folderPath": "TestFolder/Complete Solution 30 Sept",
Expand Down Expand Up @@ -270,6 +308,18 @@ def test_agent_with_all_tool_types_loads(self):
},
"required": ["timezone"],
},
"argumentProperties": {
"timezone": {
"variant": "textBuilder",
"tokens": [
{
"type": "simpleText",
"rawString": "Europe/London",
},
],
"isSensitive": False,
},
},
},
{
"name": "convert_time",
Expand Down
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.