A runtime circuit breaker and schema shield for multi-agent systems. Sits between your agents, catches loops before they burn tokens, and rejects malformed handoffs before they crash your pipeline.
Works with LangGraph, CrewAI, AutoGen, or raw asyncio.
A Coder agent keeps "fixing" the same thing. A Reviewer keeps asking for the same change. The loop looks like progress to a step counter, but it's silently burning $400 an hour.
Agent A sends unstructured markdown when Agent B expects JSON. The pipeline crashes, or worse, silently drops context.
Both problems cost real money. Neither is solved by prompt engineering.
Every handoff validated against a strict Pydantic contract before it reaches the next agent. No malformed payloads. No silent failures.
SHA-256 fingerprinting of every payload. Identical repeats and A↔B ping-pongs trip the breaker. Step counters catch the rest.
When thresholds are breached, returns HTTP 422 with structured diagnostics. Your orchestrator decides what to do.
from agenttrafficcop import Guard, LoopDetected
guard = Guard(url="http://localhost:8000", api_key="your-key")
try:
result = await guard.check(
session_id="run-42",
sender="coder",
recipient="reviewer",
payload={"diff": "fix typo"},
)
print("approved at step", result.step)
except LoopDetected as e:
print("loop caught:", e.error_code)
Works with LangGraph, CrewAI, AutoGen, or raw asyncio. The middleware runs as a standalone service — call it before any handoff.
The middleware and SDK are open source. The managed service is coming soon — pricing below is the plan.