> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Liveness Policy Protocol • AI Agent SDK

> LivenessPolicyProtocol: Protocol for application-level connection-liveness decisions.

# LivenessPolicyProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

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

<ResponseField name="interval_ms" type="int">
  No description available.
</ResponseField>

<ResponseField name="missed_beats_before_reap" type="int">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="evaluate()" icon="function" href="../functions/LivenessPolicyProtocol-evaluate">
    Return a :class:`LivenessDecision` for the supplied timestamps.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5237">
  `praisonaiagents/gateway/protocols.py` at line 5237
</Card>
