If you are building AI agents with Python, you have probably experienced the moment of panic when an agent gets stuck in an infinite loop. It keeps calling the OpenAI API, burning through your credits, and you only realize it when you check your billing dashboard hours later.
The standard advice in the industry right now is to use observability tools. We are told to wrap our LLM calls in tracing libraries so we can see exactly what the agent is doing. While tracing is incredibly valuable for debugging, it has a fundamental flaw when it comes to cost control and safety. Observability is entirely passive. It records the disaster perfectly, but it does absolutely nothing to prevent it.
When an agent goes rogue, you do not just want a log entry. You want the execution to stop immediately.
To solve this, I built AeneasSoft. It is an open-source circuit breaker designed specifically for AI agents. Instead of just logging the requests, it actively monitors the traffic and blocks calls in application memory before they ever reach the network.
The implementation approach is what makes it unique. Most tools require you to use specific plugins or rewrite your code to use their wrappers. AeneasSoft takes a different route. It patches the underlying HTTP transport layer directly. This means it works automatically with LangChain, CrewAI, AutoGen, or even raw API calls. You do not need to change your architecture.
You simply import the library and initialize it with your desired constraints. You can define a maximum budget per hour, a strict error rate limit, or a cap on calls per minute to catch infinite loops. If the agent tries to make a request that violates these rules, the library throws an exception locally. The network request is never sent, and your API credits are safe.
Here is a breakdown of how an active circuit breaker compares to passive tracing.
Capability/ Active Circuit Breaker/ Passive Tracing
Primary Goal/ Prevention and Safety/ Debugging and Analytics
Network Impact/ Zero additional latency/ Often requires a proxy
Integration/ Two lines of code/ Requires extensive wrapping
Cost Management/ Hard limits enforced in RAM/ Alerts sent after spending
Another critical aspect we focused on is compliance. With regulations like the EU AI Act coming into effect, developers need to prove they have control mechanisms in place. AeneasSoft includes a feature to automatically generate cryptographically signed compliance reports, saving hours of manual documentation work.
The project is fully open-source under the MIT license. We believe that robust safety infrastructure should be a standard part of every AI stack, not a premium feature hidden behind a paywall.
If you want to secure your AI agents and stop worrying about runaway API costs, check out the repository on GitHub. We are actively building the community and would love to hear your feedback on the architecture.
Check out AeneasSoft on GitHub: https://github.com/aeneassoft/aeneassoft
Top comments (0)