Has anyone actually solved runaway agent costs? Looking for patterns beyond logging
OpenAI Developer Community
June 9, 2026
Exactly the gap — hooks fire but can’t stop. max_turns caps iterations but doesn’t know anything about cost. The tool pattern (Option 3) solves this: the agent asks permission before spending, the policy engine can deny it before the charge fires. No hook needed, no post-hoc cleanup.
I shipped this as pip install openai-agents-valta if you want to see the implementation.
Discussion in the ATmosphere