Codex reproduces the same move in OpenAI's terminology, and the difference here is more one of vocabulary than of substance: instead of an orchestrator there is a manager that hands out work, and control passes not only through a tool call but through a handoff - a full transfer of the lead to another agent. The behavior rules live in an AGENTS.md file: the global instance sits in ~/.codex/, and a project one at the repository root extends and, where needed, overrides it. Subagents are described not in markdown but in TOML files inside .codex/agents/ - each with a name, a description and developer instructions. The model behind the environment is GPT-5.6; OpenAI, like Anthropic, does not disclose the architecture.
The difference from Claude Code is not in the fact of delegation itself but in two specific emphases. The first is an explicit handoff as a distinct mechanism: a manager can not merely call a subagent as a tool and get a reply, but hand the lead over to it entirely, like passing a baton, and that subagent then becomes the current worker until the next transfer. The second emphasis is code-first assembly: the result of a subagent's work still comes back up as one consolidated response rather than a stream of intermediate messages, which makes it easier to embed Codex into larger pipelines assembled from code.
A separate practical detail is how Codex is wired in from the outside. Integration runs over MCP: either through the app server or through the Claude Code plugin, and in both cases Codex acts as a provider of capabilities for someone else's orchestration, not only as its own CLI shell. When the system is assembled from code rather than from config, this is joined by a pairing with the Agents SDK, in the same way a subagent's TOML description turns into a callable node in a graph.
The official materials in this section cover both sides: OpenAI's practical guide to building agents is the general theory of the pattern, while the docs on orchestration and handoffs, on Codex subagents, and on AGENTS.md are the applied side specific to this CLI. The Codex repository on GitHub is worth keeping close at hand separately, because that is where the details of a given version change fastest.
The meta-prompt for this environment is built the same way as for Claude Code, but it speaks the manager's language: the agent reads the listed OpenAI materials, then creates or updates AGENTS.md with global rules and project-level overrides, explicitly fixes when to delegate through a tool and when to hand the lead over through a handoff, and sets up a consolidated response instead of a streaming dump. Codex subagents are set up as TOML files in .codex/agents/, with an explicit wait for all of them to finish before the manager assembles a single reply.
Here too the plan is shown before anything is written into the project - the same principle as with Claude Code, just anchored in different files and with a different name for the lead role.
Read:
- cdn.openai.com/business-guides-and-resources/
a-practical-guide-to-building-agents.pdf
- developers.openai.com/api/docs/guides/agents/orchestration
- learn.chatgpt.com/docs/agent-configuration/subagents
Set up THIS project for "manager + subagents/handoffs":
1. Create/update AGENTS.md: global rules + per-project
overrides; manager role; when to delegate, when to hand off;
a consolidated response instead of a dump.
2. Codex subagents - TOML in .codex/agents/ (name, description,
developer_instructions): spawn, await all, single reply.
3. Code-first: Codex + Agents SDK (Codex as MCP, state).
4. Balance quality vs token economy: narrow context,
consolidated responses, no extra passes.
Plan first, then edits.