Feature Request: Support per-worker model in swarm spawn
Problem
Current behavior:
/swarm spawn "agent" model=some-modelignores themodel=parameter- All spawned workers use
swarm_modelfrom config.toml - This makes it impossible to assign different models to different agents
Expected behavior:
/swarm spawn "agent" model=some-modelshould usesome-modelfor that workerswarm_modelshould only be used as fallback whenmodel=is not specified
Use Case
We have 6 agents with different model requirements (v6.2 binding table):
| Agent | Required Model | Provider |
|---|---|---|
| 明镜 (coordinator) | agnes-2.5-flash | agnes-ai-direct |
| 明德 | agnes-2.5-flash | agnes-ai-direct |
| 明品 | agnes-2.5-flash | agnes-ai-direct |
| 明码 | cohere/north-mini-code:free | openrouter |
| 明真 | nvidia/nemotron-3-ultra-550b-a55b:free | openrouter |
| 明察 | nvidia/nemotron-3-ultra-550b-a55b:free | openrouter |
Current limitation forces all agents to use agnes-2.5-flash, wasting free models and reducing quality for code/review tasks.
Proposed Solution
Modify resolve_swarm_spawn_selection to:
- Check if
model=parameter is explicitly provided - If yes, use the provided model
- If no, fallback to
swarm_modelfrom config
References
- Issue #1156: "model= parameter being ignored is expected"
- Commit b76f96561: fix(swarm): make worker model operator-controlled
I agree with the proposed behavior. The model= argument should take precedence over the global swarm_model setting.
Proposed fix
Update resolve_swarm_spawn_selection so model resolution follows this order:
- If
/swarm spawnincludes an explicitmodel=<model>, use that model for the spawned worker. - Otherwise, use
swarm_modelfromconfig.tomlas the fallback. - Preserve the existing behavior when neither is specified.
Conceptually:
def resolve_swarm_spawn_selection(..., model=None, ...):
if model is not None:
worker_model = model
else:
worker_model = config.swarm_model
return ..., worker_model
The important part is that the explicitly supplied model= value must survive the spawn-selection/resolution path instead of being overwritten by swarm_model.
Expected behavior
For example:
/swarm spawn "明德" model=agnes-2.5-flash
/swarm spawn "明码" model=cohere/north-mini-code:free
/swarm spawn "明真" model=nvidia/nemotron-3-ultra-550b-a55b:free
Each worker should retain its requested model independently.
While:
/swarm spawn "agent"
should continue to use:
swarm_model = "..."
as the fallback.
Suggested tests
I would add regression tests covering at least:
- explicit
model=overridesswarm_model - missing
model=falls back toswarm_model - different workers spawned from the same swarm can use different models
- an explicitly provided model is not overwritten during worker/session creation
This also keeps the configuration backwards-compatible while making the CLI's model= parameter actually functional for per-worker model selection.
Per-worker model overrides are already restored by https://github.com/1jehuang/jcode/commit/e41c83468: an explicit swarm-tool model overrides agents.swarm_model, with the configured value used only as fallback. All 13 focused routing tests passed in this review. Note that /swarm spawn is not current TUI syntax. Ask the agent to call the swarm tool with action: "spawn", a label, and model, or use model: "inherit" to bypass the configured pin. Update the serving daemon as well as the client. If the actual tool call still loses its model, please share its redacted arguments and child route metadata.
— Jcode agent (automated triage), on behalf of @1jehuang
Subject: 确认:per-worker model override 已由 e41c83468 实现,请求 close
We confirmed the feature in our STOS swarm-prompt model-binding table (v8.x): explicit model= in /swarm spawn overrides agents.swarm_model, with the configured value used only as fallback. This matches your 09-13 reply and the restored behavior in e41c83468.
Request: close this issue as implemented. The open question you raised about /swarm spawn (slash-command channel) is out of scope for our use case; we use the MCP swarm tool with explicit model args.
(Verified by STOS 明镜 coordinator, jcode v0.87.1 + e41c83468.)