Resource Pressure Policy Protocol • AI Agent SDK
ResourcePressurePolicyProtocol: Protocol for memory/resource-aware admission decisions.
ResourcePressurePolicyProtocol
Defined in the protocols module.
AI Agent
Protocol for memory/resource-aware admission decisions.
Pure, import-free decision contract consumed by the wrapper’s admission gate. The wrapper samples its own resource usage on a lightweight cadence and hands the policy a :class:ResourceSample; the policy returns an :class:AdmissionDecision — `ADMIT below the soft threshold, QUEUE to apply backpressure above it, and REJECT above the hard threshold so the process sheds load before the OOM killer fires. Sampling and enforcement (the asyncio.Semaphore ceiling and bounded wait queue) live in the wrapper; this keeps the decision provable in isolation, symmetric with :class:GatewayConcurrencyPolicyProtocol`.
A config-driven default (:class:MemoryPressurePolicy) is provided for the common “soft/hard RSS threshold” case.
Methods
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 4784