> ## 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**](../modules/protocols) module.

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

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.

## Properties

<ResponseField name="max_concurrent_runs" type="int">
  No description available.
</ResponseField>

<ResponseField name="queue_depth" type="int">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="decide()" icon="function" href="../functions/GatewayConcurrencyPolicyProtocol-decide">
    Return an :class:`AdmissionDecision` 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#L3193">
  `praisonaiagents/gateway/protocols.py` at line 3193
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Gateway Feature" icon="tower-broadcast" href="/docs/docs/features/gateway" />
</CardGroup>
