UiPath Documentation
uipath-cli
latest
false
UiPath CLI 用户指南
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UIP 智能体验证

在打包、发布或调试之前,使用“uip agent validate”严格地以只读方式验证本地智能体项目。

uip agent validate是严格的只读检查。它回答了一个问题:Studio Web 是否会按原样接受此目录?它从不写入任何文件。如果项目的存储架构滞后,或者entry-points.json / bindings_v2.json与来源偏差,则验证将失败,并显示指向uip agent refresh代码,这是实际迁移文件并重新生成派生工件的单独命令。

仅在本地验证 — 无需登录。

大纲​

uip agent validate [path] [--path <path>] [--bindings-target <path>] [--inline-in-flow]
uip agent validate [path] [--path <path>] [--bindings-target <path>] [--inline-in-flow]

[path] 与 --path 互斥 — 两者都传递会抛出 AgentValidateConflictingPath。

所有uip agent validate调用都遵循全局选项( --output 、 --output-filter 、 --log-level 、 --log-file )。退出代码遵循标准合同。

参数​

  • [path] (可选,默认为. ) — 智能体项目目录。必须包含 agent.json;独立模式还需要 entry-points.json 和 project.uiproj。无法与 --path 结合使用。

选项​

标记默认用途
--path <path>—位置参数 [path] 的替代选项。无法与之结合使用。
--bindings-target <path><projectDir>/bindings_v2.json;对于 --inline-in-flow,当直属父目录包含 bindings_v2.json 文件时,为直接父目录的 .flow要比较的 bindings_v2.json 文件的路径。在 uip agent refresh 上镜像相同的选项。
--inline-in-flow关闭在流程项目中验证内联智能体。跳过 entry-points.json 和 project.uiproj 检查。

示例​

# Validate the current directory
uip agent validate

# Validate a specific standalone project
uip agent validate ./my-agent

# Equivalent, using the flag form
uip agent validate --path ./my-agent

# Validate an inline agent (the flow-project subdirectory)
uip agent validate ./my-flow/<uuid> --inline-in-flow
# Validate the current directory
uip agent validate

# Validate a specific standalone project
uip agent validate ./my-agent

# Equivalent, using the flag form
uip agent validate --path ./my-agent

# Validate an inline agent (the flow-project subdirectory)
uip agent validate ./my-flow/<uuid> --inline-in-flow

选中的内容​

独立模式按顺序运行:

  1. 所需文件— agent.json 、 entry-points.json 、 project.uiproj 。
  2. agent.json结构和架构版本门— agent.version必须等于 CLI 的当前架构版本(较新的项目版本将失败,显示AgentValidationOutdated ,并要求您升级uip ;旧项目版本会要求您运行refresh ) 。同时检查type === "lowCode"、projectId是否为 UUID、settings.model/settings.engine/settings.mode是否存在,metadata.storageVersion是否存在,messages[]是否存在 [system, user]。
  3. messages[].contentTokens — 每条消息的contentTokens数组根据content重新派生(按{{…}} / @{…}拆分),并与磁盘上的数组进行比较。计数、类型或原始字符串的不匹配项均属于错误类型。(此处修复偏移是 refresh 的工作 — validate 仅会报告该工作。)
  4. I/O 架构和输入变量引用— inputSchema中的outputSchema必须分别为{ type: "object", properties: {…} } ;消息中的每个{{input.<key>}}引用必须解析为inputSchema.properties中声明的键(拒绝不带input.前缀的纯{{key}} ,运行时会将其视为文本)。
  5. 资源— 内联agent.resources和基于文件的resources/<Name>/resource.json条目。tool 资源需要 UUID id、name、type,以及 location 中的 "solution" / "external" 之一,其中当位置为 properties.folderPath === "solution_folder" 时使用 "solution"(或 "" 表示 --inline-in-flow)。escalation 和 mcp 资源需要 UUID 和名称。还会检查文件夹命名:独立资源文件夹必须以资源的 name 命名;内联资源文件夹必须以资源的 id 命名(不区分大小写)。
  6. 入口点同步— entry-points.json → entryPoints[0].input / output必须与agent.json的inputSchema / outputSchema匹配(两者的属性键;仅输入的必需数组)。设置了 --inline-in-flow 后已跳过。
  7. project.uiproj — ProjectType === "Agent" 。设置为 --inline-in-flow 后会跳过。
  8. flow-layout.json存在并解析(仅限独立版)— 缺失或格式错误,失败,并包含运行refresh说明。
  9. 存储版本网关— 项目的metadata.storageVersion必须等于最新的已知迁移版本;否则AgentValidationOutdated (升级uip ,或运行refresh )。
  10. 根据当前 Studio Web 架构进行严格的架构验证。
  11. IS 连接器工具资源状态(仅限--inline-in-flow )— 关联到流的每个 Integration Service 连接器工具节点都必须在磁盘上有匹配的resources/<id>/resource.json 。
  12. 派生文件偏差检查— 对refresh使用的相同生成器进行的空运行,将entry-points.json中的bindings_v2.json与将重新生成的内容进行比较。引用完整性故障(例如,引用了工具但未将其显示为资源)为硬错误;内容不匹配被报告为偏移,两者都指向要修复的 refresh。

静态错误在运行后续步骤之前快速失败,退出代码为 1。

数据形状(--输出 json)​

有效( Code: "AgentValidation" ):

{
  "Code": "AgentValidation",
  "Data": {
    "Status": "Valid",
    "ProjectDir": "/abs/path/my-agent",
    "Model": "gpt-5.4",
    "StorageVersion": "47.0.0",
    "Validated": {
      "agent": true,
      "resources": 2,
      "evalSets": 0,
      "evaluators": 0
    }
  }
}
{
  "Code": "AgentValidation",
  "Data": {
    "Status": "Valid",
    "ProjectDir": "/abs/path/my-agent",
    "Model": "gpt-5.4",
    "StorageVersion": "47.0.0",
    "Validated": {
      "agent": true,
      "resources": 2,
      "evalSets": 0,
      "evaluators": 0
    }
  }
}

Validated 是一个对象,用于细分严格架构传递检查的内容 — 不是布尔值。为 InlineInFlow: true 次运行添加 --inline-in-flow,并在派生文件检查生成非严重警告时添加 Warnings 数组。

已过期( Code: "AgentValidationOutdated" ):

{
  "Code": "AgentValidationOutdated",
  "Message": "Storage version 45.0.0 is outdated; latest is 47.0.0.",
  "Data": { "CurrentVersion": "45.0.0", "LatestVersion": "47.0.0" },
  "Instructions": "Run `uip agent refresh` to migrate."
}
{
  "Code": "AgentValidationOutdated",
  "Message": "Storage version 45.0.0 is outdated; latest is 47.0.0.",
  "Data": { "CurrentVersion": "45.0.0", "LatestVersion": "47.0.0" },
  "Instructions": "Run `uip agent refresh` to migrate."
}

偏移( Code: "AgentValidationDrift" ):

{
  "Code": "AgentValidationDrift",
  "Message": "Derived artifacts are out of sync with source (1 issue(s))",
  "Data": { "Errors": ["bindings_v2.json: out of sync — tool \"InvoiceLookup\" binding changed"] },
  "Instructions": "Run `uip agent refresh` to regenerate entry-points.json and bindings_v2.json."
}
{
  "Code": "AgentValidationDrift",
  "Message": "Derived artifacts are out of sync with source (1 issue(s))",
  "Data": { "Errors": ["bindings_v2.json: out of sync — tool \"InvoiceLookup\" binding changed"] },
  "Instructions": "Run `uip agent refresh` to regenerate entry-points.json and bindings_v2.json."
}

静态/架构失败( Code: "AgentValidationFailed" ):

{
  "Code": "AgentValidationFailed",
  "Message": "Validation failed with 2 error(s)",
  "Data": {
    "Errors": [
      "agent.json.settings.model: missing or empty",
      "messages[1].contentTokens: contentTokens has 3 entries but content requires 2. Rebuild contentTokens to match content."
    ]
  }
}
{
  "Code": "AgentValidationFailed",
  "Message": "Validation failed with 2 error(s)",
  "Data": {
    "Errors": [
      "agent.json.settings.model: missing or empty",
      "messages[1].contentTokens: contentTokens has 3 entries but content requires 2. Rebuild contentTokens to match content."
    ]
  }
}
  • uip agent init — 框架默认情况下可以干净地进行验证的项目。
  • uip agent refresh — 实际迁移和重新生成文件的命令;每当验证点时运行它。
  • uip agent review — 评分质量通过,不同于验证的通过/失败架构检查。

另请参阅​

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新