Evaluate Pressure • AI Agent SDK

evaluate_pressure: Pure, deterministic classification of gateway load. No I/O.

evaluate_pressure

Function

</div>

This function is defined in the protocols module.

Pure, deterministic classification of gateway load. No I/O.

Reads back facts the enforcement layer already computes (`AdmissionGate.stats(), the outbox status counts, the watchdog's measured lag) and folds them into a single :class:HealthPressure. Lives in core — like :func:compute_config_revision` — so the SDK and the bot classify identically without divergence.

Classification (highest wins):

  • `"saturated"` — admission is full and work is queuing, the outbound
  • dead-letter tier is non-empty, or the event loop is lagging badly
  • (`&gt;= 500 ms`): shed / stall is imminent or occurring.
  • `"elevated" — admission is highly utilised (&gt;= 80 %`), the inbound
  • or outbound backlog is building, or the loop is lagging (`&gt;= 100 ms`).
  • `"nominal"` — none of the above.

Signature

python
def evaluate_pressure() -> HealthPressure

Returns

ResponseField HealthPressure

class:HealthPressure ready for the health surface.

Uses

  • HealthPressure

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 1659


Related Documentation