Skip to main content
Set gateway.push.redis and every replica of your gateway shares one brute-force budget, so max_attempts on login and approval is a cluster-wide total β€” not a per-replica one.

Quick Start

1

Single replica β€” nothing to do

One gateway process already enforces the limits correctly with the in-process AuthRateLimiter.
2

Multiple replicas β€” set gateway.push.redis

The auth limiters pick up the gateway’s push Redis automatically. There is no extra knob.
3

Or wire it in Python

Pass a RedisConfig on GatewayConfig.push where you construct the gateway.
On a 3-replica gateway, the magic-link budget of 5 attempts is now 5 in total. Without Redis it is roughly 15 β€” 5 per replica.

How It Works

Every attempt runs one atomic Lua script on Redis: check the lockout key, INCR the bucket, set its window TTL, and set a lockout once the budget is exceeded. All replicas hit the same keys, so counts never race.

Covered endpoints

Keys are namespaced as {prefix}authrl:{endpoint}:{identity}:b (bucket) and {prefix}authrl:{endpoint}:{identity}:l (lockout), where {prefix} is push.redis.prefix (default praison:push:). Both expire via Redis TTLs, so nothing needs pruning.

Redis Outage Behaviour

The limiter never fails open. If Redis is unreachable it falls back to a local per-replica limiter, so per-replica limits still apply.

Configuration Options

The limiter reuses the gateway’s push RedisConfig β€” no separate auth-limiter Redis knob.
Deliberately out of scope β€” these stay per-replica by design:
  • UnauthorizedFloodGuard β€” per-connection; a connection only lives on one replica.
  • PreauthConnectionBudget β€” guards each replica’s own socket resources.
  • PairingStore’s in-chat lockout β€” built in many bot constructors without gateway config; gateway pairing HTTP routes are already covered through _approval_rate.
This is not the agent-level rate_limiter on ExecutionConfig. That one paces LLM requests β€” see Rate Limiter. This page covers brute-force protection on gateway auth endpoints.

Best Practices

On a multi-replica gateway, the same push.redis block also backs the turn lock and the idempotency store. Configure all three together so every piece of shared state is cluster-wide.
The auth limiter auto-shares push.redis. Configure Redis once; do not duplicate the connection.
A lockout earned against the local fallback stays in force after Redis comes back, so a locked-out IP stays locked out until its local lockout expires.
If you installed without the redis package, the gateway still boots but logs gateway.push.redis set but Redis auth rate limiter unavailable. Install it with pip install redis to get cluster-wide limits.

Gateway Turn Lock

Sibling shared state β€” a distributed lease that serialises a session’s turns.

Cross-Replica Idempotency

Sibling shared state β€” exactly-once webhook admission on the same Redis.

Redis Pub/Sub Resilience

Same Redis β€” reconnect and outage surfacing for cross-instance delivery.

Gateway Edge Protections

The per-replica guards that stay in-process by design.