> ## 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.

# Gateway Concurrency Policy Protocol • AI Agent SDK

> GatewayConcurrencyPolicyProtocol: Protocol for gateway-wide inbound admission decisions.

# GatewayConcurrencyPolicyProtocol

> Defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

AI Agent

Protocol for gateway-wide inbound admission decisions.

Pure, import-free decision contract consumed by the wrapper's run-dispatch
path. The wrapper supplies the live aggregate counts (turns currently
in flight and turns currently waiting) and the policy decides whether the
next inbound turn may run now, must wait, or should be shed. Concrete
enforcement (an `asyncio.Semaphore` ceiling plus a bounded
`asyncio.Queue` with per-session fairness) lives in the wrapper, since it
needs the running event loop and live session manager; this contract keeps
the *decision* testable in isolation.

A config-driven default (:class:`ConcurrencyLimitPolicy`) is provided for
the common "N concurrent runs, bounded wait queue, declared overflow"
case.

On a shared/multi-tenant gateway the decision may additionally be scoped
by a tenant/profile token (Issue #5168), mirroring the `scope` axis of
:class:`RateLimitPolicyProtocol` / :class:`SpendBudgetPolicyProtocol` — the
wrapper passes the caller's `scope` plus the live per-scope in-flight and
queued counts so a single tenant cannot occupy every global slot. When no
per-scope sub-limit is configured the scope arguments are ignored and the
global-only decision is returned unchanged (backward compatible).

## Properties

**max\_concurrent\_runs** `int`

No description available.

**queue\_depth** `int`

No description available.

## Methods

> [card] [decide()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/GatewayConcurrencyPolicyProtocol-decide.md)
>
> Return an :class:`AdmissionDecision` for the supplied facts.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L4569)
>
> `praisonaiagents/gateway/protocols.py` at line 4569

***

## Related Documentation

> [card] [Gateway Feature](https://praison.ai/docs/docs/features/gateway)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.