promptdojo_

The loop with a meter — budget caps, stop reasons, and the trace — step 5 of 8

The loop below has its cost gate missing. Fill in the condition that stops the run before a tool call would push spend past the budget — ask "would this call bust the cap," not "did the last one."

With the gate in place, the first run prints cost-cap at $0.14 (the second rerun would hit $0.25 against a $0.20 cap) and the second prints plan-complete at $0.06.