Stop runaway agents before they drain your budget
budget-agent sits between your agent and the LLM. Hard limits on cost, tokens, and steps — enforced pre-flight and post-step.
Features
Most agent frameworks let loops run. PainiteHQ does not.
Catch overruns before they happen
Pre-flight checks estimate output cost before the API call fires. Already over budget — the call never lands.
Hard limits. Not suggestions.
Ceilings on cost, input tokens, output tokens, steps, wall time. Any one exceeded — agent stops, step rolled back, no partial charges.
Downgrade as budget depletes
Define a fallback chain. As spend crosses thresholds the router moves to a cheaper model — no code changes, no manual intervention.
Loops detected and killed
The circuit breaker watches for repetition and stagnation across steps. If the agent is spinning, it stops before the spin costs you.
Works with any provider
OpenRouter, OpenAI, Together AI, Fireworks, Ollama, raw fetch. Bring your own executor. No provider bundled, no model defaulted.
Survive restarts
Checkpoints persist agent state. Resume mid-run after a crash or deploy without replaying calls already billed.
Most agent frameworks treat every loop the same — a step to execute, a token to spend, a call to log. They are built to run agents, not to stop them.
Budget-agent by PainiteHQ is different. Budget enforcement runs across every step — checking limits before the call fires and after it lands, rolling back overages, routing to cheaper models as spend climbs.
FAQ
Have questions? Find answers.
Agent workflows can make hundreds of LLM calls across tools, retries, and loops. budget-agent adds hard limits on cost, tokens, steps, and runtime so a single workflow cannot exceed the budget you define.
Execution stops immediately. The SDK records actual usage, rolls the step back from the tracker, and throws a BudgetError by default. You can also provide a custom onExceeded handler to log, alert, switch models, or take another action.
Yes. budget-agent works with OpenRouter out of the box and supports OpenAI, Anthropic, Together AI, Fireworks, Ollama, LocalAI, and any OpenAI-compatible API. You can also bring your own executor for custom providers.
Each step is checked twice. A pre-flight check estimates the cost before the request is sent. A post-step check verifies actual usage after the response returns. If a limit is exceeded, execution is stopped before the workflow can continue.
Yes. Checkpoints allow agent state and usage data to persist between runs. Resume from a saved checkpoint without replaying previously completed steps or losing budget history.
Still have questions? Contact us