Skip to main content

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

evaluate()

Return an :class:AdmissionDecision for the supplied sample.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 3358