> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Pressure Policy • AI Agent SDK

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

# MemoryPressurePolicy

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

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 &lt; 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 &lt;= rss_mb &lt;
  hard_rss_mb`.
* `REJECT` (shed with a busy ack) while `rss_mb &gt;= 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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
MemoryPressurePolicy(soft_rss_mb=400, hard_rss_mb=550)
```

## Constructor

<ParamField query="soft_rss_mb" type="float" required={false} default="0.0">
  No description available.
</ParamField>

<ParamField query="hard_rss_mb" type="float" required={false} default="0.0">
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="enabled()" icon="function" href="../functions/MemoryPressurePolicy-enabled">
    Whether pressure-based admission is active (a threshold is set).
  </Card>

  <Card title="evaluate()" icon="function" href="../functions/MemoryPressurePolicy-evaluate">
    Instance method.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L3380">
  `praisonaiagents/gateway/protocols.py` at line 3380
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Memory Concept" icon="brain" href="/docs/docs/concepts/memory" />

  <Card title="Memory Overview" icon="database" href="/docs/docs/memory/overview" />

  <Card title="Memory Configuration" icon="gear" href="/docs/docs/configuration/memory-config" />

  <Card title="Session Resume" icon="rotate-right" href="/docs/docs/memory/session-resume" />
</CardGroup>
