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`:
- `
ADMITwhilerss_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) whilerss_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::
MemoryPressurePolicy(soft_rss_mb=400, hard_rss_mb=550)Constructor
floatNo description available.
floatNo description available.
Methods
Whether pressure-based admission is active (a threshold is set).
evaluate()Instance method.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 4806