Original URL: https://getagenttools.com/blog/codex-subagents/

# Codex subagents: v1, v2 and the flag that did not turn them off

31 Oct 2026Marek.

- codex
- coding-agents
- agent-ops

Yes. Codex CLI runs subagents. On 0.163.0 they are on by default. You ask for them in the prompt. Codex spawns the agents, waits for them and folds their results into one answer. A custom subagent is a TOML file in `~/.codex/agents/` or `.codex/agents/`. Global limits sit under `[agents]` in `config.toml`.

 

```toml
# .codex/agents/reviewer.toml
name = "reviewer"
description = "PR reviewer focused on correctness and missing tests."
model_reasoning_effort = "medium"
developer_instructions = """
Review like an owner. Do not edit files.
"""
```

  

- **On by default.** `codex features list` on 0.163.0 shows `multi_agent` as stable and true.
- **v2 is already running.** `multi_agent_v2` says false. My test session used v2 tools anyway.
- **One file per agent.** Three keys are required. Sandbox and approvals always come from the parent.
- **Limits.** The docs leave the default to Codex. The source has the numbers.
- **Off switch.** `agents.enabled = false` works. `--disable multi_agent` did not stop a spawn in my test.

 

How the same idea works on the Anthropic side, with my two agent files, is in [Claude Code subagents](https://getagenttools.com/blog/claude-code-subagents/). DeepSeek Harness goes the other way and lists Codex as one of its subagent backends, see my [DeepSeek Harness](https://getagenttools.com/blog/deepseek-harness/) post.

 

## Does Codex CLI have subagents?

 

Yes. The [subagents page](https://learn.chatgpt.com/docs/agent-configuration/subagents) says "Current Codex releases enable subagent workflows by default." Local Codex spawns agents "after a direct request or applicable project or skill instruction." It does not delegate on its own. You write "spawn one agent per point" or put the rule in `AGENTS.md`.

 

In the TUI, `/subagents` switches between agent threads while they run. Do not confuse it with `codex agents`. On 0.163.0 that command browses "all agent sessions on the shared local app-server daemon". It does not spawn anything.

 

## How do I use Codex subagents? My test

 

I use Codex every day as a worker next to Claude Code. For this post I ran four small tests with one prompt. The main one ran on 25 October 2026 at 03:48 CET, in a fresh temp folder with three text files:

 

```bash
codex exec -s read-only --skip-git-repo-check --json \
  "Spawn exactly one subagent. Its task: count the files in the current directory and return the count. Do not count them yourself. Wait for the subagent, then reply with one line: the count and the subagent's id or name."
```

 

The answer was 3. The turn took 11.8 seconds. The parent called `spawn_agent` in a tool namespace called `collaboration`, with the task name `count_files`. The child got the path `/root/count_files` and its own session file. It ran its own shell command. Then it sent back one message with the payload `3`. It ran on the parent's model.

 

Two things surprised me. The `--json` stream showed only a `wait` item. The spawn call was visible only in the session file. A first run with `--ephemeral` logged `collab spawn failed` with "no rollout found for thread id". Its final line still named a subagent. I would not script subagents with `--ephemeral` until that is explained. More on scripting Codex is in [codex exec](https://getagenttools.com/blog/codex-exec/).

 

## What is Codex subagents v2?

 

v2 is a second multi-agent runtime. The OpenAI docs do not mention it. The `rust-v0.163.0` source describes the flag as "Enable task-path-based multi-agent routing." That matches my test. Agents get paths like `/root/count_files`.

 

| Runtime | Tools in the 0.163.0 source |
| --- | --- |
| v1 | `spawn_agent`, `send_input`, `resume_agent`, `wait_agent`, `close_agent` |
| v2 | `spawn_agent`, `send_message`, `followup_task`, `wait_agent`, `list_agents`, `interrupt_agent` |

 

So why did I get v2 with the flag at false? The source picks the runtime in a fixed order. `multi_agent_v2` on forces v2. `agents.enabled = false` turns everything off. Otherwise the model's catalog entry decides. Only then does the `multi_agent` flag pick v1. The model catalog cached on my machine lists `gpt-6.1-sol` and most other current models as v2. The flag only matters for a model with no preference.

 

Two related flags are "under development" on 0.163.0. `multi_agent_v2_dynamic_tools` passes client-defined tools to fresh v2 subagents. `subagent_default_context_limits` gives each subagent its own model's context window. `multi_agent_mode` is removed and kept as a no-op.

 

## How do I configure Codex subagents in config.toml?

 

Global settings go in `[agents]`. The [config reference](https://learn.chatgpt.com/docs/config-file/config-reference) lists `enabled`, `max_concurrent_threads_per_session`, `default_subagent_model`, `default_subagent_reasoning_effort` and `interrupt_message`. `max_threads` still works as a legacy alias.

 

```toml
[agents]
max_concurrent_threads_per_session = 4
default_subagent_reasoning_effort = "medium"
```

 

Each agent file must set `name`, `description` and `developer_instructions`. The `name` field counts, not the filename. A custom agent named `explorer` replaces the built-in one.

 

What a file cannot do matters more. Per the docs, `sandbox_mode`, `approval_policy`, `model_provider` and `mcp_servers` in an agent file do not override the parent. Instructions can say "do not edit". They do not create a read-only sandbox. A file can switch capabilities off, for example `features.shell_tool = false`. Subagents inherit [Codex skills](https://getagenttools.com/blog/codex-skills/) from the parent. `skills.config` disables single ones.

 

## Which model does a Codex subagent use?

 

The parent's, unless you set one. A `model` in the agent file wins. Before the file applies, Codex takes an explicit spawn value, then the `[agents]` default, then the parent. If a model is picked without an effort, that model's default effort applies. My test agent ran on `gpt-6.1-sol`, the parent's model.

 

## What is the Codex subagents limit?

 

The docs only say that when the key is unset, "Codex chooses the default." The 0.163.0 source has the numbers. I read them in code, not in a run:

 

- **v1.** Six open spawned threads by default. Nesting depth 1, set by `agents.max_depth`. The docs do not list that key.
- **v2.** A separate key, `max_concurrent_threads_per_session` under `[features.multi_agent_v2]`, default 4. That count includes the root, so three subagents. Set only the `[agents]` key and Codex adds one to it. `max_depth` is "Ignored by V2."

 

## Codex subagents vs Claude subagents

 

|  | Codex CLI 0.163.0 | Claude Code |
| --- | --- | --- |
| Agent file | TOML, `.codex/agents/` | Markdown with YAML, `.claude/agents/` |
| Required fields | `name`, `description`, `developer_instructions` | `name`, `description` |
| Delegation | When you or `AGENTS.md` ask | Also automatic, by `description` |
| Sandbox and approvals | Always the parent's | `permissionMode` per agent |
| Default limits | 3 concurrent on v2, from source | 20 concurrent, 3 layers deep, from docs |

 

The [Claude Code docs](https://code.claude.com/docs/en/sub-agents) say "Claude uses each subagent's description to decide when to delegate tasks." In Codex the spawn still waits for a request. Copilot CLI picks a custom agent by its description too, see [Copilot CLI subagents](https://getagenttools.com/blog/copilot-cli-subagents/).

 

## How do I turn Codex subagents off?

 

Set `agents.enabled = false`. At 03:49 CET I tested two switches with the same prompt.

 

With `--disable multi_agent` the run spawned `/root/count_files` anyway. It answered 4, the right count. The model's v2 entry won over the flag, as the source order says.

 

With `-c agents.enabled=false` there was no spawn tool. The model tried to start a second `codex exec` from the shell instead. The read-only sandbox blocked it with "Operation not permitted". So a model without subagents may still try a workaround. Here the sandbox stopped it. My [Codex sandbox flags post](https://getagenttools.com/blog/codex-dangerously-skip-permissions/) covers the options.

 

## Frequently asked questions

 

### Can a Codex subagent have its own sandbox?

 

No. Subagents "inherit the parent turn's current sandbox and approval settings, including changes made with `/permissions` or `--yolo`," per the docs. A Gemini CLI agent file narrows its tools instead, see [Gemini CLI subagents](https://getagenttools.com/blog/gemini-cli-subagents/).

 

### Does --enable multi\_agent\_v2 change anything?

 

Per the source, it forces v2 for every model. My main model already ran v2 without it. I did not run that flag.

 

## Verdict

 

Codex subagents work with almost no setup. Ask in the prompt and you get them. Before relying on them I would check two things. The runtime: the flag list says v1, my model ran v2. The off switch: the flag named after the feature did not stop it. `agents.enabled = false` did.

 

Sources, read on 25 October 2026: the Codex [subagents page](https://learn.chatgpt.com/docs/agent-configuration/subagents) and [config reference](https://learn.chatgpt.com/docs/config-file/config-reference), Claude Code's [subagents page](https://code.claude.com/docs/en/sub-agents), local `codex features list` and `--help` on `codex-cli 0.163.0`. Code from [openai/codex](https://github.com/openai/codex) at tag `rust-v0.163.0`. The test runs are my own.

Put this into practice

[See the tool list](https://getagenttools.com/tools/)[Train your team](https://getagenttools.com/#training)
