> ## 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 Idle Policy Protocol • AI Agent SDK

> GatewayIdlePolicyProtocol: Protocol for gateway-process idle/scale-to-zero decisions.

# GatewayIdlePolicyProtocol

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

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

Protocol for gateway-process idle/scale-to-zero decisions.

Pure, import-free decision contract consumed by the wrapper's
`BotOS` run-loop. The wrapper supplies live facts (running turns,
last inbound timestamp, background-work flag) and the policy decides
whether the whole gateway may safely stand down. Concrete drivers
(suspend the compute host, stand transports down, register a wake
URL) live in the wrapper; this contract keeps the *decision* testable
in isolation without a live gateway.

A config-driven default (:class:`ScaleToZeroPolicy`) is provided for
the common "idle for N minutes with nothing in flight" case.

## Methods

<CardGroup cols={2}>
  <Card title="should_arm()" icon="function" href="../functions/GatewayIdlePolicyProtocol-should_arm">
    Return whether dormancy may be armed at all.
  </Card>

  <Card title="is_idle()" icon="function" href="../functions/GatewayIdlePolicyProtocol-is_idle">
    Return an :class:`IdleDecision` 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#L2916">
  `praisonaiagents/gateway/protocols.py` at line 2916
</Card>

***

## Related Documentation

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