Skip to main content

LivenessPolicyProtocol

Defined in the protocols module.
AI Agent Protocol for application-level connection-liveness decisions. Pure, import-free decision contract consumed by the wrapper’s gateway (heartbeat-emit + reaper task) and the reference client (heartbeat-send + silence watchdog). The caller supplies the connection’s last-activity timestamp and the current time; the policy returns a :class:LivenessDecision. Concrete transport machinery (sending the PING frame, closing the socket, forcing a reconnect) lives in the implementations, since it needs the running event loop and live sockets; this contract keeps the decision testable in isolation, symmetric with :class:GatewayDrainPolicyProtocol / :class:RateLimitPolicyProtocol. A config-driven default (:class:LivenessPolicy) is provided for the common “heartbeat every interval_ms, reap after N missed beats” case.

Properties

int
No description available.
int
No description available.

Methods

evaluate()

Return a :class:LivenessDecision for the supplied timestamps.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 5237