Skip to content

Comments

feat: add model parameter to Task tool for dynamic subagent model selection#14961

Open
albahrani wants to merge 1 commit intoanomalyco:devfrom
albahrani:feat/task-model-parameter
Open

feat: add model parameter to Task tool for dynamic subagent model selection#14961
albahrani wants to merge 1 commit intoanomalyco:devfrom
albahrani:feat/task-model-parameter

Conversation

@albahrani
Copy link

@albahrani albahrani commented Feb 24, 2026

Issue for this PR

Closes #6651

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds an optional model parameter to the Task tool so callers can specify which model a subagent runs on at invocation time, instead of relying solely on static agent config or parent session fallback.

The resolution order becomes: params.model > agent.model > parent session model. Existing behavior is unchanged when the parameter is omitted.

This is needed for orchestrator workflows (e.g. gsd-opencode) where different subagents should use different model tiers based on their role, determined dynamically at call time.

How did you verify your code works?

Built from source on Windows, replaced the installed binary, and tested three scenarios:

Test model param Agent frontmatter Expected Actual
Dynamic override to Haiku github-copilot/claude-haiku-4.5 (none) Haiku Haiku
Dynamic override to Sonnet github-copilot/claude-sonnet-4.6 (none) Sonnet Sonnet
No param, no frontmatter (none) (none) Opus (parent) Opus

Verified by spawning subagents and checking the model ID in their system prompt.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Feb 24, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found the following potentially related PRs:

Related PRs:

  1. PR feat(agent): implement model tier selection with variant support for subagents #11377 - feat(agent): implement model tier selection with variant support for subagents

  2. PR feat(task): pass variant to subagent so it inherits parent's thinking level #12567 - feat(task): pass variant to subagent so it inherits parent's thinking level

  3. PR feat: add variant support for subagents (#7138) [alt of #7140] #7156 - feat: add variant support for subagents (#7138) [alt of #7140]

These PRs appear to be related efforts in enabling dynamic subagent configuration. You may want to review them to ensure there's no overlap in implementation or to see if this PR should be coordinated with existing variant/model selection mechanisms.

@albahrani
Copy link
Author

Thanks for flagging the related PRs. Here's how this one fits in:

This PR is intentionally minimal (9 lines, 2 files) to provide the foundational mechanism. It doesn't conflict with any of the above and could serve as a building block for #11377's tier resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Dynamic model selection for subagents via Task tool

1 participant