> ## 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.

# Plan Pressure Evictions • AI Agent SDK

> plan_pressure_evictions: Return the ``session_id``s to soft-evict, coldest (LRU) first.

# plan\_pressure\_evictions

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Return the `session_id`s to soft-evict, coldest (LRU) first.

A pure planner: it takes the container memory *budget* (typically the
cgroup limit), the current anonymous `rss_mb` and the warm-cache
registry, and names the coldest rebuildable caches to shed until RSS is
back within `headroom_ratio` of the budget. It never touches the event
loop or the caches themselves — the gateway enacts the returned plan.

Guards (a victim is *skipped*, never evicted, when):

* `in_flight` is `True` — an executing turn must not be aborted, or
* `flushed` is `False` — an unflushed transcript is not yet rebuildable
  from the store, so evicting it would lose data.

Returns an empty list when RSS is within budget, the budget is unknown
(`None`/`&lt;= 0`), or nothing evictable remains — so a host that can't
report a cgroup limit simply never soft-evicts (legacy behaviour).

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def plan_pressure_evictions(budget_mb: Optional[float], rss_mb: float, warm_sessions: Sequence[WarmSession]) -> List[str]
```

## Parameters

**budget\_mb** `Optional[float]` *required*

No description available.

**rss\_mb** `float` *required*

No description available.

**warm\_sessions** `Sequence[WarmSession]` *required*

No description available.

### Returns

**Returns** `List[str]`

The result of the operation.

## Uses

* `math.isfinite`
* `evictable.sort`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L4949)
>
> `praisonaiagents/gateway/protocols.py` at line 4949


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.