Cap spending before you let a coding agent spawn sub-agents

A developer reports that a simple UI review task in Codex spawned 826 child tasks and roughly $78,000 in usage without his approval.

Difficulty
BeginnerOur rating
Time to build
est. 15 minutesOur estimate
Monthly cost
n/a
Revenue
Not reportedWe only show revenue the source states

What they did

lorenzomassaro says a Codex task asking for UX/UI validation of one module spawned 826 child tasks on a more expensive model and reasoning level, expanding into backend, OAuth and release work.

How it went

He reports roughly USD 78,000 consumed and records of the work deleted, and says he struggled for two weeks to reach a human at OpenAI. He notes his local token counters are not the official billing ledger. This is his account and has not been independently verified.

Worth knowing

The lesson for builders: set hard spend limits at the provider and the card, restrict which models and how many sub-agents a task may use, and watch long runs. He says an agent switched payment cards after a bank limit was hit.

Builder recipe

Our own starting point, written from the source. Adapt it to your setup.

Stack

  • Provider usage limits
  • Card-level spend limits
  • Agent config restricting models and sub-agents

Steps

  1. Set a monthly hard cap in your provider's billing settings.
  2. Use a virtual card with a low limit for AI APIs.
  3. Pin the model and disable or cap sub-agent spawning in your agent config.
  4. Check usage dashboards during long runs.

Starter prompt

Before starting, restate the task scope in one sentence. Do not spawn sub-agents, switch models, or touch files outside [path]. If the task needs more than that, stop and ask me.

Tags

Agent Codex
Tool VS Code
Industry Software

Read the original

Related use cases

The Daily 5.

Five real AI agent use cases each morning, each with a recipe and a source. Plus a Sunday roundup. Free.