Repository navigation
Add Claude Code-style reusable subagent types to MultiAgentV2 spawn_agent #32418
Description
What variant of Codex are you using?
Codex CLI and tool-backed Codex sessions (MultiAgentV2 / collaboration.spawn_agent).
What feature would you like to see?
Add a first-class subagent_type (or agent_type) parameter to the MultiAgentV2 spawn_agent tool so reusable custom subagents can be selected by name across all Codex surfaces.
The current V2 tool surface exposes runtime-instance fields such as task_name, message, and fork_turns, but it does not expose the role to instantiate. A task named reviewer is still a generic child; it does not resolve and apply ~/.codex/agents/reviewer.toml or .codex/agents/reviewer.toml.
This conflates two different concepts:
- Task instance identity: the name/path of one spawned run (
task_name). - Reusable agent type: a persistent role with its own description, instructions, model, tools, permissions, sandbox, and MCP configuration (
subagent_type).
A minimal schema addition would look like:
{
"task_name": "review_auth_change",
"subagent_type": "security-reviewer",
"message": "Review the authentication changes.",
"fork_turns": "none"
}At session initialization, Codex should discover custom agent definitions and expose only their names and descriptions to the parent agent, allowing it to select the correct reusable role without injecting every role's full prompt into the parent context.
When spawn_agent is called with subagent_type, Codex should:
- Resolve the named role from user- and project-level agent registries.
- Create a fresh child context.
- Load that role's configured developer instructions into the child.
- Apply its model, reasoning effort, sandbox, tool/MCP, and permission settings.
- Keep
task_nameas the independent runtime instance name. - Return the resolved role in child metadata so the parent and UI can verify what ran.
Unknown role names should produce a structured error that lists available types rather than silently spawning a generic child.
Additional information
Claude Code provides the useful reference design. Its subagent tool separates the reusable subagent_type from the optional runtime name, and loads custom subagent descriptions into the parent agent's available-type context. The selected subagent then runs with the instructions defined in its agent file. This enables both automatic delegation based on descriptions and explicit invocation of a known reusable agent.
Reference: https://code.claude.com/docs/en/sub-agents
This request is broader than the existing runtime bugs: it proposes a stable cross-surface contract for reusable named subagents in MultiAgentV2.
Related issues:
- Tool-backed Codex Desktop ignores prompt model steering and cannot select named custom agents #32291 — Tool-backed Codex Desktop cannot select named custom agents.
- Custom subagents in .codex/agents are not accessible from tool-backed Codex sessions as docs imply #15250 — Custom subagents are inaccessible from tool-backed sessions.
- [CLI] GPT-5.5 forces MultiAgentV2 despite disable and hides documented custom-agent controls #31097 — MultiAgentV2 hides documented custom-agent controls.
- MultiAgentV2 spawn_agent defaults to full-history fork, rejecting agent_type/model overrides #20077 — MultiAgentV2 rejects role/model overrides under full-history forks.
Acceptance criteria:
- V2
spawn_agentexposes a role selector (subagent_typeoragent_type). - User and trusted project custom agents are discoverable by name and description.
- The selected agent file's instructions and scoped configuration are applied to the child.
- Runtime task identity remains separate from role identity.
- CLI, Desktop/App, IDE, and other tool-backed surfaces share the same behavior.
- Existing generic spawning remains backward-compatible when no role is selected.
Activity
github-actions commentedon Jul 11, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
FRITS-Kh commentedon Jul 13, 2026
Still reproducible in:
The exposed collaboration.spawn_agent schema contains only:
It does not expose agent_type, subagent_type, or another role selector.
The project contains valid custom agents under .codex/agents/*.toml.
Because task_name is only an instance label, configured planner/reviewer/coder
roles cannot be selected. This blocks the intended orchestration workflow.
Older multi_agent_v1 sessions on the same machine exposed agent_type, so this
appears to be a MultiAgentV2/collaboration tool-surface regression or mismatch.
etraut-openai commentedon Aug 5, 2026
V2 spawning supports reusable configured
agent_typeroles.