What Are Velocity Rules and How Do They Stop Runaway Agent Spending?
TL;DR
- Velocity rules cap the number of transactions an agent can attempt within a time window — per minute, per hour, per day.
- They're the simplest, fastest-firing defense against three failure modes: runaway loops, compromised credentials, and prompt-injection attacks.
- Tune the cap to "agent normal × 1.5-2x" — high enough not to choke legitimate traffic, low enough to catch anomalies.
A velocity rule is "no more than N transactions in W time window." It's a circuit breaker, not a policy decision. When an agent goes off the rails — runaway loop, compromised credential, prompt injection telling it to drain a budget fast — velocity is what stops it before serious damage is done.
What's the rule actually doing?
For every transaction request, count how many transactions this agent has attempted in the last W minutes/hours/days. If the count would exceed the cap, decline.
Concretely:
``json
{
"velocity_per_minute": 5,
"velocity_per_hour": 60,
"velocity_per_day": 500
}
`
Three caps composed: 5/minute, 60/hour, 500/day. Each enforced independently. Hit any one, decline with reason velocity_exceeded.
Why three windows?
Different attack speeds need different windows:
- Per minute catches runaway loops and rapid prompt-injection attacks.
- Per hour catches more patient attackers throttling to evade per-minute caps.
- Per day catches slow-drip attacks that stay under both shorter caps but accumulate.
A single window doesn't cover all timescales. Three composed windows do.
What are typical caps?
Depends entirely on the agent type. Production patterns:
| Agent type | Per minute | Per hour | Per day |
|------------|-----------|----------|---------|
| Travel agent (low velocity) | 2 | 10 | 30 |
| SaaS procurement agent | 3 | 20 | 100 |
| Research agent (paywalled content) | 10 | 200 | 1000 |
| Shopping assistant | 5 | 60 | 300 |
| MCP-call agent | 30 | 500 | 5000 |
Tune for "normal × 1.5-2x". Too tight → choke legitimate bursts. Too loose → don't catch attacks fast enough.
How do velocity rules compare to amount caps?
| | Velocity rule | Amount cap |
|--|---------------|------------|
| Catches | Volume-based attacks | Magnitude attacks |
| Tightening cost | False positives in busy periods | False positives at normal high-value transactions |
| Where it fires | Runaway loops, prompt injection | Single bad transaction |
Both. Compose them. An agent with $500/transaction cap + 5/minute velocity cap is bounded at $2500/minute worst case.
What happens when velocity is exceeded?
Three things, in order:
- Back off (correct behavior).
- Escalate to a human (if the velocity was unexpected — possible compromise).
The agent isn't paused. Velocity throttles, doesn't kill. If you want a kill switch, use the emergency-stop flag (which freezes all cards under the agent).
Can velocity rules cause false positives?
Yes — most commonly during legitimate bursts:
- Page-load batches. Agent fires 30 API calls to render a results page; if those involve transactions (paid MCP server queries), velocity may fire.
- Backfill operations. Agent re-processes historical data or migrates between merchants.
- Sudden user demand. End user kicks off a big task that drives the agent into burst mode.
Mitigation:
- Per-task velocity exception (an agent can request elevated velocity for a specific task with a higher-bar approval).
- Burst allowance (e.g. allow 2x normal for 30 seconds before throttling).
- Tune per agent: adjust the cap up after seeing legitimate burst patterns.
What does this look like in the policy engine?
Velocity is a O(1) check via Redis-backed counter:
Latency cost: ~1-2ms per check. Three windows: ~5ms. Fits comfortably in the 100ms auth budget.
What about velocity at the policy / publisher / user level?
Three additional levels worth considering:
- Per policy: all agents under one policy share a velocity cap. Catches publisher-level compromises.
- Per publisher: all agents from one publisher share a higher cap. Catches platform-level issues.
- Per user: all agents serving one user share a cap. Catches user-account-takeover-driven attacks.
Composing these (per-agent + per-policy + per-user) gives layered defense without choking individual agents.
FAQ
What's the smallest meaningful window?
30 seconds. Below that, ordinary network latency variation makes the cap unstable. Above 30s is workable.
Can velocity caps be adjusted dynamically?
Yes — policy edits create new versions; new transactions evaluate against the latest. In-flight transactions use the version they were issued under.
What if my agent has legitimate burst patterns I can't shape?
Set the cap at the burst peak + 50% headroom. Use longer-window caps (per hour, per day) to catch sustained issues without choking the bursts.
Do velocity rules interact with fraud scoring?
Yes — fraud models use velocity as a signal among others. A velocity-exceeded transaction also factors into the fraud score. The rules are deterministic; fraud is probabilistic; both run.
Can attackers bypass velocity caps by spreading across multiple agents?
That's what per-publisher and per-user velocity caps catch. Attackers compromising one agent hit the per-agent cap; trying to spread to multiple agents under the same user hits the per-user cap.
Related reading
- [How We Built a 100ms Policy Engine for AI Agent Transactions](/blog/building-spending-controls-for-ai-agents) — engine implementation
- [How to Let AI Agents Make Payments Safely](/blog/let-ai-agents-pay-safely) — full safety model
- [Agent-Aware Fraud Detection](/blog/agent-aware-fraud-detection) — probabilistic complement
External references
- [Visa Velocity Limit rules](https://developer.visa.com) — network-level velocity context
- [PCI DSS v4.0 Section 8 (transaction monitoring)](https://www.pcisecuritystandards.org/) — relevant regulation
---
By Vlad K.. Last updated 2026-04-29.