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

# Shutdown Forensics Protocol • AI Agent SDK

> ShutdownForensicsProtocol: Protocol for capturing forensics when a gateway dies unexpectedly.

# ShutdownForensicsProtocol

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

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

Protocol for capturing forensics when a gateway dies unexpectedly.

Pure contract consumed by the wrapper's signal handlers. `snapshot`
must be fast (\<10ms), never raise, and never block the asyncio teardown;
`spawn_diagnostic` is fire-and-forget and must run the diagnostic in a
*detached* session so a `SIGKILL` on the process group does not also kill
the diagnostic. Concrete OS I/O (`/proc` reads, `os.getrusage`,
`os.getloadavg`, subprocess spawn) lives in the wrapper implementation.

## Methods

<CardGroup cols={2}>
  <Card title="snapshot()" icon="function" href="../functions/ShutdownForensicsProtocol-snapshot">
    Return a small, JSON-serialisable forensic context.
  </Card>

  <Card title="spawn_diagnostic()" icon="function" href="../functions/ShutdownForensicsProtocol-spawn_diagnostic">
    Fire-and-forget a detached diagnostic into `log_dir`.
  </Card>
</CardGroup>

## Source

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