Agent Subagents UI
Build and maintain the Subagents tab inside the OpenClaw Agents page.
Scope
Use this skill for:
- - adding or refining the Subagents tab under Agents
- exposing editable subagent model settings in Control UI
- wiring subagent settings into the existing config form/save path
- keeping the UI honest about what is configurable per-agent vs shared defaults
- documenting runtime precedence for subagent model selection
Core design
Keep the feature aligned with the real runtime behavior.
Subagent model precedence is:
- 1. INLINECODE0
- INLINECODE1
- target agent primary model
- runtime fallback default
Do not invent backend schema that does not exist.
If the current schema only supports a single subagents.model selection and shared concurrency limits, surface that clearly in the UI.
UI pattern
Add Subagents as an Agents-page panel beside:
- - Overview
- Files
- Tools
- Skills
- Channels
- Cron
Recommended panel layout:
- subagent model
- subagent fallback models
- subagent thinking level
- - Shared subagent defaults
- default subagent model
- default fallback models
- default thinking level
-
maxConcurrent
-
maxSpawnDepth
-
maxChildrenPerAgent
- - include a short precedence note explaining which value wins
Config wiring rules
Prefer the existing config editing path. Do not create a disconnected store.
Edit through the same config-form/save flow already used by the Agents UI:
- - INLINECODE6
- INLINECODE7
- INLINECODE8
- INLINECODE9
- INLINECODE10
- INLINECODE11
- INLINECODE12
If fallback models are represented as part of the existing model object shape, reuse that shape instead of inventing a new field.
Implementation checklist
- 1. Add/update INLINECODE13
- Wire
"subagents" through INLINECODE15 - Add required state/type wiring in
ui/src/ui/app.ts and INLINECODE17 - Wire change handlers in INLINECODE18
- Add/update focused UI tests
- Build the UI and run the targeted test file
Validation
Prefer these checks after changes:
CODEBLOCK0
If repo-wide typecheck is already noisy, do not claim unrelated errors belong to this feature.
References
Read these before editing:
- - INLINECODE19
- INLINECODE20
For the concrete implementation that originally shipped this feature, read:
- - INLINECODE21
- INLINECODE22
- INLINECODE23
- INLINECODE24
- INLINECODE25
- INLINECODE26
- INLINECODE27
Use those files as the exact reference implementation when recreating or porting the feature to another OpenClaw tree.
Agent Subagents UI
在OpenClaw Agents页面内构建和维护Subagents选项卡。
范围
使用此技能进行:
- - 在Agents下添加或优化Subagents选项卡
- 在控制UI中暴露可编辑的子代理模型设置
- 将子代理设置接入现有的配置表单/保存路径
- 保持UI清晰区分每个代理可配置项与共享默认值
- 记录子代理模型选择的运行时优先级
核心设计
保持功能与实际运行时行为一致。
子代理模型优先级为:
- 1. agent.subagents.model
- agents.defaults.subagents.model
- 目标代理主模型
- 运行时回退默认值
不要发明不存在的后端模式。
如果当前模式仅支持单个subagents.model选择和共享并发限制,请在UI中清晰呈现。
UI模式
在Agents页面面板中添加Subagents,与以下面板并列:
- - Overview
- Files
- Tools
- Skills
- Channels
- Cron
推荐面板布局:
- 子代理模型
- 子代理回退模型
- 子代理思考级别
- 默认子代理模型
- 默认回退模型
- 默认思考级别
- maxConcurrent
- maxSpawnDepth
- maxChildrenPerAgent
配置接入规则
优先使用现有配置编辑路径。不要创建独立的存储。
通过Agents UI已使用的相同配置表单/保存流程进行编辑:
- - agents.list[i].subagents.model
- agents.list[i].subagents.thinking
- agents.defaults.subagents.model
- agents.defaults.subagents.thinking
- agents.defaults.subagents.maxConcurrent
- agents.defaults.subagents.maxSpawnDepth
- agents.defaults.subagents.maxChildrenPerAgent
如果回退模型已作为现有模型对象形状的一部分表示,则重用该形状,而不是发明新字段。
实现检查清单
- 1. 添加/更新 ui/src/ui/views/agents-panel-subagents.ts
- 通过 ui/src/ui/views/agents.ts 接入 subagents
- 在 ui/src/ui/app.ts 和 ui/src/ui/app-view-state.ts 中添加所需状态/类型接入
- 在 ui/src/ui/app-render.ts 中接入变更处理器
- 添加/更新聚焦的UI测试
- 构建UI并运行目标测试文件
验证
变更后优先执行以下检查:
bash
cd ~/openclaw
pnpm --dir ui exec vitest run --config vitest.config.ts src/ui/views/agents.test.ts
pnpm --dir ui build
如果仓库范围类型检查已有大量噪音,不要声称无关错误属于此功能。
参考资料
编辑前阅读:
- - references/file-map.md
- references/runtime-precedence.md
关于最初实现此功能的具体实现,请阅读:
- - references/implementation-notes.txt
- references/agents-panel-subagents.ts.txt
- references/agents.ts.txt
- references/app.ts.txt
- references/app-view-state.ts.txt
- references/app-render.subagents.txt
- references/agents.test.ts.txt
在重新创建或将此功能移植到另一个OpenClaw树时,将这些文件作为精确的参考实现。