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

# Current Epoch • AI Agent SDK

> current_epoch: Return a stable identifier for the current OS *instantiation*.

# current\_epoch

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**protocols**](../modules/protocols) module.

Return a stable identifier for the current OS *instantiation*.

The epoch combines the most durable, restart-distinguishing signals
available so a drain marker can be tied to the instantiation that wrote
it. It is derived from (best-effort, in order of preference):

* the kernel boot id (Linux `/proc/sys/kernel/random/boot_id`), which
  changes on every reboot, and
* the start time of PID 1 (the init process), which also changes on every
  boot / container (re)start.

On platforms where neither is available the function degrades gracefully
to an empty string; callers that cannot determine an epoch should treat
*every* marker as foreign (fail-safe: ignore stale-looking requests) by
pairing this with :class:`DrainMarkerPolicy`, which ignores markers whose
epoch does not match the current one.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def current_epoch() -> str
```

### Returns

<ResponseField name="Returns" type="str">
  \<pid1\_start>"`) when
        *both* signals are available, or an empty string otherwise. Requiring
        both keeps the contract fail-closed: a partial epoch (e.g. `boot\_id\`\`
  alone, which is unchanged across same-host container restarts) could
  let a durable stale marker match a fresh instance, so it is never
  emitted.
</ResponseField>

## Uses

* `fh.read`
* `raw.rsplit`

## Source

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