AgentOps Guardian MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AgentOps Guardian MCP Serverpause the current run and show why it tripped the breaker"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🛡️ AgentOps Guardian — Earned Autonomy for AI Agents
Companies will not let AI agents act on their own, because one loop can burn the budget and one poisoned email can trigger a $5,000 refund. This project is a control layer that stops bad runs and lets each agent earn its permissions, like a credit score.
One line: an agent's permissions grow and shrink automatically with its measured track record — and a breaker, shield and human gate sit between it and the tools regardless of which LLM it uses.
Built for the International AI Builders Congress 2026, InfraSphere AI, AgentOps challenge — "Reliable, governable agent systems" (MCP + observability + evaluation).
How it works
Interactive architecture map on gitdiagram.com/shaswatabarua/agentops-guardian — every node below is clickable and opens the actual source file.
%% Generated by https://gitdiagram.com/shaswatabarua/agentops-guardian
flowchart TD
subgraph AG["Agent (model-agnostic)"]
SC["Scripted agents"]
GA["Gemini agent (optional)"]
end
AG -->|"tool calls (tool, args, tokens)"| RN["Guarded Runner<br/>runner.py"]
subgraph CTRL[" Control Plane "]
RN --> BK["Circuit Breaker<br/>exact · cycle · semantic · step · budget"]
BK -->|"trip ⇒ stop run"| ST[(SQLite<br/>runs · steps · trust events)]
RN --> SH["Injection Shield<br/>scan result BEFORE agent sees it"]
SH -->|"hit ⇒ quarantine"| ST
RN --> TA["Trust Tiers 0-3<br/>approval gate per action"]
TA -->|"refund > limit"| HU{{"Human decision<br/>approve / reject / override"}}
HU --> ST
end
ST --> API["FastAPI Control API<br/>api.py"]
API --> DASH["Live Dashboard"]
subgraph HUM["Human Oversight"]
MC["MCP Server · 12 supervisory tools<br/>mcp_server.py"]
TL["OpenTelemetry trace export<br/>telemetry.py"]
end
API -.-> MC
API -.-> TLThe agent never sees the tool result raw and never acts unprompted above its tier: every step passes the breaker, the approval gate and the shield, and every outcome writes an insert-only trust event with a plain-English reason.
Related MCP server: HAI-MCP
What it does
Layer | What it does |
Circuit breaker | Stops a run on: exact repeats, 3-4 step cycles, reworded loops (semantic), a step limit, or a budget cap |
Trust score + tiers | Every agent starts at 50. Good runs raise it, trips, kills and attacks lower it. The score sets what the agent may do without asking a human |
Injection shield | Scans every tool result for hidden instructions before the agent sees it. A hit quarantines the run and costs trust |
Human control | Pause, resume, kill, approve, reject, edit the agent's memory, override its next tool call — from the dashboard, the REST API or MCP |
Dashboard | Live runs, trust scores with reasons, approvals and one-click scenarios (open |
MCP server | The same controls as MCP tools for Claude Desktop, Cursor or MCP Inspector ( |
OpenTelemetry | Each run is a trace and each step a span, for Phoenix, Jaeger or any OTLP collector |
Real LLM agent | A Gemini agent using the same tools (needs a free API key; see limits) |
Trust tiers
Tier | Score | May do without asking a human |
0 Probation | below 30 | nothing: every action needs approval |
1 Junior | 30-59 | lookups and emails; any refund needs approval |
2 Trusted | 60-79 | refunds up to $100 |
3 Senior | 80-100 | refunds up to $500 |
Score changes: run completed +8, action approved +2, action rejected -5, killed by a human -10, breaker tripped -15, injection caught -20. Trust is slow to earn and quick to lose: one trip (-15) needs two clean runs (+16) to win back. These are starting values, not tuned on real agents.
Quickstart
git clone https://github.com/ShaswataBarua/agentops-guardian.git
cd agentops-guardian
pip install -r requirements.txt
python -m pytest -q # 62 tests
python demo.py # no server: shows the cost saving
uvicorn api:app --reload # dashboard at http://localhost:8000, API docs at /docsOptional: .env with GEMINI_API_KEY=... for the real-LLM scenario. Run python llm_smoke.py first (see limits).
Free public deployment: see DEPLOY.md. Traces: see the OpenTelemetry section below.
Results (measured by python eval/compare.py)
Loop detector | Loops caught | False alarms on normal work |
Exact-repeat rule only | 3/8 | 0/7 |
+ cycle rule | 4/8 | 0/7 |
+ semantic rule (full) | 7/8 | 0/7 |
Injection shield: 8/12 attacks caught, 0/10 harmless messages flagged.
Cost demo (demo.py): a looping agent uses 80,000 tokens ($0.24 at a placeholder $3 per 1M tokens) without the breaker and 4,000 ($0.012) with it, a 95% saving on that run.
MCP server (12 supervisory tools)
SECURITY: give this server to the human supervisor's client, never to the agent being supervised. It exposes no tool that sets a trust score — trust is earned from events, never handed out.
Tool | What a supervisor's client can do |
| Read the rules and every agent's score, tier, run-step and trust history |
| Freeze, continue or terminate a live run |
| Answer the human-approval gate from an MCP client |
| Correct an agent mid-run: change its memory, replace its next tool call |
uvicorn api:app # start the API
python mcp_server.py # stdio transport
npx @modelcontextprotocol/inspector python mcp_server.py # inspect it
AGENTOPS_URL=https://agentops-guardian.onrender.com python mcp_server.py # supervise a remote hostOpenTelemetry traces (open standard)
Every run becomes one trace and every step one span (tool, tokens, cost, status, trust score). It is off until you give it a collector address.
pip install arize-phoenix # free, open-source viewer
phoenix serve # UI at http://localhost:6006
set OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:6006 # Mac/Linux: export ...
uvicorn api:appA tripped, killed or quarantined run shows as an error span with the stop reason.
Honest limits (read before you trust any number above)
The test sequences and attack messages were written by the detector's author. The scores are optimistic and say nothing about real-world accuracy.
Semantic detection uses a small hand-made synonym table, not a sentence-embedding model. It misses the reworded policy question and anything outside its word list. Swapping in real embeddings means replacing two functions in
semantic.py; that upgrade is not built or tested.The shield is rule-based. It missed 4 of 12 attacks (leetspeak, an authority claim, a French attack, a polite rewording). Defence in depth: even if it misses, the trust tiers hold big refunds for a human.
The Gemini agent is not tested against the live API. The code around it is tested with fake responses. Run
python llm_smoke.pyand fix the model name or fields if it fails.Cycles longer than 4 steps are not detected. The step limit and budget cap are the backstop.
Token prices are placeholders (
PRICE_PER_Minrunner.py). Free tiers cost $0; the price shows the value to a paying company.Scripted agents are simulations. The trust score has not been tested on agents in production.
Files
File | Job |
| Loop, cycle, step-limit and budget rules |
| Reworded-loop detection (entities + intent concepts) |
| Prompt-injection rules |
| Score rules, tiers, approval policy, plain-English explanation |
| Runs one agent: control gate, breaker, tiers, shield, logging |
| Fake shop tools and scripted scenarios |
| Gemini-backed agent (untested live) |
| SQLite: runs, steps, trust events |
| FastAPI control, trust and dashboard routes |
| The live dashboard |
| MCP tools for a human supervisor's client |
| OpenTelemetry export |
| Free public deployment |
| Measures the detectors (writes |
| 62 tests |
MCP security note: give the MCP server to the human supervisor only, never to the agent being supervised. It can approve actions and kill runs, and it deliberately has no tool that sets a trust score.
Reproduce the numbers
python eval/compare.py # writes eval/results.md: detector A/B/C comparison + attack table
python -m pytest -q # 62 tests: breaker rules, semantic rule, shield, trust tiers, approvals, MCP, seeding
python llm_smoke.py # optional: verify the Gemini runtime path against the live APIRoadmap
Swap the synonym table for a sentence-embedding model (two functions in
semantic.py)Embedding-grade injection shield with adversarial test set
Adapters: emit
(tool, args, tokens)from LangGraph / CrewAI runs into the same governed loopReplay a recorded run under a stricter/lighter trust policy
Calibrate trust deltas against historical agent performance data
License
MIT — free to use, fork and build on. If it inspires your governance layer, a link back is appreciated.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
- gatewayOAuthai.sealgate
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Related MCP Servers
- AlicenseAqualityBmaintenanceSecurity-enforcing MCP proxy that sits between an AI agent and any number of downstream MCP servers, intercepting every tool call through a capability-token policy gateway that can allow, deny, or escalate to human approval before the call reaches any real tool. It also exposes built-in operator tools for approval workflows, audit trail queries, token management, voice/HUD output, and hierarchical2115Apache 2.0
- AlicenseCqualityBmaintenanceProvides a human-agent interface control plane for managing agent state, focus, and next steps across any MCP-compatible client, without calling an LLM itself.231MIT
- AlicenseNot gradedqualityBmaintenanceProvides a human-in-the-loop approval gateway for AI agents, enforcing policies and audit logging for MCP-compatible tool calls.Apache 2.0
- AlicenseAqualityAmaintenanceEnables MCP clients to manage and orchestrate autonomous agents, budgets, and multi-agent workflows within the OpenMesha agentic operating system.91Apache 2.0