Skip to main content

LifecycleRecord

Defined in the protocols module.
AI Agent 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

Literal
No description available.
Literal
No description available.
bool
No description available.
Optional[float]
No description available.
List[float]
No description available.
  • from_dict: Rebuild from a persisted dict, tolerating partial/legacy shapes.
  • to_dict: Convert to a JSON-serializable dict for the durable sentinel.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4824