> ## 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**](../modules/config) module.

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

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

<ResponseField name="enabled" type="bool">
  No description available.
</ResponseField>

<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="to_policy()" icon="function" href="../functions/LivenessConfig-to_policy">
    Build the pure core `LivenessPolicy` this config describes.
  </Card>
</CardGroup>

<Accordion title="Internal & Generic Methods">
  * **from\_dict**: Create from a parsed `gateway.liveness` mapping (tolerant of None).
  * **to\_dict**: Convert to dictionary.
</Accordion>

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Configuration Overview" icon="gear" href="/docs/docs/configuration/index" />

  <Card title="Agent Config" icon="robot" href="/docs/docs/configuration/agent-config" />
</CardGroup>
