All posts

AI Agents and Subagents in Codex – How the Interplay Works

AI Pascal Zumstein · August 24, 2026 · 11 min read

In an earlier article, I gave an overview of the major AI agent systems – OpenAI, Anthropic, Google and Microsoft and their respective approaches. One of these agents deserves a closer look, because it shows where the technology is heading: Codex, OpenAI's coding agent. For some time now, Codex has been able to do something that goes beyond a single agent: it can delegate tasks to its own subagents, which work in parallel and independently of one another.

At first this sounds like a detail for developers. But behind it lies a principle that matters for understanding modern AI systems in general – and one that will show up in more and more tools over the coming months. This article explains, in plain language, what agents and subagents are in Codex, how the interplay works, and what businesses can take away for their own use of AI.

A quick recap: what an AI agent is

A classic AI chatbot answers a question and then waits for the next one. An AI agent goes further: it receives a goal, breaks it down into sub-steps on its own, decides which tools it needs, and works through the task independently. Codex is such an agent, specialized in software development. You give it a task – for example, "find the bug that causes the crash and fix it" – and Codex reads the program code, locates the cause, writes a fix, tests it, and delivers the result.

As long as a task is manageable, this works well with a single agent. But many real-world tasks are large and consist of many parts that actually have nothing to do with each other. This is exactly where subagents come in.

What subagents are

A subagent is another independent Codex agent that the main agent starts for a specific subtask. You can picture it like a project lead who receives a large assignment and distributes it among several specialists: each gets a clearly defined task, works on their own, and in the end the project lead brings the results together.

OpenAI officially released this capability in 2026. The idea behind it is that the main agent no longer has to handle everything sequentially and in a single train of thought, but can offload work deliberately. Codex ships with three predefined agent types for this:

Alongside these standard types, teams can also define their own subagents – for example a specialized "reviewer" for security questions, or an agent that does nothing but research documentation. These custom agents are described in small configuration files that specify when the agent should be used, which model it runs on, and what instructions it works with.

How the delegation works

The key point is: Codex does not spin up subagents at random, but only when you explicitly ask it to. The sequence is always the same. The main agent takes in the overarching goal, breaks it into subtasks, and hands each subtask to a suitable subagent. These subagents then work at the same time. The main agent waits until all of them have delivered their results, merges them into a coherent overall answer, and presents it.

A vivid example: you ask Codex to review a planned code change against six criteria – security, code quality, potential bugs, timing issues in concurrent processes, test stability and maintainability. Instead of working through these six checks one after another, Codex can start six subagents, each handling exactly one point. In the end you receive a consolidated report – considerably faster than if a single agent had gone through the points in sequence.

The core in one sentence: A subagent is not a new program, but another instance of the same agent, started for a bounded subtask – with its own assignment, its own workspace and, once it is done, a result that the main agent collects.

Why this is more than just "faster"

The obvious benefit is speed: six checks at once are faster than six in a row. But the genuinely interesting benefit lies elsewhere – in what is called context.

Every AI agent has a limited "working memory," known as the context window. Everything the agent is currently handling – the task, the code it has read, intermediate results, earlier instructions – takes up space in this memory. If it gets too full, the agent loses the thread, overlooks details, or mixes up things that don't belong together. Experts speak of "context rot" – the result gets worse as the memory becomes overloaded.

Subagents solve this problem elegantly. Each subagent has its own clean working memory, filled only with its specific subtask. The explorer agent, for instance, searches through a huge body of code and returns only a compact summary to the main agent – not the entire content it read. This keeps the main agent's working memory clear and focused, even when the overall task is very large. The result is not only faster, but often also more thorough and more reliable.

Staying in control: steering, limits and security

A fair objection is: if an agent independently starts more agents that work in parallel – do you still keep the overview? Codex is designed precisely so that control stays with the human.

For one thing, you can view at any time which subagents are currently running, steer individual ones with new instructions, or close out completed agents. For another, there are hard built-in limits. By default, at most six agents may work at the same time, and a subagent is normally not allowed to start subagents of its own. This prevents the number of agents from multiplying out of control.

The security rules also stay consistent: every subagent inherits the permissions and restrictions of the main session. If the main agent only has limited access, that automatically applies to all of its subagents as well. And actions that require explicit approval – such as deleting files or publishing changes – can still be tied to human confirmation.

Worth knowing: Subagents are not "free." Because each subagent thinks and uses tools on its own, a run with several subagents consumes more computing power – and therefore more cost – than a single agent. The time saved is bought with higher resource usage. For large, cleanly divisible tasks this pays off; for small tasks, a single agent is more efficient.

Where the principle fits particularly well

Subagents show their strength whenever a task is large and can be cleanly broken into independent parts. Typical examples from practice are extensive reviews against multiple criteria, searching and summarizing large code bases, adjusting many files at once during a migration, or recurring checks applied to many individual elements – such as "review these forty files against the same pattern."

The approach is less suitable when a task is tightly interconnected or requires continuous, deliberative judgment – such as fundamental decisions about how a system should be built. Questions like these cannot sensibly be split into independent chunks, and here the human – or a single, focused agent – remains the better choice.

What businesses can take away from this

Even though Codex is a tool for software development, subagents embody a pattern that is relevant to AI use across the entire company. The insight is this: large tasks are not mastered by asking a single AI to take on ever more at once, but by breaking them into clearly defined subtasks and distributing them deliberately. This very principle – divide, delegate, consolidate – is increasingly found in the agent platforms of all the major providers, not just OpenAI.

Three practical takeaways follow for businesses. First: anyone who wants to use AI productively should learn to structure tasks well – a clearly formulated, divisible task delivers better results than a vague all-in-one assignment. Second: more autonomy does not mean less control, as long as the tools – like Codex – build in limits, visibility and approvals from the start. Third: costs depend directly on how intensively you use such multi-agent workflows. Here too, a clearly scoped pilot project is the best way to assess the real benefit and the real cost before rolling out broadly.

The trend clearly points toward systems that plan, delegate and work as a team on their own. You don't have to program these tools yourself to benefit from them. But it is worth understanding the underlying principle – because it will shape how we work with AI in the years ahead.

Using AI agents sensibly in your business?

I help SMEs realistically assess AI tools, find the right starting point, and integrate agent-based workflows pragmatically into existing processes.

Book a free initial consultation