> ## 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 Config • AI Agent SDK

> LivenessConfig: Configuration for application-level connection liveness (Issue #2798).

# LivenessConfig

> Defined in the [**config**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/config.md) module.

AI Agent

Configuration for application-level connection liveness (Issue #2798).

Drives the transport-agnostic ping/pong heartbeat contract: the gateway
emits a `PING` every `interval_ms` and reaps any connection whose
last activity is older than `interval_ms × missed_beats_before_reap`
(closing it with `GatewayCloseCode.LIVENESS_TIMEOUT`), while the
reference client sends heartbeats on the same cadence and force-reconnects
after a silence watchdog fires.

This maps directly onto the pure core :class:`~praisonaiagents.gateway.
protocols.LivenessPolicy`; :meth:`to_policy` builds one.

Attributes:
enabled: Toggle liveness heartbeat/reaping. When False (default),
behaviour is unchanged — `last_activity` is stamped but never
acted upon, so upgrading is fully backward-compatible.
interval\_ms: Heartbeat interval in milliseconds (advertised to clients
as `heartbeat_ms`).
missed\_beats\_before\_reap: How many consecutive missed heartbeat
intervals of silence before a connection is reaped (>= 1).

## Properties

**enabled** `bool`

No description available.

**interval\_ms** `int`

No description available.

**missed\_beats\_before\_reap** `int`

No description available.

## Methods

> [card] [to\_policy()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/LivenessConfig-to_policy.md)
>
> Build the pure core `LivenessPolicy` this config describes.

> [accordion] Internal & Generic Methods
>
> * **from\_dict**: Create from a parsed `gateway.liveness` mapping (tolerant of None).
> * **to\_dict**: Convert to dictionary.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/config.py#L718)
>
> `praisonaiagents/gateway/config.py` at line 718

***

## Related Documentation

> [card] [Configuration Overview](https://praison.ai/docs/docs/configuration/index)

> [card] [Agent Config](https://praison.ai/docs/docs/configuration/agent-config)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.