Skip to main content
The Quota Coordinator lets multiple replicas share credential cooldowns — when one replica benches an API key after a 429, every replica skips it until the cooldown expires.
The Quota Coordinator symbols live in praisonaiagents.llm: from praisonaiagents.llm import LocalQuotaCoordinator. Agent, AuthProfile, and FailoverManager import from the top-level praisonaiagents package.

Quick Start

1

Default (single replica)

2

Attach a coordinator

3

Share across managers in one process

4

Bring your own backend (replicas > 1)


How It Works

Replica A hits a 429, benches the credential, then replica B skips the benched key based on the shared coordinator state.

Choosing a Backend

Pick a coordinator based on how many replicas run and whether you have a shared store.

Configuration Options

QuotaCoordinatorConfig selects the backend.
QuotaCoordinatorProtocol defines the contract every coordinator implements.

Key Behaviours

Each behaviour is enforced by the SDK and covered by tests.
Never wrap coordinator calls in your own catch/retry blocks. A coordinator outage degrades to local behaviour automatically — extra retries only add latency.

Credential Identity

Benches key on the credential, not the profile label, so two profiles named "default" with different keys stay independent.

Best Practices

Single-replica or single-process deployments do not need to set anything — leave coordinator unset and FailoverManager uses a private in-memory coordinator.
Pass one LocalQuotaCoordinator to every FailoverManager in the process so all agents observe each other’s benches.
The concrete Redis coordinator ships in the wrapper/bot package to keep core dependency-free. Wire it up via config and pass the instance to FailoverManager(coordinator=...).
A coordinator outage logs a warning and degrades to local behaviour — never write catch/retry blocks around coordinator calls at the call site.

Failover

Automatic fallback between LLM providers

Rate Limiter

Throttle requests to stay within provider limits

LLM Error Classification

Typed errors that drive failover decisions

Thread Safety

Share a credential pool across concurrent agents