feat(agent-core): allow subagents to select configured models#1841
feat(agent-core): allow subagents to select configured models#1841AidenNovak wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: cfbcab9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfbcab9b30
ℹ️ 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".
| throw new Error('Requested model alias is not in the exposed directory'); | ||
| } | ||
| } | ||
| this.modelResolver.resolve(modelAlias); |
There was a problem hiding this comment.
Freeze the resolved model configuration across approval
When /reload remaps an existing alias while an AgentSwarm call is waiting for manual approval, this preflight resolution is discarded and only the alias string is captured; runSwarm later resolves that alias again, so an approval displaying model fast can launch a different provider or wire model with different cost and capabilities. Preserve an immutable resolved binding or detect a changed mapping and request approval again. The same alias-only capture pattern also exists in the v2 Agent tool and both v1 collaboration tools.
Useful? React with 👍 / 👎.
Related Issue
No linked issue. The limitation and motivation are described below.
Problem
Delegated
AgentandAgentSwarmruns currently inherit the caller's active model. Users can already configure multiple model aliases inconfig.toml, but the main agent cannot discover those aliases or select a different configured model for delegated work.This prevents useful routing patterns such as keeping the main conversation on one model while assigning exploration, coding, or parallel swarm tasks to another model.
What changed
subagent-model-selectionexperiment, disabled by default and available throughKIMI_CODE_EXPERIMENTAL_SUBAGENT_MODEL_SELECTION=1.AgentandAgentSwarmwhen the experiment is enabled.modelargument so the main agent can select an exact displayed alias; omission preserves the current inheritance behavior.The implementation is split into four reviewable commits: v1 Agent, v2 Agent, v1 AgentSwarm, and v2 AgentSwarm.
Validation
--helpanddoctorsmoke checks passed against the locally built CLI.Agentand v1/v2AgentSwarm, with the main agent usingkimi-code/k3and delegated children usingdeepseek-v4-flash; both swarm paths launched two children on the selected alias.The real-provider smoke-test harness and its results are local-only and intentionally not committed.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.