Memory Pressure Policy • AI Agent SDK

MemoryPressurePolicy: Config-driven RSS-threshold resource-pressure policy.

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::

python
MemoryPressurePolicy(soft_rss_mb=400, hard_rss_mb=550)

Constructor

ParamField float

No description available.

ParamField float

No description available.

Methods

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4806


Related Documentation