AgentGuard – Zero-dependency loop and spend guardrails for AI agents A developer publishing as nemor1-bit released AgentGuard, a zero-dependency Python library that adds runtime guardrails to AI agents, installable via pip from its GitHub repository. AgentGuard enforces per-action spend caps (max_spend, e.g. $50), session totals (max_total_spend, e.g. $500), consecutive tool-loop limits (max_consecutive_repeats=4), a 300-second idempotency window against duplicate retries, human-approval gates for actions such as send_email and charge_card, and verify-after-act checks via verify_fn. The project also offers a $750 paid setup service and an enterprise waitlist for Redis-backed idempotency, SOC2 compliance logs and RBAC for 10,000+ agents. The zero-dependency runtime seatbelt, loop killer, and human-approval gate for AI Agents. https://nemor1-bit.github.io/agentguard/ https://nemor1-bit.github.io/agentguard/ AgentGuard protects production AI agents from the quiet failures that dollar caps alone miss—stopping consecutive tool loops, duplicate retries on timeouts, unverified side effects, and unapproved irreversible actions. pip install git+https://github.com/nemor1-bit/agentguard.git python from agentguard import AgentGuard guard = AgentGuard max spend=50, Max \$50 per action max total spend=500, Max \$500 across the session max consecutive repeats=4, Kill stuck loops repeating the same tool idempotency window=300, Block duplicate retries within 5 minutes require approval for= "send email", "charge card" , approval callback=lambda action, cost: input f"Approve {action}? y/n : " == "y", webhook url="https://slack.com" Protect any tool with human approval + verify-after-act @guard.protect cost fn=lambda user id, amount: amount, verify fn=lambda result, user id, amount: result.get "paid" is True def charge card user id, amount : return {"paid": True, "tx id": "tx 991"} charge card "usr 42", 25 Pauses for human approval - executes - verifies effect charge card "usr 42", 25 🛑 Blocked automatically duplicate action within 300s - Aggregate Dollar-Velocity Caps max spend per minute : Stops rapid spend bleed e.g., ten $2 calls in 60 seconds even when every single action is under max spend . - Strict Tool Allowlisting allowed tools : Eliminates keyword whack-a-mole by blocking any tool not explicitly allowlisted. - Dry-Run / Shadow Preview Mode dry run=True : Simulates full agent workflows through every policy check and outputs a projected spend receipt get dry run summary before committing real side effects. - Consecutive Tool-Loop Detection max consecutive repeats : Halts runs when an agent calls the same tool repeatedly—even if arguments change slightly or calls are spaced out. - Human-in-the-Loop Approval Gate require approval for : Pauses execution on irreversible actions send , pay , delete until a human approves via callback or webhook. - Duplicate-Action Prevention Idempotency : Automatically hashes action, args, kwargs to block double-charges and duplicate emails after API timeouts. - Verify-After-Act verify fn : Runs a lightweight post-execution check to catch silent failures when an agent reports success without the real-world effect occurring. - Two-Phase Variable Cost Accounting: Supports dynamic pre-flight cost fn estimation plus record actual cost post-call reconciliation. - OpenAI Tool Validation & Alerts: Native guard openai tool call , keyword kill-switches, timestamped audit logs, and Slack/Discord alerts. - Need distributed Redis idempotency, SOC2 compliance logs, and RBAC for 10,000+ agents? Join the Enterprise Waitlist https://nemor1-bit.github.io/agentguard/ . - Need hands-on help wiring AgentGuard into your production OpenAI or LangChain agents? Book a Priority Setup & Custom Guardrails session $750 https://buy.stripe.com/00wbJ2ceT7yd9hA5oh3F600 .