The Official Codex Subagents Documentation — Architecture, Patterns, and CSV Batch Processing

The Official Codex Subagents Documentation
OpenAI’s official subagents documentation page has matured into a comprehensive reference for multi-agent Codex workflows. This article captures the key patterns and configuration details as of May 2026.
Architecture
Codex spawns subagents only on explicit request — there is no automatic decomposition. The system manages:
- Spawning new agents with specific roles
- Routing follow-up instructions to the correct thread
- Waiting for all results before consolidating a response
- Closing agent threads on completion
Built-in Agent Types
Three agents ship by default:
| Agent | Purpose |
|---|---|
default |
General-purpose fallback |
worker |
Execution-focused — implementation and fixes |
explorer |
Read-heavy codebase exploration |
Custom Agent Configuration
Custom agents are TOML files in ~/.codex/agents/ (personal) or .codex/agents/ (project-scoped).
Required fields:
name— agent identifierdescription— when Codex should deploy this agentdeveloper_instructions— core behavioural guidelines
Optional fields (inherit from parent if omitted):
model,model_reasoning_effortsandbox_mode(e.g."read-only"for explorers)mcp_serversskills.confignickname_candidates— readable labels for multiple instances
Global Orchestration Settings
The [agents] section in config.toml controls:
| Setting | Default | Purpose |
|---|---|---|
max_threads |
6 | Maximum concurrent open threads |
max_depth |
1 | Nesting depth for spawned agents |
job_max_runtime_seconds |
— | Timeout per worker for CSV jobs |
Important: Raising max_depth beyond 1 multiplies resource costs through recursive delegation. Most workflows should stay at depth 1.
Sandbox and Approval Inheritance
Subagents inherit the parent session’s sandbox policy. During interactive sessions:
- Approval requests from inactive threads surface with source labels
- Users press
oto inspect the thread before approving - Live runtime overrides (e.g.
/approvalschanges) propagate to child agents - Individual agents can override sandbox (e.g.
sandbox_mode = "read-only")
CSV Batch Processing (Experimental)
The spawn_agents_on_csv tool automates repetitive work across data rows:
spawn_agents_on_csv(
csv_path="tasks.csv",
instruction="Review {file_path} for security issues and report findings",
id_column="task_id",
output_schema={"severity": "string", "findings": "string"},
output_csv_path="results.csv",
max_concurrency=4,
max_runtime_seconds=300
)
Workers call report_agent_job_result to submit results. The system collects all results into a combined CSV with metadata.
Documented Use-Case Patterns
PR Review (Three-Agent Split)
pr_explorer(read-only) — maps codebase, gathers evidencereviewer— checks correctness, security, test coveragedocs_researcher— validates framework APIs via MCP server
Frontend Debugging
code_mapper(read-only) — locates relevant code pathsbrowser_debugger— reproduces issues, captures evidenceui_fixer— implements targeted fixes
Thread Management
- CLI:
/agentto switch threads, inspect ongoing work - Codex App and CLI: full activity visibility
- IDE Extension: coming soon
- Direct steering: ask Codex to control, stop, or close running subagents
Token Implications
Each subagent performs independent model and tool work. Token consumption scales linearly with agent count. The docs explicitly note this as a cost consideration.
What This Means for Agentic Pod Architecture
The official docs now validate several patterns from Daniel’s agentic pod research:
- Role specialisation — read-only explorers, execution workers, domain experts
- Shallow orchestration — depth 1 is the recommended default
- Project-scoped agents —
.codex/agents/enables per-repo agent teams - CSV fan-out — batch processing pattern for audit/migration workflows
The missing pieces remain: cross-session state sharing, agent-to-agent direct communication, and durable task queues. These gaps are where tools like oh-my-codex, Symphony, and the agent graph store (PR #20689) fill in.