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

操作方法:部署 UiPath 智能体

使用“uip agent”和“uip solution”工具刷新、验证低代码 UiPath 智能体,并将其交付到 Orchestrator。

本页将介绍 CLI 中低代码 UiPath 智能体的完整生命周期:在磁盘上构建低代码 UiPath 智能体、保持同步、验证和审核,然后使用uip solution将其交付到 Orchestrator。它使用uip agent工具,这与uip codedagent (基于 Python 的编码智能体)不同。

uip agent 自己没有 pack、publish 或 deploy 命令,智能体项目始终作为解决方案的一部分交付。uip agent init 会自动处理该问题:它将新项目自动注册到周围解决方案的 .uipx 中,或者在外部运行父级 <Name>Solution 时搭建父级 的框架。

生命周期​

init → refresh → validate → review → (uip solution) pack → publish/upload → deploy
init → refresh → validate → review → (uip solution) pack → publish/upload → deploy
动词输入输出需要登录
agent init目标目录智能体项目树,已注册到解决方案中否
agent refresh项目目录已迁移的文件 + 已重新生成的 entry-points.json/bindings_v2.json否
agent validate项目目录通过/失败 — 不写入任何内容否
agent review项目目录分数、等级、问题否
solution pack解决方案目录.zip 包否
solution publish / solution upload已打包的 .zip 或解决方案目录已发布的包版本/Studio Web 解决方案是
solution deploy run已发布的包已部署文件夹 + 版本是

本地动词(agent init、agent refresh、agent validate、agent review、solution pack)不需要活动会话。与 Studio Web 或 Orchestrator 对话的所有内容首先都需要uip login 。

1. 框架​

使用uip agent init创建新的智能体项目:

uip agent init ./invoice-agent \
  --model gpt-5.4 \
  --system-prompt "You are an invoice triage agent."
uip agent init ./invoice-agent \
  --model gpt-5.4 \
  --system-prompt "You are an invoice triage agent."

从现有解决方案目录中运行以将项目注册到该目录中,或独立运行该目录。系统会自动构建父级 InvoiceAgentSolution/,并将项目嵌套在其中。传递 --skip-solution-registration 可退出这两种行为。

这将写入一个完整的独立项目树:

invoice-agent/
  agent.json
  project.uiproj
  entry-points.json
  flow-layout.json
  evals/
    evaluators/<semantic>.json
    evaluators/<trajectory>.json
    eval-sets/evaluation-set-default.json
  features/
  resources/
invoice-agent/
  agent.json
  project.uiproj
  entry-points.json
  flow-layout.json
  evals/
    evaluators/<semantic>.json
    evaluators/<trajectory>.json
    eval-sets/evaluation-set-default.json
  features/
  resources/

目录名称将成为智能体名称;它必须匹配[a-zA-Z0-9_ -]+ 。传递--force以覆盖非空目录。

对于驻留在 Maestro 流中的智能体,请改用 --inline-in-flow — 它将生成一个以 UUID 命名的子文件夹,仅包含 agent.json 和 flow-layout.json,不会进行解决方案自动注册。请参阅init --inline-in-flow 。

2. 作者资源​

没有用于添加工具、上下文、升级或 I/O 架构条目的专用 CLI 动词 — 通过直接手动编辑 agent.json 来创作(对于基于文件的工具资源,则为 resources/<name>/resource.json)。uip agent tool list 和 uip agent memory 是读取/附加帮助程序,而不是常规资源编辑器:

# See what tools are already configured
uip agent tool list --path ./invoice-agent

# Attach a memory space for retrieval-augmented recall
uip agent memory add InvoiceHistory \
  --memory-space invoice-recall --folder-path Shared --path ./invoice-agent

# Check available guardrails before wiring one into agent.json
uip agent guardrails list
# See what tools are already configured
uip agent tool list --path ./invoice-agent

# Attach a memory space for retrieval-augmented recall
uip agent memory add InvoiceHistory \
  --memory-space invoice-recall --folder-path Shared --path ./invoice-agent

# Check available guardrails before wiring one into agent.json
uip agent guardrails list

手动编辑 agent.json 后,转到步骤 3 — 刷新会重新生成这些编辑所依赖的派生文件。

3. 刷新并验证​

每次编辑uip agent refresh后运行agent.json :它会应用待处理架构迁移并重新生成entry-points.json / bindings_v2.json 。这是生命周期中唯一一个写入文件的命令。

uip agent refresh ./invoice-agent
uip agent refresh ./invoice-agent

然后运行uip agent validate — 严格和只读模式,它会回答“Studio Web 是否会按原样接受此目录?”的问题。而不编写任何内容:

uip agent validate ./invoice-agent
uip agent validate ./invoice-agent

两者都仅限本地(无需登录)。打包前,在 CI 中运行 refresh,然后运行 validate;它们会同时捕获错误类别(模型无效、messages[].contentTokens 损坏、架构中缺少 required 条目、派生文件过时),否则这些错误会在很久以后显示为不透明的上传失败。

4. 审核​

uip agent review为评分质量判定运行确定性规则集 — 与验证的结构性通过/失败不同:

uip agent review ./invoice-agent
uip agent review ./invoice-agent

(可选)使用uip agent review-history add记录分数,以便随时跟踪:

uip agent review-history add A --path ./invoice-agent
uip agent review-history add A --path ./invoice-agent

5. 调试(可选)​

在发布之前,使用uip agent debug对 Studio Web 中带有示例输入运行智能体一次(需要登录名和project.uiproj清单文件):

uip agent debug ./invoice-agent -i '{"invoicePath":"/tmp/sample.pdf"}'
uip agent debug ./invoice-agent -i '{"invoicePath":"/tmp/sample.pdf"}'

6. 随附 uip 解决方案​

智能体项目是作为在步骤 1 中注册的解决方案的一部分附带提供的。打包并发布(对于 Studio Web,则为上传),与打包任何其他解决方案完全相同:

# Pack the solution containing the agent project
uip solution pack ./InvoiceAgentSolution ./dist --version 1.0.0

# Publish the packed .zip to a tenant feed
uip solution publish ./dist/InvoiceAgentSolution_1.0.0.zip
# Pack the solution containing the agent project
uip solution pack ./InvoiceAgentSolution ./dist --version 1.0.0

# Publish the packed .zip to a tenant feed
uip solution publish ./dist/InvoiceAgentSolution_1.0.0.zip

然后部署到 Orchestrator 文件夹:

uip solution deploy run ./dist/InvoiceAgentSolution_1.0.0.zip \
  --folder-name invoice-agent-prod
uip solution deploy run ./dist/InvoiceAgentSolution_1.0.0.zip \
  --folder-name invoice-agent-prod

将相同的解决方案重新部署到相同的 --folder-name 不会更新现有部署 — deploy run 始终会创建新部署。结合使用uip solution deploy upgrade和uip solution deploy list中的部署密钥,即可将现有部署移动到新的包版本。

完整的管道就绪脚本​

#!/usr/bin/env bash
set -euo pipefail

AGENT_DIR="./invoice-agent"
SOLUTION_DIR="./InvoiceAgentSolution"
VERSION="${AGENT_VERSION:-1.0.0}"

# 1. Auth (External App in CI)
uip login \
  --client-id env.UIPATH_CLIENT_ID \
  --client-secret env.UIPATH_CLIENT_SECRET \
  --tenant "$UIPATH_TENANT"

# 2. Refresh + validate locally - fail fast before packing
uip agent refresh "$AGENT_DIR"
uip agent validate "$AGENT_DIR"

# 3. Pack and publish the solution
uip solution pack "$SOLUTION_DIR" ./dist --version "$VERSION"
uip solution publish "./dist/InvoiceAgentSolution_${VERSION}.zip"

# 4. Deploy (or upgrade an existing deployment - see uip solution deploy upgrade)
uip solution deploy run "./dist/InvoiceAgentSolution_${VERSION}.zip" \
  --folder-name "invoice-agent-${ENVIRONMENT}"
#!/usr/bin/env bash
set -euo pipefail

AGENT_DIR="./invoice-agent"
SOLUTION_DIR="./InvoiceAgentSolution"
VERSION="${AGENT_VERSION:-1.0.0}"

# 1. Auth (External App in CI)
uip login \
  --client-id env.UIPATH_CLIENT_ID \
  --client-secret env.UIPATH_CLIENT_SECRET \
  --tenant "$UIPATH_TENANT"

# 2. Refresh + validate locally - fail fast before packing
uip agent refresh "$AGENT_DIR"
uip agent validate "$AGENT_DIR"

# 3. Pack and publish the solution
uip solution pack "$SOLUTION_DIR" ./dist --version "$VERSION"
uip solution publish "./dist/InvoiceAgentSolution_${VERSION}.zip"

# 4. Deploy (or upgrade an existing deployment - see uip solution deploy upgrade)
uip solution deploy run "./dist/InvoiceAgentSolution_${VERSION}.zip" \
  --folder-name "invoice-agent-${ENVIRONMENT}"

接下来进行评估运行uip agent eval run start ,在部署被视为绿色部署之前,根据评估集验证行为。

另请参阅​

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新