Test environment

Skip to content
← Token efficiency

05 / 06

Bound loops, tools, models, and batch jobs

Cap retries and expensive tool calls, pick a model that matches the task, and use asynchronous batch APIs only for independent, latency-tolerant work — without removing checks.

Step 1 of 4

The loop is often the real token burner

One oversized prompt is visible. Twenty identical greps, three “fix” rounds that change nothing, and a model that re-reads the tree each time are worse. Before you start: step cap, allowed commands, stop rules (success, repeated failure, budget, ambiguity). OpenCode’s agent.<name>.steps is an iteration cap, not a dollar kill-switch; opencode stats reports usage after the fact. Other harnesses need the same limits in config and in the brief.

Stop conditions stay. Do not raise the cap because the agent looks busy. Do not delete tests so the loop goes green. Stopping avoids further uncontrolled work; report the failed check and usage already incurred. It does not prove the overall task was cheaper.

Sources