> ## 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.

# Lifecycle Record • AI Agent SDK

> LifecycleRecord: Durable, boot-scoped snapshot of the gateway process's lifecycle.

# LifecycleRecord

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

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

Durable, boot-scoped snapshot of the gateway process's lifecycle.

Written by the runtime at boot (`phase="running"`) and on a graceful stop
(`phase="exited"`), with a memory sample folded in by the heartbeat. On
the *next* boot the runtime reads the prior record and runs
:func:`classify_unclean_exit`: a record still marked `running` means the
previous process never reached its graceful-stop path — an unclean exit,
and (given a high last memory sample) a suspected OOM-kill.

Pure and JSON-round-trippable so both the durable store and the health
surface share one shape; the wrapper owns persistence.

Attributes:
phase: `"running"` | `"draining"` | `"exited"` — the last phase
the process recorded for itself.
exit\_kind: `"clean"` | `"unclean"` | `"unknown"` — set by
:func:`classify_unclean_exit` on the *next* boot (never
`"unknown"`-treated-as-healthy downstream).
suspected\_oom: `True` when an unclean exit coincided with a high last
memory sample (memory pressure at death).
last\_mem\_fraction: Last sampled memory-budget fraction in `[0, 1]`, or
`None` when the platform could not report it.
restart\_events: Persisted monotonic-independent wall-clock timestamps of
restart-worthy boots, for :class:`PersistentRestartLoopGuard`.

## Properties

<ResponseField name="phase" type="Literal">
  No description available.
</ResponseField>

<ResponseField name="exit_kind" type="Literal">
  No description available.
</ResponseField>

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

<ResponseField name="last_mem_fraction" type="Optional[float]">
  No description available.
</ResponseField>

<ResponseField name="restart_events" type="List[float]">
  No description available.
</ResponseField>

<Accordion title="Internal & Generic Methods">
  * **from\_dict**: Rebuild from a persisted dict, tolerating partial/legacy shapes.
  * **to\_dict**: Convert to a JSON-serializable dict for the durable sentinel.
</Accordion>

## Source

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