AgentShield: Python Firewall for AI Agent Spend Control

This repository profile is provided by osrepos.com, an open source repository discovery platform.

AgentShield: Python Firewall for AI Agent Spend Control

Summary

AgentShield is a pure Python library designed to prevent runaway AI agents from exceeding budget limits. It offers 10 composable spend rules, evaluated in under 1ms, providing robust cost control. Although its core development has transitioned to sipi.bot, the AgentShield Python package remains available for existing users and its test fixtures are open-source.

Repository Information

Analyzed by OSRepos on September 16, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

AgentShield is a pure Python library designed to act as a firewall for AI agent spending. It helps stop runaway AI agents before they consume excessive budget by offering 10 composable spend rules, evaluated per-transaction in under 1ms. While the project's primary development has been consolidated into sipi.bot, the AgentShield Python package and its test fixtures remain available for existing users and open-source contributions.

Why Use & Benefits

AI agents, while powerful, can sometimes incur unexpected costs. AgentShield provides a robust solution to manage and control these expenditures with its lightweight, high-performance engine. Key benefits include its pure Python 3.11 stdlib implementation with zero dependencies, ensuring easy integration and minimal overhead. It uses decimal.Decimal for precise money calculations, operates statelessly, and guarantees deterministic results, all while evaluating transactions in less than 1ms. The library offers a comprehensive set of 10 rule types, from transaction_limit and daily_total to velocity and merchant_allowlist, allowing fine-grained control over agent spending.

Installation

To get started with AgentShield, install the package via pip:

pip install agentshield-spend

Note: The import name for the library is agentshield, as the PyPI name agentshield belongs to an unrelated project.

Examples

Here's a quick example demonstrating how to use AgentShield to evaluate a transaction against defined spend rules:

from agentshield import SpendControlEngine

engine = SpendControlEngine()

# A transaction your agent wants to make
transaction = {
    "amount": 500.00,
    "merchant": "openai-api",
    "category": "llm_inference",
    "agent_id": "my-agent",
    "timestamp": "2026-08-10T10:00:00Z",
}

# Your spend-control rules
rules = [
    {"id": "r1", "type": "transaction_limit", "priority": 1,
     "params": {"max_amount": 250}, "action": "BLOCK"},
    {"id": "r2", "type": "daily_total", "priority": 2,
     "params": {"max_daily": 2000}, "action": "BLOCK"},
    {"id": "r3", "type": "velocity", "priority": 3,
     "params": {"window_minutes": 60, "max_count": 10}, "action": "FLAGGED"},
]

# Prior transactions today (for daily_total and velocity checks)
prior_transactions = []

# Evaluate, returns in <1ms
result = engine.evaluate(transaction, rules, prior_transactions)
print(result["decision"])  # BLOCKED
print(result["reason"])    # Transaction amount $500.00 exceeds limit of $250.00

Links

For more information and to explore the project further, refer to these links:

Related repositories

Similar repositories that may be relevant next.

tooltrim: Drastically Reduce LLM Agent Tool Output Tokens, Improve Accuracy

tooltrim: Drastically Reduce LLM Agent Tool Output Tokens, Improve Accuracy

September 16, 2026

tooltrim provides drop-in compression for LLM agent tool outputs, drastically cutting tokens while often improving answer accuracy. This provider-agnostic solution offers content-aware compression, faithfulness benchmarks, and seamless integration with popular frameworks or as an OpenAI-compatible proxy.

PythonLLM AgentsContext Compression
DA-Forge: Streamlining Declarative Agent Creation for Copilot Notebooks

DA-Forge: Streamlining Declarative Agent Creation for Copilot Notebooks

September 12, 2026

DA-Forge is a Python-based tool by Microsoft designed to automate the creation and deployment of Declarative Agents for Copilot Notebooks. It significantly reduces the manual effort and time required to set up AI assistants with specific grounding references, transforming an 85-minute process into just a few minutes. This tool is essential for developers and researchers working with Copilot Notebooks and Declarative Agents.

PythonMicrosoft 365Copilot
Curie: Automated and Rigorous Scientific Experimentation with AI Agents

Curie: Automated and Rigorous Scientific Experimentation with AI Agents

September 12, 2026

Curie is an innovative AI-agent framework designed for automating rigorous scientific experimentation. It streamlines the entire research lifecycle, from hypothesis formulation to result interpretation, ensuring precision, reliability, and reproducibility. This empowers scientists to accelerate their research processes significantly.

AI AgentsAI for ScienceArtificial Intelligence
Tau: A Minimalist Python Coding Agent for Your Terminal

Tau: A Minimalist Python Coding Agent for Your Terminal

September 8, 2026

Tau is a Python port of Pi's minimalist coding agent, designed to live in your terminal. It allows users to make requests like "explain this repo" or "add tests," and it can read files, edit code, and run commands. Beyond its utility, Tau also serves as a teaching project, demonstrating how coding agents are built with a small, readable codebase.

PythonAICoding Agent

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️