AgentTrafficCop Get started →
v0.1.0 · now available on PyPI

Stop AI agents from burning money in loops.

AgentTrafficCop is a runtime circuit breaker for multi-agent systems. It validates every handoff, fingerprints every payload, and trips before a loop empties your API budget.

View on GitHub ↗
python demo.py
$ python demo.py ────────────────────────────────────────────── RUN 1 · WITHOUT AgentTrafficCop ────────────────────────────────────────────── coder → reviewer {diff: 'rename foo to bar'} reviewer → coder {feedback: 'add a docstring'} coder → reviewer {diff: 'add null check'} reviewer → coder {feedback: 'handle empty case'} ... 20 more rounds ... ✗ no breaker · 24 messages · cost: $0.10 ────────────────────────────────────────────── RUN 2 · WITH AgentTrafficCop ────────────────────────────────────────────── coder → reviewer {...} ✓ step=1 reviewer → coder {...} ✓ step=2 coder → reviewer {...} ✓ step=3 reviewer → coder {...} ✗ CYCLIC_PAYLOAD_LOOP 🛑 CIRCUIT BREAKER TRIPPED error_code : CYCLIC_PAYLOAD_LOOP session : demo-loop step : 8 ✓ session halted · 8 messages · cost: $0.03 ✓ saved vs run 1: $0.07
Built with
FastAPI Pydantic v2 Redis Docker LangGraph Python 3.11+

Three primitives,
sitting between your agents.

01

Schema shield

Every handoff validated against a strict Pydantic v2 contract before it reaches the next agent. Malformed payloads are rejected at the door.

02

Loop detection

SHA-256 fingerprinting on every payload. Identical repeats and A↔B ping-pongs trip the breaker. Step counters catch the rest.

03

Circuit breaker

When thresholds breach, the response carries structured diagnostics. Your orchestrator decides: halt, alert, or escalate.

Five lines to add it
to your orchestrator.

your_orchestrator.py Python
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)

Runs as a standalone FastAPI service. Works with LangGraph, CrewAI, AutoGen, or raw asyncio. The SDK ships a LangGraph adapter — wrap any node in one line.

Tested, observable,
hardened.

194
Tests
Passing in CI on every commit
SHA-256
Fingerprinting
Deterministic payload hashing
Redis
Or memory
Pluggable session store
MIT
License
Open source, on PyPI

Free to start.
Scale when you need to.

The middleware and SDK are open source and self-hostable today. Managed tiers are coming soon.

Free
$0
forever
  • 10,000 messages / month
  • Single instance
  • Self-hosted
  • Community support
Get started
Team
$199/mo
coming soon
  • 2M messages / month
  • 1-year audit log
  • Priority support
  • Slack Connect
Contact
Enterprise
Custom
talk to us
  • Unlimited messages
  • SSO / SAML
  • On-prem or VPC
  • DPA, BAA
Contact

Try it in sixty seconds.

One command to install. Three lines to integrate. Zero runtime dependencies.