feat(subagents): propose Model parameter for invoke_subagent / define…#328
Closed
MattBetancourt wants to merge 2 commits into
Closed
feat(subagents): propose Model parameter for invoke_subagent / define…#328MattBetancourt wants to merge 2 commits into
MattBetancourt wants to merge 2 commits into
Conversation
…_subagent Add a proposal document describing the desired API changes to support per-subagent model selection in invoke_subagent and define_subagent. Motivation: - Cost-optimised orchestration (orchestrator on pro, subagents on flash) - Capability-differentiated pipelines (extended thinking for specific tasks) - Model benchmarking within a single session The proposal covers: - Schema diffs for both invoke_subagent and define_subagent - Override chain semantics (session → define_subagent.Model → invoke_subagent.Model) - Behaviour spec table for all edge cases - Backwards compatibility (Model is optional, no regressions) - Example JSON for concurrent mixed-model subagent invocation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@google-cla check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional
Modelstring parameter toinvoke_subagentanddefine_subagent, enabling callers to specify which model a subagent should run on — rather than always inheriting the session-level model.Full proposal:
docs/proposals/subagent-model-selection.mdMotivation
Since v1.0.5,
--modeland/modellet users pick a model at the session level. But subagents have no equivalent — they always inherit the parent session's model with no way to override it.This blocks three practical architectures:
Cost-optimised orchestration — an orchestrator reasonably runs on a capable model (e.g.
Gemini 3.1 Pro (High)), but file-scanning and research subagents only need something fast and cheap (e.g.Gemini 3.5 Flash (Low)). There is currently no way to express this split.Capability-differentiated pipelines — some subtasks genuinely benefit from extended thinking (adversarial security review, complex planning). Spawning one subagent on
Claude Sonnet 4.6 (Thinking)while keeping others on a standard model requires either a separate session or awkward workarounds.Model benchmarking — running the same prompt against two subagents using different models for comparison is impossible today in a single session.
Proposed API Changes
invoke_subagent{ "TypeName": "string (required)", "Role": "string (required)", "Prompt": "string (required)", - "Workspace": "inherit | branch | share (optional, default: inherit)" + "Workspace": "inherit | branch | share (optional, default: inherit)", + "Model": "string (optional) — e.g. \"Gemini 3.5 Flash (Low)\"" }define_subagent{ "name": "string (required)", "description": "string (required)", "system_prompt": "string (required)", "enable_mcp_tools": "bool (optional)", "enable_subagent_tools": "bool (optional)", - "enable_write_tools": "bool (optional)" + "enable_write_tools": "bool (optional)", + "Model": "string (optional) — default model for this subagent type" }Override chain (lowest → highest precedence)
Behaviour Spec
ModelomittedModelset indefine_subagentonlyModelset ininvoke_subagentonlyinvoke_subagent.Modeltakes precedenceself-type subagent withModelExample
Currently available models (as of v1.0.6, via
agy models):Gemini 3.5 Flash (Low)/(Medium)/(High)Gemini 3.1 Pro (Low)/(High)Claude Sonnet 4.6 (Thinking)Claude Opus 4.6 (Thinking)GPT-OSS 120B (Medium)Backwards Compatibility
Modelis entirely optional. All existinginvoke_subagentanddefine_subagentcalls without it behave exactly as today — no regressions.Out of Scope (follow-up candidates)
enable_write_tools: true)