Skip to content
reaatechREAATECH

reaatech/agent-budget-controller

0Last commit: Jun 4, 2026GitHub →

These packages give you a real-time budget enforcement layer for LLM-powered agents that checks every request against per-task, per-user, per-session, or per-organization spend limits before it executes. You'd adopt them to prevent runaway agent loops from exhausting your LLM budget in minutes, with graceful degradation like model downgrades and tool filtering before a hard stop. The system is built as a set of composable packages—a core engine with a state machine, a circular-buffer spend tracker, pricing tables, and optional integrations for Express/Fastify middleware, an LLM Router plugin, and an OpenTelemetry bridge that automatically records GenAI spans as spend entries.

Packages

8 packages

@reaatech/agent-budget-cli

v0.1.1
A CLI that installs a global `agent-budget` binary for managing agent budgets — defining budgets, checking remaining spend, listing active scopes, generating spend reports, simulating pre-flight checks, and manually resetting budgets.
status
published
published
2 days ago

@reaatech/agent-budget-engine

v0.1.1
A budget enforcement engine that provides pre-flight cost checks, real-time spend recording, and per-scope state machine transitions (Active → Warned → Degraded → Stopped) with auto-downgrade to cheaper models and expensive tool filtering. Exports a `BudgetController` class that orchestrates spend tracking, pricing, and policy evaluation, and pairs with `@reaatech/agent-budget-spend-tracker` and `@reaatech/agent-budget-pricing` at runtime.
status
published
published
2 days ago

@reaatech/agent-budget-llm-router-plugin

v0.1.1
A Fastify plugin that adds budget-aware routing to LLM Router, filtering model candidates by remaining budget and blocking requests when budgets are exhausted. It installs as the highest-priority strategy in the routing chain, evaluating before semantic and latency-based routing, and requires `@reaatech/agent-budget-engine` and `@reaatech/agent-budget-spend-tracker` at runtime.
status
published
published
2 days ago

@reaatech/agent-budget-middleware

v0.1.1
Express/Fastify middleware and a direct SDK (`BudgetInterceptor`) that enforces per-scope budgets on agent requests by checking estimated cost, auto-downgrading models, filtering expensive tools, and recording spend — all before the LLM call reaches your application code.
status
published
published
2 days ago

@reaatech/agent-budget-otel-bridge

v0.1.1
Converts OpenTelemetry GenAI spans into budget-tracked spend entries in real time by feeding span attributes to a `BudgetController`. Provides a `SpanListener` class that you call with span data from any OTel-compatible tracer.
status
published
published
2 days ago

@reaatech/agent-budget-pricing

v0.1.1
A pricing engine that computes LLM token costs using built-in or custom pricing tables, with LRU-cached lookups and model name normalization. Exports a `PricingEngine` class with `computeCost`, `estimateCost`, and `lookup` methods, plus a `ModelNormalizer` for alias resolution.
status
published
published
2 days ago

@reaatech/agent-budget-spend-tracker

v0.1.1
A circular-buffer-based in-memory spend tracker that records cost events and provides O(1) per-scope spend lookups, sliding-window rate calculations, cost projections, and anomaly detection—exposed as a `SpendStore` class with zero external dependencies.
status
published
published
2 days ago

@reaatech/agent-budget-types

v0.1.1
Zod-validated TypeScript types, enums, and error classes defining budget scopes, policies, enforcement actions, spend entries, and state transitions for the agent-budget-controller ecosystem. Exports interfaces, enums, and Zod schemas with zero runtime dependencies beyond `zod`.
status
published
published
2 days ago

Comments

Sign in with GitHub to comment and vote.

Loading comments…