How to cap the cost of parallel coding agents
Limit concurrency and assign each worker a distinct task. Set the overall spend and retry budget before starting the batch.
Example
Five worktrees all try to fix the same dependency upgrade. Four duplicate patches produce no extra value.
What to do
- Give each worker a separate work item and acceptance test. Avoid launching multiple long sessions on the same issue unless the comparison is intentional.
- Set a concurrency ceiling and a timeout. Stop the remaining work when a solution passes or a shared dependency blocks progress.
- Track usage by worker or task and reconcile it with billing. Use a per-project gateway cap for routed workloads.
How to verify
A test batch stays within the concurrency ceiling and stops issuing requests after the budget or completion condition.
Limits
Concurrency limits reduce simultaneous work. They do not by themselves impose a cost ceiling on a long-running task.