Repository navigation
Subagent Support #2604
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestsubagentIssues involving subagents or multi-agent featuresIssues involving subagents or multi-agent features
Description
What feature would you like to see?
Summary
Request for official subagent functionality to be implemented in codex.
Background
This codebase https://github.com/bluxolguin/codex.git branch bluxolguin/subagents currently has experimental agent management features (see commit a14a89b) that demonstrate the foundation for subagent functionality. This includes:
- Agent storage system in
codex-rs/core/src/agents_store.rs - TUI integration for agent creation
- Basic prompt templating for agent definitions
Motivation
Subagents would provide several key benefits:
- Specialized Expertise: Different agents for different domains (frontend, backend, DevOps, etc.)
- Context Isolation: Separate concerns and maintain focused conversations
- Workflow Optimization: Task-specific agents can provide more targeted assistance
- User Productivity: Quick access to specialized knowledge without context switching
Proposed Implementation
Based on the existing experimental code, the feature should include:
Core Components
- Agent registry and persistence (partially implemented in
agents_store.rs) - Agent selection interface in TUI
- Agent-specific prompt injection system
- Context isolation between agents
User Interface
- Agent creation workflow (basic version exists)
- Agent switching within conversations
- Agent management command (
/agents) - Visual indicators showing active agent
Agent Types
Consider supporting common agent archetypes:
- code-reviewer: Focuses on code quality and best practices
- architect: System design and architectural guidance
- debugger: Problem diagnosis and troubleshooting
- documentation: Writing and maintaining documentation
- test-writer: Test creation and coverage analysis
Technical Considerations
- Agent definitions should be stored in
~/.codex/agents.json - Subagent prompts should augment, not replace, base codex instructions
- Need clear boundaries between agent capabilities
- Should integrate seamlessly with existing tool usage
Current Status
Experimental implementation exists on https://github.com/bluxolguin/codex.git branch bluxolguin/subagents with basic agent storage and creation capabilities. This provides a solid foundation for official implementation.
Success Criteria
- Users can create custom agents with specific prompts
- Agent switching is intuitive and fast
- Agents maintain their specialized focus throughout conversations
- Feature integrates seamlessly with existing codex workflows
- Documentation and examples for creating effective agents
References
- Existing implementation:
codex-rs/core/src/agents_store.rs - TUI integration:
codex-rs/tui/src/chatwidget.rs:882-984 - Agent creation prompt:
codex-rs/tui/prompt_for_agent_creation.md
Are you interested in implementing this feature?
No response
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestsubagentIssues involving subagents or multi-agent featuresIssues involving subagents or multi-agent features
Activity
seratch commentedon Aug 25, 2025
Subagent feature related PRs are going on. Check them and please feel free to share if there is anything that should be considered: https://github.com/openai/codex/pulls?q=is%3Apr+subagent+is%3Aopen
Git-on-my-level commentedon Sep 24, 2025
FYI for anyone who wants a workaround while waiting for the above PR to get released, the following prompt works well for me
adbl commentedon Oct 13, 2025
@seratch according to the repo contribution guidelines, here is an issue that describes a desired feature, you commented before asking for input on PRs that should be considered.
@cognitive-glitch has references a PR on the topic. I suggest it should be considered.
Please give official input from the organization on the direction here.
dKosarevsky commentedon Nov 6, 2025
when?
tekn0x commentedon Nov 8, 2025
This is much needed.
Goldziher commentedon Nov 8, 2025
+1
r0ck40k commentedon Nov 9, 2025
+1
ACSKamloops commentedon Nov 9, 2025
want
Lerty commentedon Nov 11, 2025
much need
markojak commentedon Nov 12, 2025
Need this for sure to preserve context
[-]Official Subagent Support in codex[/-][+]Subagent Support[/+]83 remaining items
am-will commentedon Feb 10, 2026
you can open the outputs /agent
am-will commentedon Feb 10, 2026
all good bro.
i have no idea what you're talking about but
this sounds relevant. mcp might not be fully integrated properly in subagents:
87ccc5b
I have only tested subagents by asking "launch a subagent and ask it what skills it has" and it rightly returned all its skills. so i assumed it working.
but perhaps there's more polish coming.
good luck.
am-will commentedon Feb 13, 2026
Please forgive me for the second ping everyone :(
Nevermind. Upvote the original lol
Sorry again for the pings.
kanlanc commentedon Feb 15, 2026
There is still a continued issue of sub agents either return the output and the orchestrator doesnt read it, or the subagents never auto terminate themselves and decrease the counter to codex can keep using more sub agents. I have noticed both of these issues trying out sub agents today
am-will commentedon Feb 15, 2026
The orchestrator should close them when all six eventually fill up. I've never seen it fail to, but it does wait until it's used all six, then closes them at once. It's odd for sure. If you're having an issue just steer it via agents or prompting and it'll listen pretty well.
Subagents are working very well for me. We definitely need more than 6 though. I forked codex and now use 12 agents, also made the model and reasoning configurable. Using spark. It's really fun.
ThePlenkov commentedon Feb 15, 2026
May I ask here if someone knows - is there a way to manage transfer/handoff behavior for codex subagents as it works in cagent? Thanks
Reekin commentedon Feb 19, 2026
I don't know if it meets expectation: I explicitly requested to use a subagent for repository analysis, but it still executed in the main session.
am-will commentedon Feb 19, 2026
Make sure you have multi agents on in /experimental menu.
Reekin commentedon Feb 19, 2026
I had enabled it, but I didn't restart codex. After I restarted, it seems works
etraut-openai commentedon Feb 23, 2026
I'm going to close this issue because we have pretty robust support in place now for subagents. It's still experimental, but it's getting broad use. For details, refer to this documentation.
We've already received a number of follow-on requests for features that build upon the core subagent implementation. Please keep the ideas coming!
oxysoft commentedon Mar 9, 2026
A major missing piece for subagents is per-subagent model/provider/profile selection.
Subagents are where model specialization matters most:
I think this should either be part of subagent support directly, or tracked as a linked follow-up issue. There is already precedent for routing bugs/special-path config drift in #5245, so it would be good to define subagent routing semantics explicitly.
acgxv commentedon Mar 9, 2026
Already supported. Check conversion above
Worth to also check https://x.com/yvettec35382/status/2024735963654537690