About Portfolio Cases Services Blog Contact 🎙 Talk to AI
EN DE RU
🎙 Talk to AI
August 10, 2026 · 3 min read

Why 90% of AI agents fail in prod: how MCP Ouroboros tackles ambiguity and budget control

I'm Denis Shokhirev, Agentic AI Systems Architect based in Freiburg, running production agent systems for DACH B2B clients with a stack of Claude, Supabase, n8n, Doppler, and self-hosted Postgres. The most concrete pain: every week, I see agents that either burn through the entire API budget in hours or get stuck in endless clarification loops. My live system at live.gerdennisai.com is a public example — not a day goes by without catching a runaway or restarting a stalled agent chain. The Real

Denis Shokhirev
Denis Shokhirev
Agentic AI Systems Architect
Telegram LinkedIn

I'm Denis Shokhirev, Agentic AI Systems Architect based in Freiburg, running production agent systems for DACH B2B clients with a stack of Claude, Supabase, n8n, Doppler, and self-hosted Postgres. The most concrete pain: every week, I see agents that either burn through the entire API budget in hours or get stuck in endless clarification loops. My live system at live.gerdennisai.com is a public example — not a day goes by without catching a runaway or restarting a stalled agent chain.

The Real Production Killers: Ambiguity and Unchecked Budgets

In demos, you can babysit the agents. In production, the true blockers are not just LLM hallucinations or classic RAG errors, but two chronic, under-discussed issues:

  • Ambiguous task prompts that lead to infinite loops of clarification between agents.
  • Lack of global budget enforcement — agents eat up tokens, time, or credits far faster than you expect.

Stanford’s 2024 AI Index (source) found 85% of LLM-related production incidents are due to unbounded follow-up requests or runaway agent behavior. My own deployments confirm this: in at least 3 out of 5 shipped agent pipelines, I’ve had to retrofit circuit breakers after real budget overruns or agent deadlocks.

The MCP Ouroboros Pattern: External Process Control for Agentic AI

Instead of patching bugs agent-by-agent, I use the "MCP Ouroboros" pattern: an external Minimal Control Process (MCP) that:

  1. Enforces hard budget ceilings (tokens, money, wall time) across the entire agent pipeline.
  2. Tracks task progress via explicit checkpoints — preventing agents from looping on clarifications.
  3. Pulls agents out of ambiguous states by running external validation on all structured outputs (e.g., JSON).

The key: MCP never touches the LLM prompt or model weights. It supervises process flow and resource accounting only.

Architecture: Claude + n8n + Supabase + Custom MCP Service

I implement MCP as a separate Python (FastAPI) service, integrated with n8n workflows and Supabase for storage and validation:


import time
import requests

class MCPOuroboros:
    def __init__(self, budget_tokens, budget_seconds):
        self.tokens_left = budget_tokens
        self.time_left = budget_seconds
        self.checkpoints = []
    def step(self, agent_input, agent_output, tokens_used):
        self.tokens_left -= tokens_used
        self.checkpoints.append((time.time(), agent_input, agent_output))
        if self.tokens_left < 0 or self.time_left < 0:
            raise Exception("Budget exhausted")
        if self.detect_ambiguity(agent_input, agent_output):
            return self.external_validate(agent_output)
        return agent_output
    def detect_ambiguity(self, inp, out):
        # Simple heuristic: repeated clarifications of same field
        return "clarify" in out.lower()
    def external_validate(self, output):
        # Validate JSON via Supabase edge function
        resp = requests.post("https://your.supabase.io/validate", json={"out": output})
        return resp.json()

All agent communication flows through MCP, which logs usage and flags anomalies as soon as they appear.

Why Classic Rate Limits and try/except Aren’t Enough

Plain rate limits (on API or infra) or try/except blocks can’t stop recursive/chain runaway behavior — e.g., agents calling each other with invalid JSON, or forking subtasks indefinitely. MCP works because it tracks state transitions across the entire agent graph, not just one agent or API endpoint.

Budget Control: Not Just a Cost Issue

DACH clients often ask: "Can’t you just set token limits on OpenAI or Claude accounts?" In reality, budget means more than money:

  • Response time (SLA: e.g., 60 seconds per task)
  • Total database operations (Supabase bills by read/write count)
  • External API/webhook call limits (n8n, CRMs, payment providers)
ParameterAgent-Level ControlMCP-Level Control
LLM tokens+++
Execution time-++
External calls-+
Structured output validation-++

Structured Output Validation: Absolutely Required in Multi-Agent Chains

In practice, LLM agents often output invalid JSON or get lost in clarification loops. I use semgrep and gitleaks for static code checks, but for runtime, only external validation (Supabase edge functions or direct Python) works against runaway or ambiguous agent outputs.


import jsonschema

schema = {
    "type": "object",
    "properties": {
        "action": {"type": "string"},
        "params": {"type": "object"}
    },
    "required": ["action", "params"]
}

def validate_json(data):
    try:
        jsonschema.validate(instance=data, schema=schema)
        return True
    except Exception as e:
        return False

The pipeline does not move forward until each agent returns a valid structure — which kills most runaway patterns before they start.

FAQ

Why not just increase request timeouts?

Timeouts only guard single requests. Runaway chains can happen via repeated calls, which timeouts don’t catch at the process level.

Can n8n itself handle these controls?

For simple flows, yes. But for multi-agent chains, you need an external supervisor service, integrated via n8n API/Webhooks.

How does MCP detect ambiguity?

It uses explicit rules for repeated clarifications and external JSON/structure validation on all agent outputs.

What if an agent gets stuck in ambiguity?

MCP can either escalate to a human or trigger a pre-defined fallback logic depending on incident type.

How often do you update validation rules?

I add new heuristics after every prod incident, and do a full chain audit at least monthly.

At which stage of your LLM agent pipeline do you see the most runaway issues — initial prompt, agent-to-agent handoff, or output validation? I’d genuinely like to know. I run a free 30-min stack audit for DACH founders building AI in regulated markets. DM me on LinkedIn or write to @ger_dennis_ai.

Continue reading
Open-source AI coding agent in your terminal: how Qwen-Code changes coding and CI/CD without subscriptions
1000+ Real Agent Skills: What Actually Works in Production & How to Integrate Fast
How to unify databases, files, and APIs into a single governed graph for AI agents: real-world GraphJin MCP adoption pain points
Why 80% of Open-Source AI Chat Platforms Fail in Production: Hard Lessons from Self-Hosting LibreChat (Integrations, Security, Auth, API, Memory, Multi-Agent)
All articles →
Ready to build?

Turn your process into an AI system

Fixed price. Production quality. DACH B2B focus.

Start a project → ← All articles