Subagent configuration and orchestration
What variant of Codex are you using?
cli
What feature would you like to see?
support to config which model and reasoning_effort to use for subagents in ~/.codex/config.toml
may it can be an option of slash cmd: /agents -> config
Description
Current Pain Point
Currently, I prefer using gpt-5.2 for high-level task planning and orchestration, and gpt-5.3-codex or spark for the exploration and execution of specific tasks. However, due to the lack of per-agent model configuration, users are stuck choosing a single model or using a pre-defined configuration for the entire run.
This creates a dilemma:
- Sacrificing Planning Quality: Using a smaller model (like Spark) everywhere results in poor high-level orchestration.
- Sacrificing Efficiency & Cost: Using a larger model for simple subtasks that don't require it sacrifices speed and cost-effectiveness.
Feature Suggestions
To maximize effectiveness and efficiency, I hope to configure subagent behavior and models granularly:
- File-based Configuration & Definition
- Please consider supporting subagent configuration not only via
~/.codex/config.toml(global) but also via files like.agents/subagents/explore_agent.mdat the repository or user level. - As @am-will mentioned, similar to how Claude defines subagent configurations through files, I hope subagent instructions can be defined like
AGENTS.md. - Permission configuration also needs to be supported.
- Agent Management Commands
- The slash command
/agents -> listshould show which subagents are currently available. - Support for disabling and enabling specific subagents via command.
- Custom Subagent Examples & Context Optimization (New)
Beyond basic configuration, I hope to support (and see examples of) custom exploration behaviors tailored to specific domains or projects. Different tech stacks require different exploration strategies:
- Frontend Architecture: An exploration agent could be instructed to prioritize the component tree, state management (Store), and routing structure.
- Backend Architecture: Depending on the language (e.g., Go vs. Python), the agent should prioritize API definitions, DB schemas, or middleware logic.
- Repo-level Optimization: Allow writing custom exploration instructions for specific repositories.
Value: Optimizing exploration behavior for specific repos can effectively reduce the "task cold start time" when a user raises a new requirement in a fresh session. The agent wouldn't need to perform a generic full scan but could follow the pre-defined "map" to locate relevant context immediately.
Expected Outcome
If this subagent configuration and behavior can be supported, users can use it out of the box while also leveraging customized exploration behaviors. We'll see interesting possibilities.
70 Comments
We prioritize feature requests based on upvotes from the community. If a feature request doesn't get enough upvotes, we'll close it. It's therefore important for a feature request to have a clear and compelling title and description. Speaking from experience, I don't think this one will attract much attention. You might want to try to improve the title and provide more details.
We also recommend that feature requests focus on the problem statement rather than a solution. Describe the use case and what problem you'd like to see solved. There are often multiple ways to address a given problem.
This is much needed given Spark's low context window. I have a pretty well optimized setup for AGENTS.md and MCPs, but Spark exhausts context window too quickly. Even competitors' 200k window feels small and results in frequent compaction, 128k results in an experience which feels like more compaction than coding (subjective). Orchestrating Spark subagents with "full" Codex, and excluding MCPs/AGENTS.md from subagent context would allow users to benefit from its speed while still being able to complete work which normally requires more context.
This is absolutely crucial to achieve the true power of the subagent system, using a smarter capable model for planning and smaller efficient and fast models for implementation based on the orchestrator's instructions.
This is a non negotiable in my opinion. This is a must have feature.
I would add that config might not be only via custom config.tomls, but just directly in a running session to expose model and reasoning level for the managing agent to be able to pass, similar to current prompt and task parameters.
Leaving this here since mine got closed (no worries @etraut-openai thanks)
To expand on this, this deserves to be defined more clearly, hopefully OP updates the description:
---------------
The ability to configure which model and reasoning_effort level subagents use, separately from the main agent. This could live in ~/.codex/config.toml and/or be exposed as an option under the /agents → config slash command.
Why this matters
Right now, there's no way to control what model or reasoning level subagents run with. With the introduction of Spark (which has a 128k context window), this becomes a real limitation. Spark is excellent for fast, scoped implementation tasks, but it doesn't make sense as the planning or orchestration layer given the smaller context.
Subagent support is still missing in Codex, and this issue is exactly the gap:
Skills/config define what to do, but not who does it (model, tools, permissions, prompt, memory).
Claude Code’s per-agent YAML gives a portable, version-controlled way to define that who.
And the YAML allows you to define n number of subagents, all with different models/reasoning level for different tasks. TRUE customization. Right now, we have just 1 subagent and we're stuck with that.
Proposed ideal (aligned with this issue):
A first-class agent registry in Codex (project + user scope).
Agent definition files compatible with Claude Code’s format (or a small, documented superset).
Ability to invoke agents directly or pair with skills (e.g., a skill that routes to a named agent).
Model/tools/permissions/memory/prompt all captured per agent, and checked in at the project level.
The ideal workflow looks something like this:
Planning and orchestration with a higher-capability model (e.g. base 5.3) that can hold the full project context and break work into well-defined tasks
Implementation via subagents using Spark or another lightweight model that executes those tasks quickly and cheaply
Without per-agent model configuration, users are stuck choosing a single model for the entire run. That means either sacrificing planning quality by using Spark everywhere, or sacrificing speed and cost efficiency by using a larger model for implementation subtasks that don't need it.
Proposed config example
toml[agent]
model = "codex-5.3"
reasoning_effort = "high"
[subagent]
model = "codex-5.3-spark"
reasoning_effort = "low"
Additional information
This would pair well with existing slash commands. For example, /agents config could allow toggling subagent settings mid-session for experimentation without editing the config file directly.
Thank you for reading! PLEASE UPVOTE the issue itself (first message) if you agree.
Adding my 2 cents that I think spark and future mini models would be amazing subagents for context discovery which codex already naturally loves to do. Can make the context window of stronger codex models go a lot further
Hey folks, thanks for the feedback. What would you think of something like this:
Codex can load sub-agent role definitions from
agents_config.toml.If you think this is a good design, this can land early this week
Can we have options for these sub-agents to configure which MCP tools are passed to those? Opt-in would be my prefference, we can also have a default behavior of "pass all": options unset = enable all, options set = only specified enabled.
Does the instruction file override or append to AGENTS.md?
If agents are configured, would Codex by allowed to use _only_ the configured ones, or would it still have access to "general" subagent (current behavior)? If the latter, how do we configure these settings for the default subagent?
@jif-oai
I think that's perfect, it'd achieve exactly what a subagent system needs. Only extra note is that I'd make sure it's possible to also specify
configper agent -- akin to doing-cin CLI args.This is because we want to ensure some subagents don't have access to some skills, which is something I have to handle via the config arg currently.
@jif-oai
Can
agents_config.tomlbe defined in code repo level to override the user-level?Specific subagent,
instructions_fileguide it's behavior might bind the repo.agents_config.tomlis a fine solution - I've been using SKILL.md files and asking the orchestrator/supervisor agent to pass the skill as the personality (explorer/implementor/reviewer/etc) - telling it to just spawn the named subagents directly would be more standardized. But I agree with @ticoAg that there should be repo-level overrides for subagent definitions - although AGENTS.md files already tweak model behavior per repo/folder, it would be better for context management and focused optimization not to have a large AGENTS.md for all cases but custom subagent definition files instead.@merlinnot ok will add
@merlinnot this will be developer instruction (so same as
AGENTS.md) because we have some gating on the system prompt@merlinnot It will still have access to the
mainone unless you override it.mainis basically a copy of the parent agent@slobodaapl I think this adds an extra layer of complexity and I'm not convinced this is the right way to do (lots of caveats with this approach). I would propose a
config_overrides=<...>field in theagents_config.tomlthat replicates the CLI flags.@ticoAg and @ignatremizov let's first start with the a global version in
~/.codexand we can extend in a follow-up. I want to make sure we have the right primitive for this before people start versioning this fileAny other comments?
Pretty cool to see everyone answering so quickly! Thanks folks
What would the app-server RPC be? Just let the agent running the turn spawn/manage its own subagents? I don't remember exactly if this is the case already, but could sub-agents be also exposed to the running threads on app-server, and to pass an agent config, like via
UserInput::Agentas done now viaUserInput::Skill?LGTM! On per-repo config - long term I would also prefer to have those at the repo level, but I get your point about starting with global. However, how would that work with MCPs when those are specified at the repo level? As an alternative, maybe we could mark it experimental and have people versioning experimental features be aware that there can be breaking changes?
@ignatremizov for now the spawning is handled by the parent agent and configs are not dynamically injected. You will just have to tell your main thread something like "can you spawn a
testeragent and ask it to ...> LGTM! On per-repo config - long term I would also prefer to have those at the repo level, but I get your point about starting with global. However, how would that work with MCPs when those are specified at the repo level? As an alternative, maybe we could mark it experimental and have people versioning experimental features be aware that there can be breaking changes?
@merlinnot I don't have a solution yet for per-repo MCPs. And from my experience, people are very bad at considering any feature as "experimental" and not open 20 issues when an experimental thing does not behave 100% as expected.
But I hear you on the need for per-repo configuration and I will make sure the follow-up come soon after the main implementation. I'll design the code to make it pretty easy
@jif-oai ok, just it is important for "spawn a
testeragent" to be deterministic :) - as with skill token injections, if I see that the prompt to the spawned agent has $skill in its prompt, I know that the relevant SKILL.md is injected. So withagents_config.toml- we need a guarantee that the subagent has theinstructions_fileproperly set (fallback to normal AGENTS.md, plus of course passed prompt) - not only just that model/reasoning effort configured.@jif-oai A
config_overridesfield works perfectly fine, would be very much appreciated if present, thanks!🧑🍳
Just step-by-step with
agents_config.toml. First let's configure basic subagent cfg like model and reasoning_effort, manual settings can overwrite the defaults. 🫡🫡I think something like this would fit most use-cases: https://github.com/openai/codex/pull/11917
After some internal discussions. I will move this to the main
config.tomlThe feature should land tomorrow
FIRE thanks for moving so fast on this. ILY
Great to hear. Thanks @jif-oai
I'm really great to hear that. Thanks @jif-oai
Can we define subagents per project also?
Good job on getting this subagent feature across the line everyone.
If I could call upon you one more time to upvote this: https://github.com/openai/codex/issues/11965
My Feature Request would allow you to set MAX_THREADS to whatever you want.
This will allow you to exceed the cap of 6 agents and launch however many our own PCs can handle
It would be a variable in the CONFIG file, like this.
I have this working in my own fork. It was very easy. They could do this change in 15 minutes but we need upvotes for sure.
<img width="342" height="137" alt="Image" src="https://github.com/user-attachments/assets/83791d2d-6d2e-498d-b81e-fa1183f78749" />
As you all know, 6 is too limiting. I want 15, 20. Give me all the agents.
You know what to do. Thanks everyone!
@jif-oai
This direction looks great. Sharing how I run it today in case it helps.
With this, I can spawn up to 12 agents. It works great in my local setup.
I use a strict hierarchy with review loops:
One thing I really like from your roadmap is per-agent config.
I currently use external
codex execcoding workers because internal agents still share one default config, while coding workers need different model/reasoning settings.Key override pattern:
One concern if coding agents become fully internal: the current concurrency cap (6) is easy to hit in real parallel runs.
Typical shape is
1 x Main + N x Assistant + N x Coding, so capacity gets exhausted quickly.If possible, it would be great to have either:
<details>
<summary>Protocol excerpt from AGENTS.md</summary>
````md
2) Role Stamps (Mandatory)
Root thread:
Main -> Assistant:
Assistant -> Coding:
Rules:
blocking_reason="role_ambiguous".[ROLE:ASSISTANT][PARENT:MAIN].[ROLE:CODING][PARENT:ASSISTANT].role="assistant"andparent_role="main".role="coding"andparent_role="assistant".3) Routing
Definitions:
pure_coding: repository content write (code/docs/config/scripts/tests).non_coding: research/review/triage/brief/log analysis without repo writes.design|mixed: architecture or strategy decisions.Default:
pure_coding -> assistantnon_coding -> assistantdesign|mixed -> mainmainHard rules:
pure_coding.4) Dispatch Preflight (Main, Mandatory For Non-Trivial Tasks)
Dispatch Preflight.~/.codex/dispatch-preflight.schema.json.goal,non_goals,constraints,acceptance_criteria,decisions.allowed_pathsmust be absolute and non-empty.delegate_target="assistant".delegate_target="main"(no repository writes).Trivial only if all true:
If Main does not dispatch delegateable non-trivial work, set exactly one routing
fallback_reason:scope_not_clearnot_independent_splitdecision_neededblockedexplicit_main_decision5) Parallel Scheduler (Aggressive)
Main on Assistant slices:
Assistant on Coding slices:
review_only) before reporting upward.6) Invocation
Assistant orchestration is native collab only:
spawn_agentwaitclose_agentCoding invocation (Assistant only):
Rules:
--prompt-filefor large prompts.--workdirmust be an absolute trusted repo/worktree path.~/.codex/agent-output.assistant.schema.json.~/.codex/agent-output.coding.schema.json.7) Review And Acceptance
Assistant gate:
review_onlyverdict.status="done"andblocked=false.Main checks (JSON fields only):
blocked=false -> blocking_reason="not_applicable".blocked=true -> status="awaiting_review"andblocking_reason != "not_applicable".review_only=true -> rationalestarts withREVIEW_ONLY:.status="done" -> self_check.status="pass".triggered_by="assistant"andinvoked_via="~/.codex/coding.py".8) Stop Conditions
Stop and return blocked on:
ssot_idorsubtask_id.allowed_pathsviolation.````
</details>
<details>
<summary>Full coding.py</summary>
</details>
---
@am-will
Yeah, we need more!
@am-will this is already supported in the config
@Nebu1eto yes because it is being moved to the
config.tomlyou can use this: https://developers.openai.com/codex/config-basic#configuration-precedenceReally glad to see this getting official attention — @jif-oai the
agents_config.tomlproposal looks solid.Building on @merlinnot's question about per-agent MCP tool access — the
allowed_toolslist is a good start, but there's a related dimension that's easy to overlook: credential scoping.When you have multiple subagents with different MCP tool sets, the underlying credentials those tools use also need to be scoped. Example:
The explorer agent has
github_searchbut should probably only get a read-only GitHub token. The implementor needs push access. If both use the same PAT, the read_only sandbox policy is bypassed at the API level — the explorer can make write API calls through the MCP tool even if file writes are blocked locally.Suggestion: credential profiles per agent role
This way the permission model extends beyond the sandbox (file system) to external API access, which is where most real-world damage from a misbehaving subagent would happen.
The MCP ecosystem is starting to converge on this pattern — separate credential injection from tool execution, with per-agent identity determining which credentials get injected. Curious if this is something the Codex team has considered as part of the
read_only/ permission design, or if it's being deferred to the MCP server layer.We are making a release right now (
0.102.0) that should contain a first version. Basically you can update yourconfig.tomlto have something like thisAnd the
config_filethat is reference will be used as an overlay for the config of the sub-agent.This is a first version but let me know the corner cases you find or how would you like to see this evolving
Thank you brother, can you please leave a full example of an agent config so we can know all the parameters it accepts? thanks :)
I have the following setup as a test:
in documenter.toml:
Whenever I check the agent session for the documenter agent, it does not appear to be using the model I requested.
I know this was not the case before, because I made subagent models configurable in a fork of codex, and it correctly showed the model (I used Spark) in both the OpenAI codex "box" at the top of the agent session, as well as the statusline.
It appears to me like its just using the inherited model right now unless I have it misconfigured.
<img width="1141" height="1027" alt="Image" src="https://github.com/user-attachments/assets/8cc5b8f0-17ea-4cd2-92e0-72b9b574786d" />
@jif-oai
You can see an example of what i'm talking about in this video at 2:40, where I used 5.3 Codex as orchestrator, and Spark as subagents.
https://x.com/LLMJunky/status/2022712980090105883?s=20
Codex log confirms 5.3 Codex was used and not the configured model from the configuration file:
I used to read the code myself to enable under-development features. Or find the hidden parameters.
Later I realised I could simply instruct my codex agent to do it. It works perfectly.
I do this because I use Nix to manage configurations and files are immutable so the UI can’t update them. Now I use codex and Nix together to manage those configurations.
thank you. i tried that earlier and it wasn't able to tell me.
but what i was able to do was clone the repo and run tests that way.
I can confirm it is using the correct models, but it is not displaying it when you open those agent sessions (it did before)
it would be great if when you opened an agent session using /agent that it would appropirately show the model/reasoning that it actually used.
right now, its still showing the parent agent's model/reasoning instead of what it used for that subagent.
@am-will Will fix
Actually it works on my side. Can you make sure the config is properly setup and you're up to date? I will add a config validation layer
Here is my
config.tomlAnd my
treeMain delegates execution to parallel Assistants.
Each Assistant delegates implementation to Coding workers.
Coding reports to Assistant; Assistant reviews and can assign rework.
Assistant reports to Main; Main reviews and can assign rework.
This won’t work anymore if switch from the
codex execexternal agent to the internal agent.An assistant agent can’t spawn a coding agent.
Codex doesn’t allow "nested" subagents.
I’ll need to adjust the prompt to use the main agent to relay messages between the assistant agent and the coding agent. Otherwise, it won’t be truly "parallel" because the main agent needs to review every coding agent’s work in a single thread.
Nested can maximize the subagent power. But for safety, we can have a config like
max_depthor hardcode it to2.Thanks Jif. I shouted you out here:
In this MULTI AGENT SETUP GUIDE
I appreciate this feature so much. THANK YOU!
Btw if you have good agents you would like us to land as built-ins so that everyone can use them. Feel free to shoot
@jif-oai I've been using a custom search skill as a subagent before this feat. dropped that's been tremendously useful, because it produces explicit spans the agent can use.
Tl;dr -- It is provided explicit instructions to be a search agent and follow instructions to retrieve specific spans and explanations / summaries on how they relate to the search query.
It is read-only, search-enabled (if allowed top-level), and outputs a JSON based on schema:
with the prompt:
---
Naturally the prompt is rather simplistic and could be enhanced, but this worked well for me.
As mentioned I used it as a skill so it involved referencing a script that the agent runs, if this is at all relevant or useful:
I did it this way to prevent polluting parent agent's context, since they don't need to actually see the subagent's progress on the research, only the final output.
I reckon this agent would be useful with 5.1 mini as I used it, or the new spark model, with high reasoning to ensure it can sufficiently reason about the query and all that it needs to capture in its output, while being cheap and fast.
My friends and I wrote an article about diving into multi-agents.
I'm eagerly anticipating the release of the "nested" agent, maybe in
v0.105orv0.106?I'll continue testing and provide feedback!
Nice article. They're already in the alpha
[agents]
max_depth = n
Be careful going over 2 lol
https://x.com/i/status/2024647077586731351
@aurexav Actually I just merged a parameter for max depth yesterday so it will be in the next release
Just be careful with your rate limits
You're the best. I don't know how I'm going to use this yet but obviously this opens a new world of possibility
Qq though
Is max threads a total agent budget?
Or is it per session
If I have it set too 12 threads and 2 depth, can each subagent on the first level down open 12 more agents?
12*12?
Or is 12 the cap across all depth?
Thx!
It should be 24 in total. It's dynamic.
Just an example without too much thought.
@jif-oai one more thing, its only slightly related but i noticed in your original proposal, you seemed to have provision to configure the plan mode's model/reasoning level, can you please add that in? i dont think most people want to plan on medium. prob not a subagent thing, but still kinda related. appreciate it.
https://github.com/openai/codex/issues/11013#issuecomment-3938100469
@jif-oai Heyo, I was looking through code and I noticed one minor issue. If I understand correctly, since each agent can have their own config version, in effect we can do per-subagent sandboxing.. Same with web access configuration, tool selection, etc. -- What's missing right now is per-agent allowlist. It's possible to already do per-agent approval configuration (ask/always forbid/full access) but no way to specific a path to a custom approved command ruleset / allowlist.
Would this be possible?
One more thing worth nothing is that it seems sandboxing doesn't currently allow granular file-level sandboxing, only entire directories, which is one more issue to solve before the subagent harness will become super powerful and secure.
Do you think I should open an issue for this?
Good stuff
They also address the subagents getting 'stuck' with agent injection notifications.
Now when agents are done, they inject a message back into the parent that tells them if they're blocked or done, picks it up at the next thinking step.
Commit: https://github.com/openai/codex/commit/2daa3fd44fe5787aee79016a1019fe8cec369151
Additionally, they added names to all agents, and also list their [agent.role] as well, even if the agents go 2+ depth, they all show up on the top layer.
<img width="1225" height="434" alt="Image" src="https://github.com/user-attachments/assets/5e59fccc-2580-413d-9dd4-5355899e60ba" />
One change I'd still love to see though is for the agents to not disappear from the /agents menu when close_agent is called. Although I think he said he was working on this. I would like to be able to audit all threads, even if they are closed. Could probably check session logs but typing a slash command is far easier.
0.105.0 is a huge QoL update for subagents all around.
This should fix the issue where too many open agents prevents the orchestrator from opening more.
Is there a way to control which skills are available to each subagent? Ideally, I want each subagent to have a private set of skills not accessible to other agents.
No, mcp and apps yes but not skills. The only thing you can do is make them available project or subfolder scopes. Hopefully they add that but codex is quite good at calling them in general so it's not the end of the world. Agree though
Jif, the people have spoken.
<img width="604" height="604" alt="Image" src="https://github.com/user-attachments/assets/777d45df-98af-4ecb-847f-cb18a53ca678" />
https://x.com/SIGKITTEN/status/2025232589288583208?s=20
@slobodaapl adding on my todo. Should be done end of this week
@slobodaapl this is planned but I'm not the one working on this so I don't have an exact timeline in mind tbh
@am-will happy you like it. This is the first nano-step to make them easier to handle
@am-will this is by design for now. Otherwise it would make it way harder to follow which agent is doing what. But I'll try to propose something for this
@cogscides not for now. Do you have a very concrete use-case that required this? If so, I can work on it
Btw, if you have some thoughts on this: https://github.com/openai/codex/discussions/12567
@jif-oai
Yes — I have a concrete use case. Right now skills are effectively global, and in practice they accumulate quickly across projects. I’m already at the point where my global skill set is getting large and heterogeneous (design skills, development skills, local machine environment skills, server skills, etc.).
What I’d like is an agent-scoped skill model similar to how OpenClaw structures agents: each agent has its own folder/config and its own skills that aren’t automatically visible to other agents. Once your skill base grows to ~50+ skills, it becomes important to explicitly control which agent gets which subset, both for correctness and for boundary/permission hygiene.
Today there isn’t a real workaround. You can add additional skills via a per-project basis. You can also define agents per project, but that still doesn’t let you control which skills an agent can see—it only ever expands what’s available. As a result, you can’t isolate capabilities per subagent, and skill management gets increasingly messy as the global set grows.
Concretely, I’m looking for (1) an explicit per-agent skill allowlist / registry so each subagent only sees the skills it should, and (2) a way to select the agent at invocation time. The analogy to codex exec is that it already lets you pass execution-time parameters (e.g., working directory / config overrides / model provider). I’d like a similar mechanism for agents: run codex exec with --agent <name> (or equivalent), where that agent’s own config and skill set are what get loaded—rather than every agent inheriting the global skill pool.
@cogscides ok thanks for the details. I will work on this later this week and come with something
@jif-oai Similar to the previous comment, one issue I ran into is that subagents inherit global instructions file and there's no way to set "this only applies to root agent"
In my fork I added a simple config option for agents that's just:
inherit_instruction_fileeither true or false, default true.And I found that skill config in agents' configs doesn't work, so can't disable per subagent skills. (I think this is already covered by others above)
I noticed something that I'm not sure why it happens:
When I send the following prompt:
the “default” agent is used, which calls tool
codex.list_mcp_resourcesand does not see any MCP servers:When I send the following prompt:
a custom “worker” agent (only model and reasoning set) is used, which does not call any tool and sees all MCP servers that the parent has:
Should I open an issue?
I’m seeing what looks like a global subagent-thread cap shared across multiple concurrent
codex resumeprocesses, which IMO should not be the case.Observed behavior
max_threads = 32operatorsubagents in parallel.collab spawn failed: agent thread limit reached (max 32)Evidence suggesting cross-session contention
ps -Ao pid,etime,command | rg '\\bcodex( resume)?\\b'codex resumeprocesses.This strongly suggests the “max 32” limit is enforced across all running Codex sessions (or a shared runtime pool), rather than per independent Codex process/session. That makes concurrency testing and real workloads unpredictable unless users manually ensure all other sessions are closed and all subagents are
close_agent’d.Expected behavior
max_threads = 32budget (or the UI/config should make it explicit that the limit is global/shared and provide tooling to introspect/kill leaked subagents).Update after tightening our protocol: we enforce strict parent->direct-subordinate spawning only (no skip-level spawns, no same-level spawns). Under that valid hierarchy, depth=3 still fails because the nested orchestrator lacks the
spawn_agenttool.Protocol hierarchy (strict)
Environment
0.105.0-alpha.2326.3(Darwin25.3.0, arm64)max_threads = 32,max_depth = 3Repro (valid chain, no forbidden edges)
1) From main, spawn an Auditor (
spawn_agent(agent_type=auditor)).2) Ask the Auditor to spawn an Orchestrator (
spawn_agent(agent_type=orchestrator)).3) Ask that Orchestrator to spawn a Coder or Operator (
spawn_agent(agent_type=coder_spark)oroperator).Expected
Step 3 should succeed (Orchestrator spawning its direct subordinate is allowed by protocol and should be allowed by runtime when
max_depth >= 3).Actual
Step 3 fails because the nested Orchestrator reports that
spawn_agentis not available (e.g.blocked=true reason=no_spawn_agent_tool).This blocks any strict-hierarchy depth=3 workflow (
main -> auditor -> orchestrator -> coder/operator).Additional finding: this behavior lines up with the recently-merged
agents.max_spawn_depthchange from PR #10935.PR #10935 introduces
agents.max_spawn_depth(default appears to beSome(2)) and uses it to decide when to disable Collab features for spawned subagents.In our strict chain
main -> auditor -> orchestrator -> coder/operator, the orchestrator is a thread-spawned subagent at depth=2, and it consistently reportsno_spawn_agent_toolwhen asked to spawn its direct subordinate.Hypothesis:
agents.max_depthcontrols structural nesting.agents.max_spawn_depthcontrols how deep Collab tools (includingspawn_agent) remain available to subagents.max_spawn_depth=2, a nested orchestrator may lose Collab, so it cannot spawn leaf agents even though the hierarchy is valid andmax_depthis sufficient.Potential fix/workaround:
agents.max_spawn_depthdefaults and enforcement match expected multi-agent workflows (depth=3 chain).max_spawn_depth >= 3when multi-agent is enabled, or provide a clearer error when Collab is disabled due to spawn depth.@aurexav, please do not have your agent post to our issue tracker.
I instruct it to post the update here. This is not a self-automated process.
codexrun rather than being globally applicable.This is in line with the other feedback provided.
Please ignore
agent_max_spawn_depthfor now. This parameter is orthogonal and should have been documented in another way. I will check where does it come from and fix****
We run 9 agents across providers (OpenAI, Anthropic, Google and lower grade ones such as Moonshot, Qwen and Mistral) with per-agent model assignment in a single config file. Each agent gets its own model, behavioral constraints, and tool permissions.
The practical reason this matters: we've switched individual agents between providers 6+ times in the last month. Anthropic credits ran out, so ether moved to Gemini. Gemini rate-limited us, so klaus, mecha, and jean-clawde moved to Moonshot. sally moved to GPT-5.2 for better tool use. None of these changes required touching the other agents.
A single model for all subagents can break down fast in production. Different tasks need different cost/quality tradeoffs, and provider availability changes constantly. Per-agent config is not a nice-to-have, it is the first thing you need when running more than 2 agents.
Also I wonder, do senseless, hallucinatory feedback loops trigger easier when models are the same? It is not a big surprise that three Kimi K2.5 Openclaw Bots have managed this, but I've seen it happen also betweem Codex with 5.3 Codex and Openclaw with Codex 5.3. It sounded more intelligent than the Kimi loop but it was equally worthless, the Frontier Codexes just figured out a smarter way to ping pong rapid fire technical ACK hallucinatory nonsense.
@eternalrights that looks good. Does it work with codex/cc?
i really like this idea and i believe codex and cc need to lean in this direction as well.
it reminds me of the new eve by vercel. basically both are covering my main pain points listed 4m ago in this thread:
https://github.com/openai/codex/issues/11701#issuecomment-3944145609
p.s. seems post to what i replied to was deleted.
but i'd still raise the discussion of the bad DX with agent definition and lifecycle we have in codex right now.
Sorry, accidentally nuked my earlier comment.
To answer your question — agenthatch compiles SKILL.md into standalone Python agents. It's not tied to any specific platform, so it works alongside Codex, CC, whatever you're using. Each compiled agent is its own pip-installable package with scoped permissions.
One thing I should add: I'd actually love to see this embedded into tools like Codex and CC. Imagine Codex spawning a compiled skill agent as a subagent — it gets its own process, its own tool permissions, no prompt bloat. The orchestrator doesn't need to carry 20 SKILL.md files in context. I think that's a direction that benefits the whole ecosystem, not just one project.
https://github.com/agenthatch/agenthatch