Gateway Idle Policy Protocol • AI Agent SDK
GatewayIdlePolicyProtocol: Protocol for gateway-process idle/scale-to-zero decisions.
GatewayIdlePolicyProtocol
Defined in the protocols module.
AI Agent
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
Return whether dormancy may be armed at all.
is_idle()Return an :class:IdleDecision for the supplied facts.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 4148