ScaleToZeroPolicy
Defined in the protocols module.AI Agent Config-driven idle policy for safe scale-to-zero. The default referenced by
scale_to_zero: blocks in gateway.yaml
and the BotOS(..., idle_policy=...) Python surface. It is
intentionally minimal and dependency-free so the decision lives in
core and is provable in isolation; the wrapper owns the side effects
(suspend host, stand transports down, wake endpoint).
The gateway is considered idle only when all guards pass:
- no in-flight agent turn (
running_turns == 0), - no live background work (scheduled jobs, delegated subagents,
durable outbox drains —
has_background_workisFalse), - no inbound message for at least
idle_timeout_minutes.
Constructor
float
default:"5.0"
No description available.
Optional[str]
No description available.
bool
default:"True"
No description available.
Methods
idle_timeout_seconds()
Instance method.
should_arm()
Instance method.
is_idle()
Instance method.
Source
View on GitHub
praisonaiagents/gateway/protocols.py at line 2957
