How are you handling runaway agent costs?

Been building with OpenAI agents for a while and kept running
into the same problem — an agent gets stuck in a loop and burns
through API credits before anyone notices.

Tried a few things: setting account-level limits, adding logging,
wrapping calls in try/except. None of it actually stops the charge
before it fires.

Eventually built a small tool that checks the budget before each
OpenAI call and blocks it if the agent is over limit. Not a
soft warning — the call just doesn’t happen.

Been using it in my own projects and it’s helped. Happy to share
more details if anyone’s dealing with the same thing.

Curious how others are handling this — is there a pattern I’m
missing, or is everyone just setting account caps and hoping?