From b71a784324828d06f592a37f9eabae1bc5bab530 Mon Sep 17 00:00:00 2001 From: Radu Mihai Gheorghe Date: Tue, 19 May 2026 16:03:59 +0300 Subject: [PATCH] feat: introduce ToolsConfiguration on AgentMcpResourceConfig Adds Cached / Dynamic discriminated union under a new ToolsConfiguration model accessed via tools_configuration.cached_behaviour on the MCP resource. Cached corresponds to the old dynamic_tools=none; Dynamic corresponds to dynamic_tools=all. Schema mode is dropped from the new model for now and will be reintroduced in a later sprint. The old dynamic_tools field is removed from the model. Existing agent.json files that still serialize dynamicTools (any value) continue to parse unchanged because BaseCfg keeps extra="allow"; the legacy DynamicToolsMode enum stays exported as a deprecated alias. Co-Authored-By: Claude Opus 4.7 --- packages/uipath/pyproject.toml | 2 +- .../uipath/src/uipath/agent/models/agent.py | 41 +++++++++++++++++-- packages/uipath/uv.lock | 4 +- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index 2d50973d8..36550f54d 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.10.67" +version = "2.10.68" 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 38bc8a815..ba20b8165 100644 --- a/packages/uipath/src/uipath/agent/models/agent.py +++ b/packages/uipath/src/uipath/agent/models/agent.py @@ -446,13 +446,48 @@ class AgentMcpTool(BaseCfg): class DynamicToolsMode(str, CaseInsensitiveEnum): - """Dynamic tools mode enumeration.""" + """Dynamic tools mode enumeration. + + Deprecated: kept for backwards compatibility with older ``agent.json`` files + that still serialize the ``dynamicTools`` field. New code should use + :class:`ToolsConfiguration` (see ``AgentMcpResourceConfig.tools_configuration``). + """ NONE = "none" SCHEMA = "schema" ALL = "all" +class CachedToolsConfig(BaseCfg): + """Cached tools configuration: use the tools saved in the agent definition snapshot.""" + + type: Literal["cached"] = Field(default="cached", frozen=True) + + +class DynamicToolsConfig(BaseCfg): + """Dynamic tools configuration: fetch the tool list from the MCP server at runtime. + + When ``allow_all`` is true, every tool the server exposes is forwarded + to the agent. When false, the live list is filtered by the snapshot's + ``available_tools`` allowlist (live schemas, curated tool set). + """ + + type: Literal["dynamic"] = Field(default="dynamic", frozen=True) + allow_all: bool = Field(alias="allowAll") + + +DiscoveryMode = Annotated[ + Union[CachedToolsConfig, DynamicToolsConfig], + Field(discriminator="type"), +] + + +class ToolsConfiguration(BaseCfg): + """Configuration describing how tools are sourced for an MCP resource.""" + + discovery_mode: DiscoveryMode = Field(alias="discoveryMode") + + class AgentMcpResourceConfig(BaseAgentResourceConfig): """Agent MCP resource configuration model.""" @@ -462,8 +497,8 @@ class AgentMcpResourceConfig(BaseAgentResourceConfig): folder_path: str = Field(alias="folderPath") slug: str = Field(..., alias="slug") available_tools: List[AgentMcpTool] = Field(..., alias="availableTools") - dynamic_tools: DynamicToolsMode = Field( - default=DynamicToolsMode.NONE, alias="dynamicTools" + tools_configuration: Optional[ToolsConfiguration] = Field( + default=None, alias="toolsConfiguration" ) diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index d7e9a9ee9..41ae12119 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -3,7 +3,7 @@ revision = 3 requires-python = ">=3.11" [options] -exclude-newer = "2026-05-17T16:21:47.0725551Z" +exclude-newer = "2026-05-17T17:25:34.9197064Z" exclude-newer-span = "P2D" [options.exclude-newer-package] @@ -2552,7 +2552,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.10.67" +version = "2.10.68" source = { editable = "." } dependencies = [ { name = "applicationinsights" },