Why Do 71.3% of Tool-Invoking Codex exec Calls Run Just One Tool?
Of 35,641 Codex exec invocations in our logs, 67.5% called exactly one tool. Among invocations that called at least one tool, the share was 71.3%.
Tool use also varied within the same harness. In Antigravity, single-tool turns accounted for 92.3% of Claude Opus 5.5 turns and 50.1% of Gemini 4 Neon (xhigh) turns, with native tool calling in both cases.
Code Mode lets a model write a short program to orchestrate multiple tool calls in one step. In our Codex logs, JavaScript Code Mode was enabled in 99.4% of Codex sessions. Claude Code offers an experimental Code Mode starting with v2.1.323. It is off by default and requires an interactive terminal session to opt in with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1.
Methods
I analyzed logs from 1,364 local sessions. The three harnesses contributed 35,641 JavaScript exec invocations in Codex, 66,685 tool-calling turns in Claude Code, and 4,992 substantive turns in Antigravity after excluding UI progress updates. These counts sum to 107,318 observations across the three harnesses.
For Codex, I count tool invocations inside each exec. Metadata-only tool discovery counts as zero internal tool calls and is excluded from the 71.3% calculation. Throughout the post, μ is the mean number of internal tool calls per exec in Codex, or tool calls per counted turn in the other harnesses. Claude Code’s main-session and subagent results are identified where reported.
1. What Is Code Mode?
With native tool calling, the model asks the harness to run tools directly and uses the results to decide what to do next. Harnesses with native parallel tool calling can run independent calls in the same turn.
Code Mode replaces individual tool schemas with a programmatic execution surface. The harness exposes primitives such as exec_command and apply_patch as JavaScript functions behind a single unified entry point (custom_tool_call: exec in Codex). In principle, the model can write one JS snippet to batch parallel reads, chain conditional branches, loop over files, and filter verbose outputs before anything returns to the context window:
// Intended Code Mode usage: batching, branching, and output filtering in one turn
const results = await Promise.allSettled([
tools.exec_command({ cmd: "git status --short" }),
tools.exec_command({ cmd: "pytest -q" }),
]);
if (results[1].value?.exit_code !== 0) {
// Inspect or slice failure output before returning to context
}
The design goal is to reduce model round trips and return smaller tool outputs to the context window.
2. How Codex Uses Code Mode in Practice
Figure 1. Each bar groups two or more tool calls together. The approximate 27.1% for Codex is the remainder after the displayed zero- and one-tool shares.
Looking inside Codex's 35,641 JavaScript exec invocations:
- Tool count. Of all
execinvocations, 67.5% called exactly one tool and 5.4% only looked up tool metadata viaALL_TOOLS. The overall mean was 1.37 tools perexec. Only 0.1% contained six or more statically counted tool calls (maximum 8 statically and 20 at runtime). - Control flow is rarely used: Only 6.0% of exec calls contain a loop that actually drives tool invocations (if branches appear in 6.9%). Another 25.0% contain loops solely to print or format Promise.allSettled results.
- One-line wrappers: The median non-empty JS length for a single-tool exec is 1 line, and 55.2% of all exec calls have no loops, no branches, and no concurrency primitives—functionally identical to wrapping a single traditional tool call in JS syntax.
- Comparison with native harnesses: Claude Code runs 80.1% single-tool turns (80.9% in main sessions, 76.9% in subagents; μ = 1.38), while Antigravity—using native parallel tool calling with no JS wrapper—averages μ = 1.63 substantive tools per turn (68.7% single-tool).
One plausible explanation is that many debugging steps depend on earlier tool results. An error message, exit code, or file read can determine what to inspect next, which limits how much of that work can be planned in advance.
3. Tool Use Varies Across Models in the Same Harness
The logs let us compare models within each harness. These are observational comparisons, and the results may also reflect differences in tasks and reasoning settings.
Figure 2. Antigravity percentages are per substantive turn. Codex percentages are per exec invocation and include metadata-only invocations in the denominator. The figure shows the zero-tool share explicitly for GPT-6.2-astra.
Inside Antigravity (same native harness, no Code Mode):
- Claude Opus 5.5 had 92.3% single-tool turns (μ = 1.09), while Claude Code recorded 88.1% for Opus 5.5 and 91.3% for Opus 5.
- Gemini 4 Hydrogen (xhigh) had 64.7% single-tool turns (μ = 1.76).
- Gemini 4 Neon (xhigh) had 50.1% single-tool turns and averaged 2.04 tool calls per Antigravity turn.
Inside Codex (same JS Code Mode harness across generations):
- GPT-5.6-sol uses
execas a single-tool wrapper 99.6% of the time (μ = 1.00). - GPT-6.2-astra had 72.1% single-tool invocations (14.3% 2–5 tools, plus 13.6% zero-tool dynamic tool discovery; μ = 1.11).
- GPT-6.2-sol had 63.5% single-tool invocations, batching 2–5 read-only commands via
Promise.allSettledin 33.8% of calls (μ = 1.50).
The number of calls grouped within a turn varied across models in both harnesses. Assessing how much of that work ran concurrently would require timing data.
4. What Shell and Python Already Do Inside One Call
A shell tool call can chain several commands, run a multiline script, or process data with inline Python before returning. A turn counted as one tool call can therefore contain several operations.
Figure 3. Each row uses its corresponding shell-call sample. A call can count toward both categories.
Across all three harnesses, the overwhelming majority of shell tool calls (92.3% in Claude Code Bash, 79.0% in single-tool Codex exec_command, 72.9% in Antigravity run_command) already chain commands or run multiline scripts—and ~29%–33% embed inline Python scripts directly.
In these local sessions, the shell already handled some of the batching and data processing that a separate JavaScript program could express. Adding an outer JavaScript layer for the same shell work introduces another layer of quoting and escaping.
5. When Code Mode Can Help
The potential benefit depends on which tools are available and how intermediate results can be passed between operations.
| Setting | Representative Scenarios | How Code Mode Fits |
|---|---|---|
| Local exploratory coding | Debugging failing builds, iterative test runs, 2–5 read-only file lookups, single patches | Many steps depend on the previous result. Independent reads can use native parallel calls, and the shell can handle local data processing. |
| Cross-tool processing and large batches | 1. Shell-less MCP / SaaS APIs (joining/filtering 50KB JSON payloads) 2. Large tool catalogs (Codex's 5.4% dynamic tool lookup) 3. Deterministic fan-out / Map-Reduce across dozens of modules |
A program can keep intermediate objects in memory, filter them before returning data to the model, and use explicit loops to repeat independent operations. |
The Claude Code documentation describes similar use cases, including repeated edits across files, searches with results that need filtering, and independent commands that can run together.
6. Co-Design Notes for Next-Generation Models and Harnesses
The logs suggest three directions for the next round of harness experiments:
- Native tool calls and on-demand Code Mode. Evaluate where native calls work well for exploration and where a stateful sandbox helps with cross-API aggregation or batch pipelines.
- Pass-by-reference for large outputs. Test whether persisting large stdout or JSON outputs and returning a reference, schema summary, and preview lets later tools consume the data with less context overhead.
- Task-level evaluation. Compare native tool calling and Code Mode on the same tasks with the same model. Measure task completion, end-to-end latency, and model round trips for both independent batches and steps that depend on a previous tool result.
Up Next
We are preparing to open-source a new multimodal Agent model co-designed around native parallelism, on-demand code sandboxes, and pass-by-reference context handling. In the next post, we will break down the underlying Chat Template design choices—including why inline system messages, preserving historical <think> traces, and deterministic argument key ordering are critical for avoiding Prefix KV Cache thrashing in long sessions, along with ordering pitfalls when multimodal tools return images.


