Agentguard47
The AgentGuard47 server provides read-only access to agent trace data, guard alerts, usage metrics, and cost breakdowns for the AgentGuard runtime monitoring system.
Query trace summaries (
query_traces): Search and paginate through trace summaries, filterable by service name and time range, returning metadata like trace ID, event/error counts, duration, and cost.Get full trace details (
get_trace): Retrieve the complete event tree for a specific trace ID, including all spans, tool calls, LLM calls, guard triggers, and errors.Get trace decisions (
get_trace_decisions): Extract normalized decision events (proposals, overrides, approvals, bindings) from a trace — useful for auditing human-in-the-loop workflows.Get alerts (
get_alerts): Fetch recent guard alerts such as loop detections and budget overruns, optionally filtered by time.Check usage quota (
get_usage): View current event quota consumption versus plan limits, including retention period and plan details.Get cost breakdown (
get_costs): Retrieve the current month's cost breakdown by model, total spend, and estimated savings from guard interventions.Budget health check (
check_budget): Run a quick pass/fail assessment combining usage quota and cost data to determine if operations are within safe limits.
Provides runtime guards for CrewAI agents, including loop, retry, and budget limits via optional integration extra.
Integrates runtime guards with LangChain agents to enforce budgets, loops, and retry limits via optional extra.
Adds runtime control to LangGraph agents, including hard budget caps and loop detection via optional integration extra.
Auto-patches OpenAI SDK to trace and enforce budget limits on chat completions, stopping overspend in-process.
AgentGuard
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 agentguard47Getting started
1. Install and verify
pip install agentguard47
agentguard doctor # package ok?
agentguard demo # offline proof (no API keys)2. Guard an OpenAI client
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-enforcedWhen spend crosses the hard limit, BudgetExceeded is raised and the run stops.
3. Cap a single task
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 crosses4. Read the local proof
agentguard report .agentguard/traces.jsonl
agentguard incident .agentguard/traces.jsonlOr scaffold a starter file:
agentguard quickstart --framework raw --write
python agentguard_raw_quickstart.pyRelated MCP server: Langfuse MCP Server
What it stops
Problem | Guard | Exception |
Spend blowup |
|
|
Same tool forever |
|
|
Fuzzy / A-B-A-B loops |
|
|
Retry storms |
|
|
Hung runs |
|
|
Spam calls |
| — |
Wallet drain (x402/USDC) |
|
|
Not a dashboard. Not a model router. An in-process exception that kills the bad run mid-flight.
Cap your agent's x402 wallet spend
Agents that pay per-call via x402 (USDC micropayments) can drain a wallet in a
silent loop. X402SpendGuard wraps the payment step and refuses before paying:
from agentguard import X402SpendGuard
guard = X402SpendGuard(
max_total_usd=5.00, # wallet cap, add period="day" for a daily reset
max_per_endpoint_usd=1.00, # cap per resource URL
max_per_call_usd=0.10, # refuse any single payment above this
)
guard.charge(0.001, "https://api.example.com/search", my_x402_pay_step)AgentGuard meters and refuses; it never signs or settles. Amounts come from your x402 client. No crypto dependencies.
Features
Hard stops — exceptions inside your process, not after-the-fact alerts
Task-level budgets —
BudgetGuard.goal(...)for sub-task caps + warn hooksLocal traces — JSONL by default; no network unless you opt in
Zero deps — stdlib only; Python 3.9+
Provider patches —
patch_openai/patch_anthropicFramework hooks — LangChain, LangGraph, CrewAI (optional extras)
Local by default
No API key required for local proof
No network unless you configure
HttpSinkMIT licensed
The 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.
Integrations
OpenAI · Anthropic · LangChain · LangGraph · CrewAI · raw agent loops
pip install "agentguard47[langchain]" # optional extras as neededDocs
MCP server —
npx -y @agentguard47/mcp-server
Links
AgentGuard on the web (hosted history, alerts, and MCP visibility for Claude Code, Cursor, and Codex): https://bmdpat.com/tools/agentguard?utm_source=agentguard47&utm_medium=readme&utm_campaign=touchpoints
The 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.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
AlicenseAqualityBmaintenanceA remote Model Context Protocol server acting as middleware to the Sentry API, allowing AI assistants like Claude to access Sentry data and functionality through natural language interfaces.Last updated742801MIT- AlicenseBqualityDmaintenanceEnables querying Langfuse analytics, cost metrics, and usage data across multiple projects. Provides tools for trace analysis, model/service cost breakdowns, and daily usage trends through natural language queries.Last updated24132MIT
- FlicenseAqualityDmaintenanceEnables AI agents to query Prometheus metrics and Loki logs for intelligent alert investigation and troubleshooting. Provides service discovery, metric querying, log searching, and correlation tools to help identify root causes of issues.Last updated9
- Alicense-qualityDmaintenanceA local-first security system for autonomous AI agents that provides tools for security verification, goal anchoring, and action logging. It protects against prompt injection and goal drift by enforcing user-defined rules and offering performance insights through session grading.Last updated4MIT
Related MCP Connectors
Budget & cost control for AI agents — per-agent spend caps + rate limits before each call.
The WAF for agents. Pattern-based + heuristic firewall scans prompts, RAG documents, tool argume...
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bmdhodl/agent47'
If you have feedback or need assistance with the MCP directory API, please join our Discord server