Liveness Policy Protocol • AI Agent SDK
LivenessPolicyProtocol: Protocol for application-level connection-liveness decisions.
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
intNo description available.
intNo description available.
Methods
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 7211