Skip to main content

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:
  • ADMIT while rss_mb < soft_rss_mb (or the platform can’t report memory, so rss_mb is None — never block on a missing signal).
  • QUEUE (apply backpressure) while soft_rss_mb <= rss_mb < hard_rss_mb.
  • REJECT (shed with a busy ack) while rss_mb >= hard_rss_mb.
A 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

Memory Concept

Memory Overview

Memory Configuration

Session Resume