Repository navigation
Allow per-subagent model/provider/profile selection #14039
Copy link
Copy link
Closed
Labels
custom-modelIssues related to custom model providers (including local models)Issues related to custom model providers (including local models)enhancementNew feature or requestNew feature or request
Description
Summary
Codex should allow spawned subagents to run with a different model, provider, or named profile than the parent session.
Problem
Right now, even where Codex supports custom model_provider / profile selection for the main session, there does not appear to be a public way to route subagents to different models/providers.
This blocks workflows such as:
- main agent on a larger reasoning model
- subagents on a cheaper/faster coding model
- OpenAI parent session with local/compatible-provider worker subagents
- specialized agents bound to named profiles (
reviewer,fast-fix,research, etc.)
Why this matters
Subagents are exactly where model specialization pays off the most:
- coordinator agent needs stronger planning/context
- worker agents often need lower latency and lower cost
- some tasks should route to a provider with different strengths or local deployment constraints
Without this, multi-agent support is less useful and more expensive than it needs to be.
Proposed UX
Any of these would solve it:
- Allow subagent creation to accept
profile - Allow explicit
model+model_provideron subagent creation - Allow named agent presets in config, for example:
[agents.reviewer]
profile = "openai-gpt5"
[agents.fast_worker]
profile = "spark"
[agents.local_worker]
profile = "lmstudio-qwen"Then something like:
/agents reviewerspawn_agent(..., agent="fast_worker")
Expected behavior
- Parent session keeps its own model/provider/profile
- Each subagent can inherit parent config by default
- Each subagent can optionally override with another profile/model/provider
- Tooling and status output should show which profile/model/provider each subagent is using
Related context
- Broad subagent request: Subagent Support #2604
- Provider support discussion: Are other provider's models supported? #924
- Routing inconsistency example: The /review command ignores the configured model and endpoint settings, defaulting to gpt-5-codex instead of the specified custom model. #5245
Additional note
OpenAI’s GPT-5.3-Codex-Spark announcement mentions delegating/fanning out work to many models in parallel. This feature would expose that power in a concrete, user-configurable way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
custom-modelIssues related to custom model providers (including local models)Issues related to custom model providers (including local models)enhancementNew feature or requestNew feature or request
Activity
github-actions commentedon Mar 9, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Mar 9, 2026
Please refer to this documentation. You can specify a separate config.toml file for each agent type.
HaoboGu commentedon Mar 18, 2026
built-in sub-agents like
workercannot be configured this way, because I don't want to touchdescriptionanddeveloper_instructionswhich are required for built-in sub-agentsKeesan12 commentedon May 18, 2026
Per-subagent profile selection matters even more if the runtime can inspect it later. I would expose the effective profile, model, and provider on the child metadata and in hooks, not just at spawn time, because cost control and postmortems depend on knowing what actually ran, not what the parent requested. The useful split for me is: planner stays expensive, workers go cheap and fast, verifiers sit in the middle, and every handoff records the effective config. We have been wrapping similar multi-model loops in MartinLoop. If you end up shaping this surface, happy to compare notes against the OSS run-record fields we are using.
souljorje commentedon Jun 9, 2026
~/.codex/agents/[name].tomlAlek2077 commentedon Jul 3, 2026
I’m seeing an even narrower spawn_agent interface in a tool-backed Codex CLI
0.142.5session. The exposed parameters are onlytask_name, message, andfork_turns; there is no agent_type, model, model_reasoning_effort, provider, profile, or custom-agent selector. Consequently, a request to spawn gpt-5.4-mini with medium reasoning cannot be enforced or verified. This conflicts with the current subagent documentation, which describes model and reasoning selection through agent configuration, and with other reported runtime variants that expose explicit model/reasoning overrides.souljorje commentedon Jul 6, 2026
@Alek2077 it was much better when you could just tell main agent "spawn a subagent with a smaller model and low reasoning" and it figured out which model and reasoning to choose on the fly. I ended up making custom agents: small, medium, large, xlarge
iqdoctor commentedon Jul 9, 2026
+1
iqdoctor commentedon Jul 9, 2026
Cross-linking the related bug reports for context:
This enhancement request is relevant context for the same subagent/provider selection problem.
carltonawong commentedon Jul 11, 2026
Adding a concrete project-scoped implementation of the strong-orchestrator / less-expensive-default-subagents pattern requested here:
https://github.com/carltonawong/sol-ultra-workaround
It uses a project-level
[agents.default]configuration to keep SOL Ultra / Ultra as the orchestrator while routing compliant isolated default subagents to Terra High / High. It also requires compactfork_turns="none"handoffs, treats completed subagents as terminal, and independently verifies the effective model, effort, and context before accepting a result.A fresh Codex 0.144 canary produced one SOL Ultra / Ultra orchestrator and two sequential, distinct Terra High / High subagents, each with isolated context and exactly one turn.
This does not provide the dynamic per-subagent model, provider, or profile selector requested in this issue, so it is not a replacement for the upstream feature. It is an experimental, reversible project-scoped stopgap with documented tests and limitations.
ChanTinPing commentedon Jul 11, 2026
Strong +1. With GPT-5.6 Sol High, making every subagent inherit the same model and reasoning level can consume usage limits very quickly. Please allow per-role model/reasoning overrides—for example, a strong coordinator with cheaper explorer and reviewer agents—while keeping inheritance as the default.
ChanTinPing commentedon Jul 11, 2026
Strong +1. Please allow subagents to override the parent model and reasoning effort. Many worker tasks do not need the same expensive configuration as the coordinator, and forced inheritance wastes usage limits.
CodeWarriorr commentedon Jul 12, 2026
There is a second capability gap here beyond selecting a predefined custom agent.
In a tool-backed Codex CLI 0.144.1 session, the collaboration wrapper currently exposes only:
There is no
agent_type,model,model_reasoning_effort,profile,sandbox_mode, skill allowlist, or MCP allowlist.That makes adaptive routing impossible even if custom-agent discovery is fixed. A coordinator should be able to inspect the task and create a one-off child with the smallest sufficient capability, for example:
{ "task_name": "scan_transcripts", "message": "Extract the requested evidence and return a compact table.", "fork_turns": "none", "model": "gpt-5.6-terra", "model_reasoning_effort": "low", "sandbox_mode": "read-only", "skills": [], "mcp_servers": [] }This is materially different from forcing users to predefine static agents such as
small,medium, andlarge:The safe contract should be:
spawn_agentaccepts either a namedagent_typeor explicit ephemeral overrides.The fail-closed behavior is essential. In our reproduced case, three children intended for cheaper read-heavy work silently ran on
gpt-5.6-solat high reasoning and recorded a combined 2,043,537 tokens. The related custom-agent selection failure and transcript evidence are documented here: #15250 (comment)The desired workflow is: strong coordinator, cheap narrow I/O workers, selectively strong synthesis/review workers, isolated context where appropriate, and verifiable effective configuration for every child. Static custom agents are useful, but they are not a substitute for runtime per-task routing.
pixelsama commentedon Aug 4, 2026
First-class Advisor routing for high-impact decisions
I would like Codex to support an Advisor or “second opinion” mechanism for important decisions.
The desired workflow is:
Useful initial triggers could include architecture choices, security boundaries, data migrations, public API changes, irreversible actions, or repeated failed attempts.
This should not run on every turn. A practical UX could include:
Please also consider per-task call limits, token/cost/latency budgets, duplicate-call suppression, privacy controls, visible model attribution, and graceful fallback when the Advisor is unavailable.
This would provide a quality gate for high-impact decisions while preserving the speed of the primary agent. It is not intended to create a model debate on every task; the key value is selective, bounded, and auditable second-opinion review.
etraut-openai commentedon Aug 5, 2026
Subagents support model, reasoning, provider, and role configuration.
lxsloves commentedon Oct 13, 2026
Following up on the resolution note: per-role configuration is useful, but automatic delegation still has a gap. When the coordinator discovers work and launches a child on the fly, it cannot choose that child's model and reasoning effort based on the task; automatically launched children inherit the parent unless a preconfigured role is selected.
This means routing a simple read-only task to a cheaper/lower-effort model and a synthesis or review task to a stronger model requires static roles instead of adaptive dispatch. Could the automatic spawn path support per-spawn
modelandmodel_reasoning_effortoverrides, with inheritance as the default, and expose the effective values? If this is already supported in a particular Codex surface, please point to the documented mechanism.etraut-openai commentedon Oct 13, 2026
(response from codex)
@lxsloves, per-spawn subagent overrides are supported: the parent can pass
modelandreasoning_efforttospawn_agentwithout selecting a static role. The spawn argument isreasoning_effort, rather than the config-file namemodel_reasoning_effort. See the tool schema and child configuration logic.There are qualifications: some surfaces can hide those controls, and some parent instructions require an explicit user request before choosing a different model. So adaptive selection without any user direction is not guaranteed. The effective model and effort are emitted in subagent activity, but they are not currently included in the
spawn_agentreturn value. If you’re seeing the narrower interface, please share the Codex version and surface so we can identify that path.