Skip to main content

AI Agent Spend Guardian

Real-time cost monitoring and budget controls for autonomous AI agent deployments.

What is this?

AI Agent Spend Guardian is a cost tracking and monitoring dashboard built for teams running AI agents across platforms like n8n, Composio, LangChain, and AutoGPT. It aggregates LLM API expenses across OpenAI, Anthropic, and local model providers in one unified interface, solving the critical blind spot where teams deploy autonomous agents with zero cost visibility and no budget safeguards.

Features

  • Multi-provider cost tracking — Monitor spending across OpenAI, Anthropic, Ollama, Groq, Together AI, and other LLM providers
  • Real-time dashboards — Web UI and CLI tools for instant cost visibility
  • Budget controls — Set spending limits per agent, workflow, or team with automated alerts
  • Agent-aware insights — Track costs by individual agent, workflow execution, or time period
  • Alerting — Slack and Discord webhooks for budget breach notifications
  • Export & reporting — CSV exports for finance teams and compliance audits
  • Provider-agnostic — Works with any LLM API, including self-hosted and local models
  • Offline support — CLI tool parses local API logs and env files without external connectivity

Quick Start

Installation

pip install -r requirements.txt

Configuration

Copy .env.example to .env and add your API credentials:

cp .env.example .env

Edit .env with your provider keys:

OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
DATABASE_URL=postgresql://user:password@localhost/agent_spend_guardian

Run the Application

Start the FastAPI server:

python -m agent_spend_guardian.main

The dashboard will be available at http://localhost:8000.

CLI Usage

Generate a cost report from local logs:

python -m agent_spend_guardian.cli report --days 7 --format csv

Set a budget alert:

python -m agent_spend_guardian.cli budget set --agent my-agent --limit 100.00

Usage Examples

Web Dashboard

Access the dashboard to:

  • View real-time spending across all agents
  • Set budget limits and thresholds
  • Inspect cost breakdowns by provider, model, and agent
  • Export reports for finance review

API Integration

from agent_spend_guardian.tracker import SpendTracker

tracker = SpendTracker()

# Log an API call
tracker.log_call(
    agent_id="my-agent",
    provider="openai",
    model="gpt-4",
    tokens_used=1500,
    cost=0.045
)

# Retrieve costs
costs = tracker.get_agent_costs("my-agent", days=7)
print(f"7-day spend: ${costs['total']}")

Budget Alerts

Configure Slack notifications:

python -m agent_spend_guardian.cli alert configure \
  --channel #costs \
  --webhook https://hooks.slack.com/services/YOUR/WEBHOOK

Tech Stack

  • Backend: Python 3.10+, FastAPI
  • Database: PostgreSQL (production), SQLite (local CLI)
  • ORM: SQLAlchemy with Alembic migrations
  • Frontend: React (dashboard)
  • Authentication: JWT-based auth
  • Deployment: Docker-ready

Development

Database Migrations

alembic upgrade head

Contributing

See CONTRIBUTING.md for guidelines on submitting issues and pull requests.

Monetization

Freemium SaaS model with free tier, Pro ($39/mo), and Enterprise ($299/mo) plans. See MONETIZATION.md for details.

License

MIT License — see LICENSE for details.

Release files for ai-agent-spend-guardian 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-agent-spend-guardian 0.1.0
File Size Uploaded
ai_agent_spend_guardian-0.1.0.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-agent-spend-guardian 0.1.0
File Interpreter ABI Platform
ai_agent_spend_guardian-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.8 kB

Release files / ai_agent_spend_guardian-0.1.0.tar.gz

Download URL ai_agent_spend_guardian-0.1.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c8f3847628388c7d64e054ada82e7e04a9b6d4e817c990565ec43779263dd0db
BLAKE2b-256 checksum
How to use checksums
a97b2aead50c894dc56988f2b761266cebe46ac3ba6cd3c56d8f4c7b91e32af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / ai_agent_spend_guardian-0.1.0-py3-none-any.whl

Download URL ai_agent_spend_guardian-0.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d19e667873fc29dc35fb274a0a4fac79a8976645a563e9396d2ceae3854e1ae
BLAKE2b-256 checksum
How to use checksums
38d1e0150d6c7e4c1a189f5c4950a6bdae93c09ee6dc425e15b4898513e661b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page