使用“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 ,在部署被视为绿色部署之前,根据评估集验证行为。
另请参阅
uip agent概述— 智能体工具中的每个动词。uip solution概述— 打包、发布和部署智能体项目所在的解决方案。- 身份验证— 会话、租户和
env.前缀。 - 操作方法:从 CI 部署到 Orchestrator — CI 特定的身份验证、缓存、版本固定。