Codex Runs Tool Calls One by One? Batch Them Safely

Codex Runs Tool Calls One by One? Batch Them Safely

Aident AI

An amber serial signal opens into parallel cyan lanes and reconverges into one verified output on a dark navy field.

Codex Runs Tool Calls One by One? Batch Them Safely

If Codex is reading files, searching code, or inspecting APIs one call at a time even when the calls are independent, make the dependency boundary explicit. Ask it to group independent read-only operations into one native parallel batch, wait for every result, and keep dependent work, approvals, and writes sequential.

Use this instruction:

Before calling tools, map the dependencies. Group independent read-only
operations into one parallel batch using the runtime's supported native
parallel mechanism. Keep a call sequential when its input depends on an
earlier result. Keep approvals, waits, and writes sequential. Inspect every
result before continuing, and do not replace native tool calls with shell
background jobs or an ad hoc script

That is a scheduling instruction, not a promise of lower usage. A July 2026 community report measured 27% to 45% lower weighted usage in two controlled tasks after adding a batching instruction, but one prompt variant used 26.8% more. Treat those numbers as a reason to test your own workflow, not as an OpenAI benchmark or guaranteed quota workaround.

When Parallel Tool Calls Are Actually Safe

Two operations are independent when neither needs the other's result and neither changes state that the other reads.

Good batch candidates include:

  • reading three known files;

  • searching three unrelated terms;

  • listing issues, pull requests, and releases for the same repository;

  • inspecting several read-only integration schemas;

  • fetching independent documentation pages.

Keep these sequential:

  • discover a file path, then open that path;

  • inspect a schema, then construct an input that must conform to it;

  • request approval, then perform the approved action;

  • update a record, then verify the updated state;

  • start a long-running job, then poll its result;

  • any write whose ordering or rollback behavior matters.

The test is simple: if call B needs any value or side effect from call A, B must wait.

Prerequisites

Use a fresh, bounded task that has several independent reads and a result you can verify. Record:

  • the Codex surface and version;

  • the selected model and reasoning effort;

  • the repository commit and working-tree state;

  • the prompt and permission mode;

  • the expected files, records, or facts in the answer.

Do not benchmark on an active migration, release, deletion, or production write. A read-only task makes incorrect scheduling easier to detect and keeps the comparison reversible.

Step 1: Run a Baseline Without the Instruction

Choose a task with four independent reads. For example:

Read package.json, pnpm-workspace.yaml, AGENTS.md, and README.md.
Return the package manager, workspace layout, local assistant rules, and
primary setup command. Do not edit files

Start a fresh Codex session and run the prompt once. Record:

  • how many tool-call cycles occurred;

  • whether independent reads appeared in the same batch;

  • elapsed time, if the UI exposes it;

  • usage, if the product exposes a comparable usage measure;

  • whether all four requested facts were correct.

Do not infer token savings from elapsed time alone. Network latency, cache state, model load, and response length can all change the duration.

Step 2: Add the Safe Batching Instruction

Start another fresh session with the same model, reasoning effort, permissions, repository commit, and task. Add the instruction from the opening of this guide before the task.

Expected result: Codex identifies the four reads as independent, submits them together through its supported tool path, receives every result, and then produces one answer. It should not invent a shell loop, background processes, or a temporary script just to imitate parallelism.

OpenAI's Codex prompting guidance recommends batching independent reads, list operations, and searches while keeping dependent operations sequential. It also recommends using the runtime's native parallel path instead of routing native tool work through a script.

Step 3: Verify Coverage, Not Just Speed

Compare the second run with the baseline. The batched run is only an improvement if it preserves the result contract.

Check that:

  1. every requested source was read;

  2. no result was silently dropped after one call failed;

  3. the answer distinguishes missing evidence from a negative finding;

  4. no file or external record changed;

  5. the task used fewer call cycles or improved another measured outcome without reducing accuracy.

If the batch returns a partial failure, retry only the failed read when it is safe and independent. Do not rerun successful calls reflexively, especially when an API has cost or rate limits.

Step 4: Make the Rule Durable in AGENTS.md

If the controlled run helps, add a short project-scoped rule to the repository's AGENTS.md:

- Before tool calls, identify dependencies. Batch independent read-only
  operations through the runtime's native parallel mechanism. Keep dependent
  calls, approvals, waits, and writes sequential, and inspect every result

Keep the rule semantic. Internal tool names and implementation details can change, while the dependency boundary stays useful. Do not require a specific Promise.all(...) wrapper, shell operator, or private tool identifier in long-lived project instructions.

If Codex already batches the task correctly, skip the extra rule. More prompt text is not automatically better.

Step 5: Test a Real Multi-Source Search

Aident Loadout exposes a useful bounded test because one search can return independent capability results without asking you to paste provider keys.

First, install or refresh the Aident skill in Codex:

Follow https://aident.ai/SETUP.md

Confirm authentication and connected services:

aident account auth status
aident vault vault --action status

Then run one batch search from a trusted shell:

aident capabilities search \
  --queries '["search GitHub issues","inspect web analytics","search recent videos"]' \
  --types '["action"]'

Expected result: the JSON response reports success: true and includes one resultsByQuery entry for each of the three queries. Search is read-only; do not execute any returned Action until you inspect its current schema and confirm its risk.

Now ask Codex:

Inspect the current input schemas for the first read-only Action returned by
each query. These schema reads are independent, so batch them through the
supported native parallel mechanism. Return the exact Action names and their
required input fields. Do not execute the Actions

Measure success as three schemas inspected, zero integration writes, zero provider secrets pasted, and no missing result hidden by the batch.

Common Failure Modes

What you see

Likely cause

Safe next step

Calls still run one by one

Codex inferred a dependency or ignored a vague request

State which reads are independent and repeat once in a fresh session

A dependent call starts too early

The prompt overgeneralized parallelism

Name the dependency and require that chain to remain sequential

The answer omits one source

One member of the batch failed or was not inspected

Check each result and retry only the failed read

Usage increases

Extra planning or repeated output outweighed saved cycles

Remove the rule for that task and compare with a fresh control

A script or shell jobs emulate batching

The instruction did not preserve the native path

Require the runtime-supported native mechanism explicitly

Writes race or verification reads stale state

Mutating operations were treated as independent

Serialize writes and verify after the final committed state

Results differ between runs

The task or environment was not controlled

Freeze model, effort, prompt, commit, permissions, and data window

Why the Instruction Can Help

An agent may know that parallel calls exist without consistently deciding which operations are independent. A short scheduling rule moves that decision before execution: build the dependency graph, batch the ready read-only nodes, inspect the results, then advance to the next dependent layer.

The benefit is fewer tool-call round trips. It does not make the underlying tools faster, reduce the size of every result, or guarantee lower model usage. Large responses can still dominate context, and unsafe batching can create rework.

The strongest public evidence is still user-reported. OpenAI Codex issue #35050 described four batched runs and three controls on a large-repository task plus four paired finance runs. The reporter measured fewer call cycles and lower weighted usage with an explicit instruction, but also documented a worse prompt variant. An earlier trace in issue #32503 reported only 5 parallel batches across 739 Code Mode execution cells. These observations identify a reproducible question, not a universal defect rate.

That is why the useful fix is modest: batch only operations you can prove are independent, keep state changes ordered, and retain the instruction only when a controlled comparison preserves coverage and improves a metric you care about.

For related Codex usage symptoms, see How to Diagnose Codex Usage Spikes. For durable project instructions, see How to Make Codex Review Code the Way Your Team Does.

Sources

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.