> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate Limit Policy Protocol • AI Agent SDK

> RateLimitPolicyProtocol: Protocol for gateway rate-limit / throttle admission decisions.

# RateLimitPolicyProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

Protocol for gateway rate-limit / throttle admission decisions.

Pure, import-free decision contract consumed by the wrapper's admission
paths. The wrapper supplies typed facts (the caller `identity`, the
`scope` — an endpoint class, channel, or tenant token — and the current
`now` timestamp) and the policy decides whether the request is allowed
or `limited` with a `retry_after_seconds` hint. Concrete state and
enforcement (sliding windows, token buckets, a Redis-backed per-tenant
quota) live in the implementation; this contract keeps the *decision*
injectable and testable in isolation, symmetric with
:class:`SendPolicyProtocol` / :class:`GatewayConcurrencyPolicyProtocol`.

A config-driven default (:class:`SlidingWindowRateLimitPolicy`) is
provided for the common "N requests per window per identity" case; core
maps a `limited` decision onto `ConnectErrorCode.RATE_LIMITED` and
`HelloError.retry_after_seconds`.

## Methods

<CardGroup cols={2}>
  <Card title="check()" icon="function" href="../functions/RateLimitPolicyProtocol-check">
    Return a :class:`RateLimitDecision` for the supplied facts.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L3619">
  `praisonaiagents/gateway/protocols.py` at line 3619
</Card>
