agentleFS
bmdhodlbmdhodl/agent47/skills/agentguard/SKILL.md

agentguard

Skill4 starsChanged 40 days agoMITView on GitHub

Runtime guardrails for AI coding agents. Recorded-budget preflight, loop, retry, and timeout checks in instrumented Python. Zero dependencies, local-first, MIT licensed.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. GoPlusSecurity/agentguard★ 486same name
    2. kunwl123456/zeroclaw-skills-collection★ 27same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

Files
SKILL.md

AgentGuard

Runtime guardrails for coding agents. Recorded-budget preflight, loops, retries, and timeouts on instrumented Python paths. Zero dependencies. Local-first. This skill is onboarding, not host enforcement. See docs/enforcement-boundary.md.

Install

pip install agentguard47

Verify the install:

agentguard doctor

Quick Start (4 lines)

from agentguard import Tracer, BudgetGuard, patch_openai

budget = BudgetGuard(max_cost_usd=5.00, warn_at_pct=0.8)
tracer = Tracer(service="support-agent")
patch_openai(tracer, budget_guard=budget)
# Chat Completions are tracked. Exhausted recorded budget refuses the next dispatch.

Guards

GuardWhat it stopsExample
BudgetGuardDollar/token/call overrunsBudgetGuard(max_cost_usd=5.00)
LoopGuardExact repeated tool callsLoopGuard(max_repeats=3)
FuzzyLoopGuardSimilar calls, A-B-A-B patternsFuzzyLoopGuard(max_tool_repeats=5)
TimeoutGuardWall-clock time limitsTimeoutGuard(max_seconds=300)
RateLimitGuardCalls-per-minute throttlingRateLimitGuard(max_calls_per_minute=60)
RetryGuardRetry storms on flaky toolsRetryGuard(max_retries=3)

Guards raise exceptions (BudgetExceeded, LoopDetected, TimeoutExceeded, RetryLimitExceeded) on instrumented paths. They do not intercept host tools or provider invoices.

One-Liner Init with Defaults

import agentguard

agentguard.init(local_only=True)
# Reads .agentguard.json if present, sets up tracer + budget guard with sensible defaults

Or drop a .agentguard.json in your repo root:

{
  "profile": "coding-agent",
  "service": "my-agent",
  "trace_file": ".agentguard/traces.jsonl",
  "budget_usd": 5.0
}

Tracing

from agentguard import Tracer, JsonlFileSink, BudgetGuard

tracer = Tracer(
    sink=JsonlFileSink("traces.jsonl"),
    guards=[BudgetGuard(max_cost_usd=5.00)],
)

with tracer.trace("agent.run") as span:
    span.event("reasoning", data={"thought": "search docs"})
    span.cost.add("gpt-4o", input_tokens=1200, output_tokens=450)

Auto-Instrumentation

from agentguard import Tracer, BudgetGuard, patch_openai, patch_anthropic

budget = BudgetGuard(max_cost_usd=5.00)
tracer = Tracer(service="support-agent")
patch_openai(tracer, budget_guard=budget)      # tracks ChatCompletion calls
patch_anthropic(tracer, budget_guard=budget)   # tracks Messages calls

Framework Integrations

LangChain, LangGraph, and CrewAI are supported as optional extras:

pip install agentguard47[langchain]
pip install agentguard47[langgraph]
pip install agentguard47[crewai]

CLI Tools

agentguard doctor              # verify install, no network calls
agentguard demo                # local proof run, no API keys needed
agentguard report traces.jsonl # summarize a trace file
agentguard eval traces.jsonl   # assert properties in CI
agentguard incident traces.jsonl --format html  # postmortem report

Links

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.