← All research

· AI Agents · Codex · Benchmarks

I cut median API calls in Codex by 62%

Andrey Chmerev
A Codex terminal follows two tool steps. Median API calls fall from 10.5 to 4 per task.

On 30 multi-step VAKRA tasks, my Codex setup went from a median of 10.5 API calls per task to 4. Both versions ran GPT-6.2 Sol High. The baseline got 16 answers right and the modified version got 17. Median runtime stayed close to 28 seconds.

What I took from IBM

IBM Research reported that CUGA, its agent, went from 19% on an initial sample of multi-step tasks to 52.8% on its final VAKRA test. The team kept GPT-OSS-120B and changed the code around it. That code decides which tools the model sees, how it runs them, and how it assembles the answer. IBM calls this harness engineering. IBM Research’s CUGA report

I used Codex to build and run a test of three ideas from that report in Codex CLI. I kept Sol High fixed across both sides of each comparison. The experiment ran Codex against IBM’s benchmark APIs. IBM’s CUGA runtime was outside the measured comparison.

Three changes in the Codex experiment: shortlist tools, read each result, and validate JSON.

  1. Shortlist tools. Before each question, I ranked the domain’s APIs against the question using BAAI/bge-small-en-v1.5. The main variant exposed up to 128 tools. A separate experiment tried 32. Ranking used the tool names, summaries and parameter descriptions.
  2. Read the result before the next dependent call. The added prompt asked Codex to make at most one API call per tool-execution step, read the response, and take the fields it needed into the next call. The exact instruction is included in the download.
  3. Validate the final format. Both sides received the same request for a JSON object with one answer string. The modified side also used Codex CLI’s --output-schema flag.

The 30-task comparison

Metric Baseline All three changes
Correct final answers 16/30 (53.3%) 17/30 (56.7%)
Correct answer with a matching reference result trace 11/30 11/30
API calls per task, median 10.5 4
API calls, total 1,310 211
Wall-clock time per task, median 27.2 s 28.0 s
Runs with parallel calls 24/30 0/30
Timeouts at 165 seconds 1 2

Two tasks switched from wrong to right and one went the other way. The estimated accuracy change was +3.3 percentage points, with an approximate paired-bootstrap 95% interval from −6.7 to +13.3 points. One run per task and condition leaves substantial uncertainty about the accuracy effect.

One task asked for a count based on a country’s type of government and a border-length threshold. The baseline called APIs 228 times in 92.7 seconds and returned 72. The modified run looked up the government type, passed republic into the count endpoint and returned the reference answer of 56 in 15.4 seconds. It made two calls. Shortlisting alone also solved that task in two calls. Per-run measurements

Strict sequencing also had a cost. On a university question, the baseline returned the reference value after 241 calls, although its trace fell short of the reference check. The modified run made 29 calls and hit the time limit. Across 28 pairs with token counters on both sides, median total input tokens rose from 193,073 to 204,022, while median uncached input tokens fell from 35,217 to 32,450. The CLI counts inputs across successive model requests. Billing and subscription usage would require separate measurements.

I tested the switches separately

Change by itself Correct answers, baseline → variant What changed
One call at a time 6/12 → 7/12 Median calls fell from 7 to 2.5. Median time rose from 22.6 to 27.7 s.
JSON schema 6/12 → 6/12 Both returned valid JSON on all 12 tasks.
Shortlist to 128 tools 4/10 → 5/10 Median time fell from 41.5 to 29.7 s on domains with more than 128 tools.
Shortlist to 32 tools 4/10 → 7/10 Median time fell to 19.8 s on those same tasks. One correct run still made 580 calls.

In the main experiment, 20 of the 30 tasks already had 128 tools or fewer. That cap only changed what Codex saw on 10 tasks.

The 32-tool shortlist on new questions

On 12 additional questions, median wall-clock time fell from 19.2 seconds with the full catalog to 17.0 seconds with a 32-tool shortlist.

Median CLI runtime on 12 additional VAKRA questions.

I tried the 32-tool cutoff on 12 additional questions from domains with 155 to 283 APIs. The baseline got 6 right and the shortlist got 7. The extra correct answer came on a question where the baseline timed out. The count of correct answers with a matching reference result trace fell from 6 to 5. The shortlist kept every reference tool on 9 of the 12 questions.

Median time fell from 19.2 to 17.0 seconds and median calls fell from 5 to 3.5. On the 10 pairs with token counters on both sides, median input dropped from 175,459 to 103,615 tokens, a 41% reduction. Uncached input fell from 14,847 to 10,444 tokens, about 30%. I ranked the tools before starting the timed CLI runs, so these timings exclude the ranking step. Additional runs

What I put into my daily Codex setup

I added a short rule to my global AGENTS.md and a tool-workflows skill. In a chain, Codex should read the first result and carry only the fields needed for the next call. Independent work can still run in parallel. With a large catalog, I’d start with a shortlist and expand it when a needed operation appears to be missing. I tested fixed caps here. That fallback remains a separate experiment.

The local rule and skill are lighter than the configuration in the A/B test. They guide Codex’s choices. The benchmark applied filtering and schema validation explicitly in its runner. I verified that a fresh local Codex session loaded the skill and used an ID from one tool response in the next call on a small fixture. The 62% figure comes from the 30-task A/B test.

How to reproduce it

I ran 128 CLI attempts across 42 distinct questions on December 2, 2026. All were from the public VAKRA training split for multi-hop reasoning (Capability 3), and each selected question had at least two reference tool calls and a short expected answer. The first 30 spanned nine domains. The final 12 were disjoint from that set. I verified that the reference calls returned supporting values from the benchmark servers before running the comparisons. VAKRA dataset · VAKRA code at the tested revision

I ran the local REST handlers, SQLite data, MCP adapter and embedding model on an Apple M4 Max Mac with 48 GB of unified memory. Codex CLI 0.171.0-alpha.13.2 used hosted gpt-6.2-sol with high reasoning effort and the standard service tier. Each run started fresh, exposed read-only tools for a single domain, disabled web search, and allowed 165 seconds. The wall-clock measurement includes CLI startup. Model inference ran on the hosted service.

The scorer compared each normalized final answer with IBM’s expected value, with a small rounding tolerance for fractions. Timeouts counted as failures. The separate trace check looked for each reference tool and its expected result values anywhere in the observed calls. A valid alternate path can miss that check. The public questions can have appeared in model training, some share templates, and this evaluation used a local deterministic scorer. Those choices limit comparisons with IBM’s published scores. IBM’s evaluation method

Download the reproduction kit for the exact prompts and schema, the benchmark scripts, per-run metrics, and the task IDs for both sets. Read the run instructions.