Real-time cost monitoring for AI agent deployments across LLM providers
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_agent_spend_guardian-0.1.0.tar.gz.
File metadata
- Download URL: ai_agent_spend_guardian-0.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8f3847628388c7d64e054ada82e7e04a9b6d4e817c990565ec43779263dd0db
|
|
| MD5 |
afc2ac46c9de934d4b8d223547de249b
|
|
| BLAKE2b-256 |
a97b2aead50c894dc56988f2b761266cebe46ac3ba6cd3c56d8f4c7b91e32af4
|
File details
Details for the file ai_agent_spend_guardian-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ai_agent_spend_guardian-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d19e667873fc29dc35fb274a0a4fac79a8976645a563e9396d2ceae3854e1ae
|
|
| MD5 |
86eb39b008bb231711d89929864772e5
|
|
| BLAKE2b-256 |
38d1e0150d6c7e4c1a189f5c4950a6bdae93c09ee6dc425e15b4898513e661b8
|