While working with autonomous agents in LangChain and CrewAI, I kept running into cases where agents would loop and generate unexpectedly high API costs.Most existing solutions are reactive and account-level. I wanted something more granular and preventive, so I built a small tool that enforces hard spending limits per agent directly inside the agent loop.How it works:The budget is checked before the LLM call is executed.
If an agent would exceed its limit, the call is blocked.
You can assign different budgets to different agents.
Limits can be updated from a dashboard with no code changes or redeploys.
It works as a native tool in both frameworks:bash
pip install langchain-valta
pip install crewai-valta
pip install openai-agent-valta
I’ve been using it in my own projects and decided to open it up as a free beta.If you’re building agents and have dealt with cost control issues, I’d be interested in hearing your experience. Happy to answer questions or help anyone who wants to integrate it.Link: https://valta.co
Top comments (1)
Nice work on the budget enforcement. Interesting parallel — I built something similar but focused on 'execution drift' instead of cost: Brainstorm-Mode (mehmetcanfarsak/Brainstorm-Mode on GitHub) uses PreToolUse hooks to block tool calls when the agent is supposed to be brainstorming. Same pattern of gating actions, just a different boundary condition. The mode system (divergent/actionable/academic) gives the agent clear signal about what it's allowed to do.