“uip codedagent”的语法和选项,这是连接至 Python UiPath CLI 的桥梁,用于构建和运行编码智能体。
uip codedagent是连接基于 Python 的UiPath 编码智能体工作流的精简网桥。它会检测合适的 Python 解释器,确认已安装 uipath Python 包,并将固定的子命令白名单转发到 Python CLI — 因此,new、dev、pack、发布和其他生命周期动词来自 Python 包,而不是此包工具。review 是一个例外:它是直接在此工具中实施的原生命令,未进行转发。
有关精简包装器与完整工具的不同,请参阅工具(插件) 。
大纲
uip codedagent setup [--force]
uip codedagent review [path] [--checks <categories>]
uip codedagent <whitelisted-command> [args...]
uip codedagent setup [--force]
uip codedagent review [path] [--checks <categories>]
uip codedagent <whitelisted-command> [args...]
uip coded 智能体审核
根据确定性规则集审核编码智能体项目——无需 Python 解释器,在 CLI 中原生运行。返回判定 (PASS/FAIL)、分数 (0-100)、分数字母 (A+...F) 以及问题列表。
参数
| 名称 | 必填 | 用途 |
|---|---|---|
[path] | 否 | 智能体项目目录。默认值:.。 |
选项
--checks <categories>— 要运行的规则类别,以逗号分隔。省略此操作即可运行所有规则。已知类别包括evals、schema、tools、guardrails、code、general(在实时列表中运行uip codedagent review --help)。
示例
uip codedagent review ./my-coded-agent
uip codedagent review --checks code
uip codedagent review ./my-coded-agent
uip codedagent review --checks code
数据形状 ( --output json )
{
"Code": "CodedAgentReview",
"Data": {
"ProjectDir": "./my-coded-agent",
"Verdict": "PASS",
"Score": 100,
"Grade": "A+",
"Issues": [],
"Strengths": [],
"Stats": {
"errors": 0,
"warnings": 0,
"infos": 0,
"byCategory": { "evals": 0, "schema": 0, "tools": 0, "guardrails": 0, "code": 0, "general": 0 }
}
}
}
{
"Code": "CodedAgentReview",
"Data": {
"ProjectDir": "./my-coded-agent",
"Verdict": "PASS",
"Score": 100,
"Grade": "A+",
"Issues": [],
"Strengths": [],
"Stats": {
"errors": 0,
"warnings": 0,
"infos": 0,
"byCategory": { "evals": 0, "schema": 0, "tools": 0, "guardrails": 0, "code": 0, "general": 0 }
}
}
}
无法识别的 --checks 值将失败并显示 Code: "CodedAgentReviewInvalidChecks",并列出已知类别。
UIP 编码智能体设置
检测 Python 并验证是否已安装uipath包。结果缓存在基于用户的文件中,因此后续codedagent命令可以立即解析 Python 二进制文件。
参数
无。
选项
--force— 即使存在缓存结果,也会重新运行检测。
示例
uip codedagent setup
uip codedagent setup --force
uip codedagent setup
uip codedagent setup --force
数据形状 ( --output json )
{
"Code": "CodedAgentsSetup",
"Data": {
"PythonPath": "/usr/bin/python3.11",
"Package": "uipath",
"PackageInstalled": "Yes",
"PackageVersion": "1.0.0"
}
}
{
"Code": "CodedAgentsSetup",
"Data": {
"PythonPath": "/usr/bin/python3.11",
"Package": "uipath",
"PackageInstalled": "Yes",
"PackageVersion": "1.0.0"
}
}
环境检查
- 允许的 Python 版本通过环境变量
PYTHON_TOOL_PYTHON_VERSIONS配置。空列表会在设置时引发Failure。 - 如果当前工作目录中存在
.venv目录,但未激活虚拟环境,安装程序将拒绝运行,并建议首先激活虚拟环境(在 Windows 上为.venv\Scripts\activate,在其他地方为source .venv/bin/activate)。
已转发的命令
包含 15 个子命令名称的固定白名单将作为 uipath Python CLI 转发到 codedagent exec <subcommand> ...:add、debug、deploy、dev、eval、init、invoke、list-models、new、pack、publish、pull、push、register、run。在尝试任何转发之前,Commander 会将在此列表之外的任何内容(包括拼写错误)作为未知命令拒绝;它不会传递给 Python。
示例
# Hand off to the Python CLI's new command
uip codedagent new my-agent
# Run the Python CLI's help for a sub-verb
uip codedagent init --help
# Execute a dev loop defined by the Python package
uip codedagent dev
# Hand off to the Python CLI's new command
uip codedagent new my-agent
# Run the Python CLI's help for a sub-verb
uip codedagent init --help
# Execute a dev loop defined by the Python package
uip codedagent dev
由于这些命令由 uipath Python 包定义,因此其标志和输出形式为包发出的任何内容,而不是 CLI 的标准 Code/Data 信封。将此处的 CLI 视为传输。对于参数表面,请运行 uip codedagent <command> --help,该操作会将其转发到 Python。纯uip codedagent help不会转发 — codedagent-tool从不注册help命令,因此它会显示 Commander 自己为此工具生成的帮助。
身份验证中继:在转发之前,CLI 会读取uip login创建的会话,并将这些环境变量注入到 Python 子流程中,以便 SDK 自动选取这些变量:
UIPATH_ACCESS_TOKENUIPATH_URL(组成为<baseUrl>/<org>/<tenant>)UIPATH_ORGANIZATION_ID,UIPATH_ORGANIZATION_NAMEUIPATH_TENANT_ID,UIPATH_TENANT_NAME
如果您尚未登录,仍可转发; Python CLI 不会在没有这些变量的情况下运行。
始终去除--force :此工具未为--force定义特定于命令的规则,因此在每个转发的命令到达 Python CLI 之前,系统会无条件且静默地将其从每个转发的命令的参数中去除。它永远不会到达 Python,也不会发出错误 — 将 --force 传递给转发的子命令只是一个空操作。
push需要UIPATH_PROJECT_ID — 这是必需的环境变量,将在本地检查(在此工具中,在转发到 Python 之前),而不是 Python CLI 会自行强制执行。每个项目设置一次:
echo "UIPATH_PROJECT_ID=<id>" >> .env
uip codedagent push
echo "UIPATH_PROJECT_ID=<id>" >> .env
uip codedagent push
从 Studio Web 中的现有编码智能体项目中获取 <id>。跳过对 uip codedagent push --help 的检查。
deploy / publish --my-workspace (或-w )需要可个人工作区的登录作用域,这是另一种原生预转发检查。它会读取您当前的uip login访问令牌,并需要总括OrchestratorApiUserAccess作用域或细粒度OR.Users.Read作用域(满足以下条件之一);两者兼而有之的令牌在任何内容到达 Python 之前都会失败:
{
"Result": "Failure",
"Message": "Current login token is missing the OrchestratorApiUserAccess (or granular OR.Users.Read) scope required for --my-workspace.",
"Instructions": "The personal workspace publish path calls Orchestrator GetCurrentUserExtended and requires either the umbrella OrchestratorApiUserAccess scope or the granular OR.Users.Read scope. If you are using the default client, run `uip login` again — IdentityServer attaches OrchestratorApiUserAccess to issued tokens automatically. ..."
}
{
"Result": "Failure",
"Message": "Current login token is missing the OrchestratorApiUserAccess (or granular OR.Users.Read) scope required for --my-workspace.",
"Instructions": "The personal workspace publish path calls Orchestrator GetCurrentUserExtended and requires either the umbrella OrchestratorApiUserAccess scope or the granular OR.Users.Read scope. If you are using the default client, run `uip login` again — IdentityServer attaches OrchestratorApiUserAccess to issued tokens automatically. ..."
}
默认的 uip login 客户端会自动选择 OrchestratorApiUserAccess,因此只会影响自定义客户端或受限的作用域列表。通过部署到租户订阅源来完全跳过检查:uip codedagent deploy --tenant。当 deploy/publish 通过时,此检查仅适用于 --my-workspace/-w — 它不会对普通 deploy/publish 或任何其他列入白名单的命令运行。
退出代码
标准退出代码适用。转发的子流程的退出代码将直接中继到父 Shell,因此,当 Python 端发生故障时,会以相同的非零状态退出uip codedagent 。