Guardian - anti-loop system
Per-workspace rules to block runaway agents, duplicate traffic and cost spikes.
Guardian is HiWay's always-on safety net. It watches every request in near real time and blocks the failure modes that bankrupt agent-heavy workloads: runaway loops, duplicate requests, cost spikes, context bloat, zombie agents and rate limit abuse. Every rule is editable per workspace in Dashboard → Guardian.
The rules
| Rule | Trigger | Default action |
|---|---|---|
| Dedup | Same prompt hash, same key, 3+ times in 60s | Block 4th request, alert |
| Cost spike | 10× your 24h rolling average upstream cost in under 5 minutes | Throttle to 1 req/s, alert |
| Context bloat | Prompt tokens > configurable ceiling (default 50k) | Reject with 413 |
| Zombie agent | Same key looping 30+ minutes with no output variation | Suspend the key, alert |
| Rate limit | Per-key RPM exceeded | Return 429 with Retry-After |
Guardian runs before routing
Guardian blocks happen before the request touches a provider, so blocked requests do not count against your monthly quota and do not incur upstream BYOK cost.
What a block looks like
json
{
"error": {
"code": "guardian_block",
"message": "Blocked by Guardian: dedup (3 identical prompts in 47s)",
"rule": "dedup",
"retry_after_seconds": 60
}
}