# Triage Sentinel: Self-Healing MCP Agent & Guardrails Kit

> Turn fragile Python/MCP agents into production-ready systems with Pydantic self-healing retries, circuit breakers, prompt-injection & SSRF guardrails, and an offline chaos test suite.

Triage Sentinel: Self-Healing MCP Agent & Guardrails Kit is a paid AI agent skill on Agensi by Amit Dwivedi, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9.99 (one-time purchase)
- Creator: [Amit Dwivedi](https://www.agensi.io/creators/amit-dwivedi)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Version: 1.0
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/triage-sentinel-self-healing-mcp-agent-guardrails-kit
- Tags: ai-agents, llm-ops, api, python, pydantic, mcp-server

## About this skill

Stop your AI agents from crashing on bad tool arguments, looping infinitely, or getting hijacked by prompt injections.

Triage Sentinel is a plug-and-play production harness and Agent Skill that teaches Claude Code, Cursor, Copilot, and 20+ coding agents how to wire battle-tested reliability and security layers into any Python, FastAPI, or MCP-backed AI agent.

### What’s Included

Self-Healing Schema Retries: Validates every LLM tool call against strict Pydantic v2 schemas before execution. When the model hallucinates bad arguments, structured ValidationError feedback is fed back to the LLM to self-correct automatically (up to 2 retries/step) instead of crashing.
Per-Tool Circuit Breakers (CLOSED → OPEN → HALF_OPEN): Trips after 3 consecutive tool failures or timeouts to stop retry storms during downstream 503 outages, with automatic cooldown recovery.
Loop Detection & Budget Caps: Enforces hard step, token, and wall-clock limits plus SHA-256 action fingerprinting to block identical repeated tool calls.

### Defense-in-Depth Guardrails

PromptInjectionGuard: Detects instruction-override / exfiltration patterns and isolates untrusted payloads inside <untrusted_ticket_data> XML delimiters.
SSRFGuard: Strict /api/... allowlist blocking external domains, file://, path traversal (..), and cloud metadata (169.254.169.254).
MCP Server + ChromaDB Duplicate Search: Official mcp Python SDK server with HTTP endpoint replay, service log querying, and ChromaDB semantic duplicate matching.
Zero-Cost Offline Chaos Suite (pytest): Includes a toggleable FastAPI chaos sandbox (503 storms, latency spikes, NPE 500s, malformed JSON), a deterministic MockLLMProvider, and 36 passing unit & E2E tests—run everything in CI with zero API keys.

## Requires

- Python 3.10+
- MCP-backed
- Optional: OpenAI or OpenRouter API key

## Known limitations

- **In-Memory Store & Simulated Logs:** Out of the box, `search_duplicate_issues` uses an ephemeral in-memory ChromaDB collection (pre-seeded with 8 sample tickets) and `query_service_logs` returns simulated logs. Point these adapters to your persistent vector DB and log provider (e.g., Datadog, CloudWatch, ELK) for production use.
- **Python & MCP SDK Versions:** Tested on Python 3.12 (Python 3.10–3.12 recommended for `chromadb`/`onnxruntime` wheel compatibility). Uses `MCPServer` from `mcp>=2.0`; if your codebase pins `mcp<2`, replace `MCPServer` with `FastMCP`.
- **Regex-Based Injection Detection:** `PromptInjectionGuard` combines regex signature matching with `<untrusted_ticket_data>` XML delimiter isolation rather than a separate ML classifier, so it should be paired with strict tool allowlists (`SSRFGuard`).
- **Single-Process State:** `ToolCircuitBreaker` and `RunBudgetTracker` keep state in memory per instance rather than in a distributed store like Redis.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Triage Sentinel: Self-Healing MCP Agent & Guardrails Kit skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill prevent my AI agents from getting stuck in infinite loops?

This skill provides a Python reliability layer that uses Pydantic v2 to catch validation errors and automatically feed them back to the LLM for correction, while preventing infinite loops and cascading API failures with built-in circuit breakers.

### Which frameworks and Python versions are compatible with this harness?

It is designed for Python 3.10+ environments and integrates seamlessly with any agent or MCP server using the official MCP Python SDK, Pydantic v2, and FastAPI.

### What exactly is included in the purchase of this skill?

You receive the complete Python source code for the TriageOrchestrator, the ToolCircuitBreaker logic, the SSRFGuard security module, and the full FastAPI chaos testing sandbox for offline validation.

### Can I test the self-healing capabilities without incurring high API costs?

The Chaos Testing Suite allows you to simulate 503 errors, latency spikes, and malformed JSON in a local sandbox, letting you verify your agent's resilience without spending money on LLM tokens.

### Why is this better than just prompting the LLM to follow a specific schema?

Unlike prompts which are often ignored by models under high pressure, this skill enforces hard constraints in the execution code, making it physically impossible for the agent to bypass security allowlists or exceed retry budgets.

### Do I need a paid OpenAI or Anthropic API key to run the tests?

No. The skill includes a deterministic MockLLMProvider and an ASGI-backed FastAPI chaos sandbox, so all 36 unit and end-to-end tests run 100% offline in pytest with zero API keys or external network calls. When you are ready for production, just add your OPENAI_API_KEY or OPENROUTER_API_KEY in .env and switch to OpenAICompatibleProvider.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
