Surfaces read-only telemetry from AgentGuard47, the Python SDK that kills runaway agent runs before they drain your budget. Connect this to Claude Desktop and you can query live traces, check budget health, review loop or retry alerts, and pull cost breakdowns without leaving the conversation. Useful when you're running Python agents that call tools, retry flaky APIs, or review code autonomously and you want visibility into guardrails that actually stopped execution. The MCP server exposes what the in-process guards already wrote to local JSONL traces, so you get incident reports and spend tracking through stdio without adding network calls or external dependencies. Pair it with the core SDK to turn agent forensics into a context you can chat with.
Stop runaway agents before they burn money.
Zero-dependency Python kill switch for AI agents. Hard budget caps. Loop detection. Local traces. MIT.
pip install agentguard47
pip install agentguard47
agentguard doctor # package ok?
agentguard demo # offline proof (no API keys)
from agentguard import BudgetGuard, LoopGuard, Tracer, patch_openai
budget = BudgetGuard(max_cost_usd=5.00, warn_at_pct=0.8)
loop = LoopGuard(max_repeats=3)
tracer = Tracer(service="my-agent", guards=[loop])
patch_openai(tracer, budget_guard=budget)
# every OpenAI call is now traced + budget-enforced
When spend crosses the hard limit, BudgetExceeded is raised and the run stops.
Session budget can still have headroom. One goal can still be killed:
with budget.goal("refund", max_cost_usd=0.50, warn_at_pct=0.8) as g:
g.attempt()
budget.consume(cost_usd=0.12)
# BudgetExceeded names the goal when it crosses
agentguard report .agentguard/traces.jsonl
agentguard incident .agentguard/traces.jsonl
Or scaffold a starter file:
agentguard quickstart --framework raw --write
python agentguard_raw_quickstart.py
| Problem | Guard | Exception |
|---|---|---|
| Spend blowup | BudgetGuard | BudgetExceeded |
| Same tool forever | LoopGuard | LoopDetected |
| Fuzzy / A-B-A-B loops | FuzzyLoopGuard | LoopDetected |
| Retry storms | RetryGuard | RetryLimitExceeded |
| Hung runs | TimeoutGuard | TimeoutExceeded |
| Spam calls | RateLimitGuard | — |
Not a dashboard. Not a model router. An in-process exception that kills the bad run mid-flight.
BudgetGuard.goal(...) for sub-task caps + warn hookspatch_openai / patch_anthropicHttpSinkThe SDK is the free local proof path. Start local. Add hosted ingest later only if you want retained history, alerts, team visibility, spend trends, hosted decision history, or dashboard-managed remote kill signals. Local guards remain authoritative. HttpSink mirrors trace and decision events; it does not execute remote kill signals by itself.
OpenAI · Anthropic · LangChain · LangGraph · CrewAI · raw agent loops
pip install "agentguard47[langchain]" # optional extras as needed
npx -y @agentguard47/mcp-serverThe hosted page is an optional next step, not a requirement. The SDK stays free, local, and MIT, and the local guards stay authoritative. Nothing in this package phones home. The only network egress is a sink or exporter you configure yourself, such as HttpSink or an OpenTelemetry exporter.
MIT · Built for people who ship agents and hate surprise bills.
AGENTGUARD_API_KEY*secretAgentGuard read API key for querying traces, alerts, costs, usage, and savings.
AGENTGUARD_URLOptional AgentGuard API base URL. Defaults to production.
io.github.ericm1018/skillfm-llm-cost-optimizer-openai-anthropic-usage
io.github.mikerawsonnz/llm-orchestration-agent
io.github.mikerawsonnz/authenticated-llm-agent
labforgedev/copilot-memory-mcp
csoai-org/agent-prompt-injection-firewall-mcp
io.github.mikerawsonnz/authenticated-multi-llm-agent