Bug Assessment: No dedicated model setting for agent swarm (like secondary/vision model)
- Slug: swarm-dedicated-model-setting
- Created: 2025-08-26T08:00:02.053Z
- Source: pasted text
- Verdict: valid
- Severity: medium
Report (verbatim or summarized)
allow a dedicated model for agent swarm just like the secondary model vision-model setting, swarm model should be a setting
Symptom
There is no configuration option to set a dedicated model specifically for agent swarm operations. Users can configure a secondary model for subagents via [secondary_model], and a visual model via [visual_model], but there's no equivalent [swarm_model] or similar setting. This forces swarm subagents to either use the primary model or the secondary model, with no independent configuration for swarm-specific workloads.
Reproduction
- Check
config.toml for a [swarm_model] or similar section — it doesn't exist
- Try to configure a dedicated model for swarm operations — only
[secondary_model] is available
- Launch an agent swarm — subagents use either primary or secondary model based on the
model parameter in AgentSwarm tool
Suspected Code Paths
packages/agent-core-v2/src/features/swarm/configSection.ts — Only defines timeoutMs, no model configuration (lines 13-15)
packages/agent-core-v2/src/features/swarm/agent/swarmService.ts — No model configuration handling
packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts — Reads model from tool argument or profile preference, not from a dedicated swarm config
packages/agent-core-v2/src/session/subagent/configSection.ts — Defines SecondaryModelConfigSchema (lines 31-48) and visualModelOverlay.ts for visual model — pattern to follow
packages/agent-core/src/config/secondary-model.ts — Secondary model overlay implementation to mirror
Root Cause Hypothesis
Confidence: high
The swarm feature was implemented without a dedicated model configuration section. The pattern exists for:
[secondary_model] — for general subagent delegation (implemented in packages/agent-core-v2/src/session/subagent/configSection.ts and packages/agent-core/src/config/secondary-model.ts)
[visual_model] — for visual tasks (implemented in packages/agent-core-v2/src/app/kosongConfig/visualModelOverlay.ts)
But no equivalent [swarm_model] section was created. The SwarmConfigSchema in configSection.ts only has timeoutMs.
Proposed Remediation
Preferred: Add a [swarm_model] config section following the secondary/visual model pattern
- Add
SwarmModelConfigSchema in packages/agent-core-v2/src/features/swarm/configSection.ts mirroring SecondaryModelConfigSchema:
model: string (model alias from [models])
defaultEffort: string (thinking effort)
- Patch fields (overrides like
maxContextSize, maxInputSize, etc.)
- Create a swarm model overlay (like
visualModelOverlay) that synthesizes a derived model entry __swarm__ when patch fields exist
- Update
AgentSwarmTool to use the swarm model by default when configured (instead of secondary model)
- Add
exposesSwarmModelChoice and buildSwarmModelDescriptions functions for tool schema
Alternatives:
- Extend
[secondary_model] with a swarmDefault field to specify a different default for swarm vs. regular subagents
- Add a
swarm_model key to the existing [secondary_model] section
Files likely to change:
packages/agent-core-v2/src/features/swarm/configSection.ts — add SwarmModelConfigSchema, env bindings, overlay registration
packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts — use swarm model config
packages/agent-core-v2/src/features/swarm/session/sessionSwarmService.ts — pass swarm model to spawn
packages/agent-core-v2/src/app/kosongConfig/ — add swarm model overlay (new file or extend visualModelOverlay pattern)
Tests to add or update:
- Test that
[swarm_model] config is parsed and applied
- Test that swarm subagents use the dedicated swarm model by default
- Test that tool
model parameter still overrides the config
- Test derived entry synthesis when patch fields are present
Risks & Considerations
- Config complexity: Adding another model section increases configuration surface area
- Precedence: Need clear precedence: tool argument > profile preference > swarm model config > secondary model config > primary model
- Migration: Existing users relying on secondary model for swarm need a migration path
- Overlay ordering: Swarm model overlay must be registered after secondary model overlay so it can reference the secondary-derived entry if needed
Open Questions
- [NEEDS CLARIFICATION: Should swarm model default to secondary model when not configured, or to primary model?]
- [NEEDS CLARIFICATION: Should the swarm model setting apply to both v1 and v2 swarm, or only v2?]
- [NEEDS CLARIFICATION: Should there be a separate
swarm_model section or extend secondary_model?]
Bug Assessment: No dedicated model setting for agent swarm (like secondary/vision model)
Report (verbatim or summarized)
Symptom
There is no configuration option to set a dedicated model specifically for agent swarm operations. Users can configure a secondary model for subagents via
[secondary_model], and a visual model via[visual_model], but there's no equivalent[swarm_model]or similar setting. This forces swarm subagents to either use the primary model or the secondary model, with no independent configuration for swarm-specific workloads.Reproduction
config.tomlfor a[swarm_model]or similar section — it doesn't exist[secondary_model]is availablemodelparameter inAgentSwarmtoolSuspected Code Paths
packages/agent-core-v2/src/features/swarm/configSection.ts— Only definestimeoutMs, no model configuration (lines 13-15)packages/agent-core-v2/src/features/swarm/agent/swarmService.ts— No model configuration handlingpackages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts— Reads model from tool argument or profile preference, not from a dedicated swarm configpackages/agent-core-v2/src/session/subagent/configSection.ts— DefinesSecondaryModelConfigSchema(lines 31-48) andvisualModelOverlay.tsfor visual model — pattern to followpackages/agent-core/src/config/secondary-model.ts— Secondary model overlay implementation to mirrorRoot Cause Hypothesis
Confidence: high
The swarm feature was implemented without a dedicated model configuration section. The pattern exists for:
[secondary_model]— for general subagent delegation (implemented inpackages/agent-core-v2/src/session/subagent/configSection.tsandpackages/agent-core/src/config/secondary-model.ts)[visual_model]— for visual tasks (implemented inpackages/agent-core-v2/src/app/kosongConfig/visualModelOverlay.ts)But no equivalent
[swarm_model]section was created. TheSwarmConfigSchemainconfigSection.tsonly hastimeoutMs.Proposed Remediation
Preferred: Add a
[swarm_model]config section following the secondary/visual model patternSwarmModelConfigSchemainpackages/agent-core-v2/src/features/swarm/configSection.tsmirroringSecondaryModelConfigSchema:model: string (model alias from[models])defaultEffort: string (thinking effort)maxContextSize,maxInputSize, etc.)visualModelOverlay) that synthesizes a derived model entry__swarm__when patch fields existAgentSwarmToolto use the swarm model by default when configured (instead of secondary model)exposesSwarmModelChoiceandbuildSwarmModelDescriptionsfunctions for tool schemaAlternatives:
[secondary_model]with aswarmDefaultfield to specify a different default for swarm vs. regular subagentsswarm_modelkey to the existing[secondary_model]sectionFiles likely to change:
packages/agent-core-v2/src/features/swarm/configSection.ts— addSwarmModelConfigSchema, env bindings, overlay registrationpackages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts— use swarm model configpackages/agent-core-v2/src/features/swarm/session/sessionSwarmService.ts— pass swarm model to spawnpackages/agent-core-v2/src/app/kosongConfig/— add swarm model overlay (new file or extend visualModelOverlay pattern)Tests to add or update:
[swarm_model]config is parsed and appliedmodelparameter still overrides the configRisks & Considerations
Open Questions
swarm_modelsection or extendsecondary_model?]