feat: allow configuring a separate model for subagents (#568)#707
feat: allow configuring a separate model for subagents (#568)#707wintrover wants to merge 1 commit into
Conversation
Add [subagents] config section to config.toml that allows overriding the model used by subagents independently from the parent agent. Priority order: 1. KIMI_SUBAGENT_MODEL env var (highest) 2. [subagents].model in config.toml 3. Parent agent model (default fallback) Closes MoonshotAI#568
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fc96025d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (envModel) return envModel; | ||
|
|
||
| // Config override from [subagents] section | ||
| const subagentModel = this.session.options.config?.subagents?.model; |
There was a problem hiding this comment.
Honor
[subagents] when loading TOML
When users set [subagents] model = "..." in config.toml, this lookup never sees it: transformTomlData only preserves explicitly handled plain-object sections and has no subagents branch, so the table is dropped during config load; the write path also lacks a subagents section. As a result, the advertised config option silently falls back to the parent model unless KIMI_SUBAGENT_MODEL is set.
Useful? React with 👍 / 👎.
Summary
Adds support for configuring a separate model for subagents via
config.toml, resolving #568.Changes
packages/agent-core/src/config/schema.tsSubagentConfigSchemawith optionalmodelfieldsubagentsfield to bothKimiConfigSchemaandKimiConfigPatchSchemapackages/agent-core/src/session/subagent-host.tsresolveSubagentModel()method with 3-level priority resolutionparent.config.modelAliasassignments in:configureChild()resume()retry()startBtw()Priority Order
KIMI_SUBAGENT_MODELenv varKIMI_SUBAGENT_MODEL=mimo-v2.5[subagents].modelin config.toml[subagents]\nmodel = "mimo-v2.5"Usage
Design Decisions
[subagents]section, behavior is identical to current (inherits parent model)KIMI_SUBAGENT_MODELallows per-session override without config file changesSubagentConfigSchemais optional in both config and patch schemasstartBtw()also respects the override: Side-channel conversations use the configured subagent modelCloses #568