MemoryPressurePolicy
Defined in the protocols module.AI Agent Config-driven RSS-threshold resource-pressure policy. The default wired by the
max_rss_mb gateway config key
(BotOS(max_rss_mb=...) / gateway.yaml) and the
AdmissionGate(resource_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 live sampler and the side effects
(queue / shed / busy ack).
The decision, given a sample’s rss_mb:
ADMITwhilerss_mb < soft_rss_mb(or the platform can’t report memory, sorss_mb is None— never block on a missing signal).QUEUE(apply backpressure) whilesoft_rss_mb <= rss_mb < hard_rss_mb.REJECT(shed with a busy ack) whilerss_mb >= hard_rss_mb.
hard_rss_mb of 0 disables pressure-based shedding entirely
(every sample admits) — the legacy default when no threshold is set.
Example::
Constructor
float
default:"0.0"
No description available.
float
default:"0.0"
No description available.
Methods
enabled()
Whether pressure-based admission is active (a threshold is set).
evaluate()
Instance method.
Source
View on GitHub
praisonaiagents/gateway/protocols.py at line 3380
