“uip agent init”的语法和选项,可在磁盘上构建新的低代码智能体项目。
uip agent init 在磁盘上构建一个新的低代码智能体项目。在解决方案目录中运行时,项目会在周围解决方案的 .uipx 中自动注册。在任何解决方案外部运行时,系统会自动构建父级 <name>Solution,并将智能体项目嵌套在其中 — 通过 --skip-solution-registration 以退出这两种行为,并获取未注册的原始项目树。
有两种脚手架模式可用:
- 独立(默认)— 一个完整的智能体项目树,其中包含
agent.json、entry-points.json、project.uiproj、flow-layout.json、evals/树(具有默认评估集、语义评估程序和轨迹评估程序),以及空的features/和resources/目录。 - 流程内联(
--inline-in-flow) — 现有流程项目中以 UUID 命名的子目录,其中包含agent.json和空的flow-layout.json,以及空的evals/eval-sets/、features/和resources/文件夹。无entry-points.json或project.uiproj,也无法自动注册解决方案。流程的内联智能体节点必须引用生成的projectId。
大纲
uip agent init <path> [--conversational] [--model <model>] [--system-prompt <prompt>] [--force] [--skip-solution-registration] [--inline-in-flow]
uip agent init <path> [--conversational] [--model <model>] [--system-prompt <prompt>] [--force] [--skip-solution-registration] [--inline-in-flow]
参数
<path>(必填) — 智能体项目的目标目录(相对或绝对)。在独立模式下,目录名称将成为智能体名称;它必须匹配[a-zA-Z0-9_ -]+。使用--inline-in-flow时,<path>为流程项目目录,并会在其中创建一个以 UUID 命名的子目录。
选项
| 标记 | 默认 | 用途 |
|---|---|---|
--conversational | 关闭 | 构建对话智能体,而不是自主式智能体。 |
--model <model> | 无静态默认值 — 为自主/对话智能体类型选择推荐模型 | 要使用的 LLM 模型。已在 settings.model 中写入 agent.json。 |
--system-prompt <prompt> | — | 初始系统提示词已写入messages[0]的agent.json中。仅在独立模式下有意义。 |
--force | 关闭 | 即使目标目录不为空,也将其覆盖。仅限独立模式 — 内联模式始终写入新的 UUID 文件夹。 |
--skip-solution-registration | 关闭 | 不要在周围解决方案中自动注册项目,也不要自动创建父项 <name>Solution。 |
--inline-in-flow | 关闭 | 在流程项目中构建内联智能体。<path>参数必须指向现有的流程项目目录 (否则为错误)。 |
如果目标目录存在并包含任何文件,独立模式将拒绝继续操作,除非设置了--force 。
示例
# Simplest: scaffold an autonomous agent with the recommended default model
uip agent init ./my-agent --model gpt-5.4
# Scaffold a conversational agent
uip agent init ./my-agent --conversational --model anthropic.claude-sonnet-4-5-20250929-v1:0
# Scaffold outside any solution — a parent MyAgentSolution is auto-created
uip agent init ./my-agent
# Skip solution auto-registration entirely
uip agent init ./my-agent --skip-solution-registration
# 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 an autonomous agent with the recommended default model
uip agent init ./my-agent --model gpt-5.4
# Scaffold a conversational agent
uip agent init ./my-agent --conversational --model anthropic.claude-sonnet-4-5-20250929-v1:0
# Scaffold outside any solution — a parent MyAgentSolution is auto-created
uip agent init ./my-agent
# Skip solution auto-registration entirely
uip agent init ./my-agent --skip-solution-registration
# 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": "/abs/path/MyAgentSolution/my-agent",
"Name": "my-agent",
"Model": "gpt-5.4",
"ProjectId": "a1b2c3d4-0000-0000-0000-000000000301",
"NextSteps": "# Edit agent.json to configure prompts and resources\n...",
"SolutionRegistration": {
"Status": "Registered"
},
"AutoCreatedSolution": {
"...": "present only when a parent solution was scaffolded automatically"
},
"ProjectArtifacts": {
"...": "present only when the project was registered into a parent solution"
}
}
}
{
"Code": "AgentInit",
"Data": {
"Status": "Agent project created",
"Path": "/abs/path/MyAgentSolution/my-agent",
"Name": "my-agent",
"Model": "gpt-5.4",
"ProjectId": "a1b2c3d4-0000-0000-0000-000000000301",
"NextSteps": "# Edit agent.json to configure prompts and resources\n...",
"SolutionRegistration": {
"Status": "Registered"
},
"AutoCreatedSolution": {
"...": "present only when a parent solution was scaffolded automatically"
},
"ProjectArtifacts": {
"...": "present only when the project was registered into a parent solution"
}
}
}
始终存在 SolutionRegistration.Status — Registered、AlreadyRegistered、NotInSolution(未找到父级 .uipx,并且未自动创建新父级 OptedOut)之一(已传递 --skip-solution-registration) 。仅当已为此运行构建了父级 AutoCreatedSolution 时,<Name>Solution 才会存在。ProjectArtifacts 仅当 SolutionRegistration.Status 为 Registered 或 AlreadyRegistered 时才存在 — 它会镜像工件资源条目 uip solution projects add 将生成的内容,因此 uip solution pack 以后不会省略项目。
内联( Code: "AgentInitInline" ):
{
"Code": "AgentInitInline",
"Data": {
"Status": "Inline agent created inside flow project",
"Path": "/abs/path/my-flow/<uuid>",
"ProjectId": "<uuid>",
"Model": "gpt-5.4",
"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-5.4",
"NextSteps": "# Edit agent.json to configure prompts and settings\n..."
}
}
内联模式永远不会注册解决方案 — SolutionRegistration / AutoCreatedSolution / ProjectArtifacts 永远不会在此图形上显示。
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/
相关内容
uip agent refresh— 每次编辑后运行,以重新生成entry-points.json和bindings_v2.json。uip agent validate— 在发布前进行严格的只读检查。uip solution projects add— 将框架式智能体链接到与其自动注册的智能体不同的解决方案中。