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

UiPath CLI 用户指南

uip 智能体初始化

uip agent init在磁盘上构建一个新的低代码智能体项目。它仅创建智能体项目文件,不会创建或链接解决方案。使用uip solution new ,后跟uip solution project add以将搭建的智能体放置在解决方案中。

有两种脚手架模式可用:

  • 独立(默认)— 一个完整的智能体项目树,其中包含agent.jsonentry-points.jsonproject.uiprojflow-layout.jsonevals/树(具有默认评估集、语义评估程序和轨迹评估程序),以及空的features/resources/目录。
  • 流程内联( --inline-in-flow ) — 现有流程项目中以 UUID 命名的子目录,其中包含agent.json和空的flow-layout.json ,以及空的evals/eval-sets/features/resources/文件夹。无entry-points.jsonproject.uiproj 。流程的内联智能体节点必须引用生成的projectId

大纲

uip agent init <path> [--model <model>] [--system-prompt <prompt>] [--force] [--inline-in-flow]
uip agent init <path> [--model <model>] [--system-prompt <prompt>] [--force] [--inline-in-flow]

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

参数

  • <path> (必填) — 智能体项目的目标目录(相对或绝对)。在独立模式下,目录名称将成为智能体名称;它必须匹配[a-zA-Z0-9_ -]+ 。使用--inline-in-flow时, <path>为流程项目目录,并会在其中创建一个以 UUID 命名的子目录。

选项

标记默认用途
--model <model>gpt-4o-2024-11-20智能体将使用的 LLM 模型。已在agent.json settings.model
--system-prompt <prompt>初始系统提示词已写入messages[0]agent.json中。仅在独立模式下有意义。
--force关闭即使目标目录不为空,也将其覆盖。仅限独立模式 — 内联模式始终写入新的 UUID 文件夹。
--inline-in-flow关闭在流程项目中构建内联智能体。<path>参数必须指向现有的流程项目目录 (否则为错误)。

如果目标目录存在并包含任何文件,独立模式将拒绝继续操作,除非设置了--force

示例

# Simplest: scaffold with defaults into ./my-agent
uip agent init ./my-agent

# Override the model and seed a system prompt
uip agent init ./invoice-agent \
  --model gpt-4o-2024-11-20 \
  --system-prompt "You are an invoice triage agent."

# Overwrite an existing non-empty directory
uip agent init ./my-agent --force

# Scaffold an inline agent inside an existing flow project
uip agent init ./my-flow --inline-in-flow
# Simplest: scaffold with defaults into ./my-agent
uip agent init ./my-agent

# Override the model and seed a system prompt
uip agent init ./invoice-agent \
  --model gpt-4o-2024-11-20 \
  --system-prompt "You are an invoice triage agent."

# Overwrite an existing non-empty directory
uip agent init ./my-agent --force

# Scaffold an inline agent inside an existing flow project
uip agent init ./my-flow --inline-in-flow

数据形状(--输出 json)

独立版( Code: "AgentInit" ):

{
  "Code": "AgentInit",
  "Data": {
    "Status": "Agent project created",
    "Path": "./my-agent",
    "Name": "my-agent",
    "Model": "gpt-4o-2024-11-20",
    "ProjectId": "a1b2c3d4-0000-0000-0000-000000000301",
    "NextSteps": "# Edit agent.json to configure prompts and resources\n…"
  }
}
{
  "Code": "AgentInit",
  "Data": {
    "Status": "Agent project created",
    "Path": "./my-agent",
    "Name": "my-agent",
    "Model": "gpt-4o-2024-11-20",
    "ProjectId": "a1b2c3d4-0000-0000-0000-000000000301",
    "NextSteps": "# Edit agent.json to configure prompts and resources\n…"
  }
}

内联( Code: "AgentInitInline" ):

{
  "Code": "AgentInitInline",
  "Data": {
    "Status": "Inline agent created inside flow project",
    "Path": "/abs/path/my-flow/<uuid>",
    "ProjectId": "<uuid>",
    "Model": "gpt-4o-2024-11-20",
    "NextSteps": "# Edit agent.json to configure prompts and settings\n…"
  }
}
{
  "Code": "AgentInitInline",
  "Data": {
    "Status": "Inline agent created inside flow project",
    "Path": "/abs/path/my-flow/<uuid>",
    "ProjectId": "<uuid>",
    "Model": "gpt-4o-2024-11-20",
    "NextSteps": "# Edit agent.json to configure prompts and settings\n…"
  }
}

ProjectId是被标记为agent.json新 UUID,在内联模式下,也是文件夹名称。在独立模式下,将为入口点、语义评估器、轨迹评估器和默认评估集生成其他 UUID。

生成的文件

独立版将创建:

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

流程内联将在流程项目内部创建:

<flow-path>/<new-uuid>/
  agent.json
  flow-layout.json           # empty ({})
  evals/eval-sets/
  features/
  resources/
<flow-path>/<new-uuid>/
  agent.json
  flow-layout.json           # empty ({})
  evals/eval-sets/
  features/
  resources/

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新