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.11.8"
version = "2.11.9"
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
11 changes: 10 additions & 1 deletion packages/uipath/src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,18 @@ class DynamicToolsMode(str, CaseInsensitiveEnum):


class CachedToolsConfig(BaseCfg):
"""Cached tools configuration: use the tools saved in the agent definition snapshot."""
"""Cached tools configuration: use the tools saved in the agent definition snapshot.

When ``refresh_schema_before_call`` is true, the live tool schema is fetched
from the MCP server immediately before a tool is invoked. The agent still uses
the cached schema to decide which tool to call; the fresh schema is applied only
at invocation time.
"""

type: Literal["cached"] = Field(default="cached", frozen=True)
refresh_schema_before_call: bool = Field(
default=True, alias="refreshSchemaBeforeCall"
)


class DynamicToolsConfig(BaseCfg):
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 @@ -50,6 +50,7 @@
AssetRecipient,
BatchTransformFileExtension,
BatchTransformWebSearchGrounding,
CachedToolsConfig,
CitationMode,
CustomAssigneesRecipient,
DeepRagFileExtension,
Expand Down Expand Up @@ -2038,6 +2039,53 @@ def test_mcp_resource_with_output_schema(self):
assert tool2.output_schema is not None
assert "content" in tool2.output_schema["properties"]

def test_cached_tools_config_refresh_schema_default(self):
"""CachedToolsConfig defaults refresh_schema_before_call to True."""

config = CachedToolsConfig()
assert config.type == "cached"
assert config.refresh_schema_before_call is True

def test_cached_tools_config_refresh_schema_alias_roundtrip(self):
"""refresh_schema_before_call parses from and serializes to refreshSchemaBeforeCall."""

config = TypeAdapter(CachedToolsConfig).validate_python(
{"type": "cached", "refreshSchemaBeforeCall": False}
)
assert config.refresh_schema_before_call is False
assert config.model_dump(by_alias=True)["refreshSchemaBeforeCall"] is False

def test_mcp_resource_with_cached_tools_configuration(self):
"""AgentMcpResourceConfig parses a cached toolsConfiguration with the refresh flag."""

json_data = {
"$resourceType": "mcp",
"folderPath": "solution_folder",
"slug": "tavily-mcp",
"name": "tavily",
"description": "Tavily search tools",
"isEnabled": True,
"availableTools": [
{
"name": "tavily-search",
"description": "Search the web",
"inputSchema": {"type": "object", "properties": {}},
}
],
"toolsConfiguration": {
"discoveryMode": {
"type": "cached",
"refreshSchemaBeforeCall": False,
}
},
}

mcp_resource = TypeAdapter(AgentMcpResourceConfig).validate_python(json_data)
assert mcp_resource.tools_configuration is not None
discovery_mode = mcp_resource.tools_configuration.discovery_mode
assert isinstance(discovery_mode, CachedToolsConfig)
assert discovery_mode.refresh_schema_before_call is False

@pytest.mark.parametrize(
"recipient_type_int,value,expected_type",
[
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath/uv.lock

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

Loading