Format Forensics For Log • AI Agent SDK

format_forensics_for_log: Render a forensic snapshot dict as a single, stable log line.

format_forensics_for_log

Function

</div>

This function is defined in the protocols module.

Render a forensic snapshot dict as a single, stable log line.

Pure and side-effect free so it is provable in isolation and safe to call from a signal handler. Unknown/missing fields are simply omitted; the output is a compact `key=value sequence prefixed with a stable marker so operators (and log scrapers) can grep gateway-forensics` reliably.

Signature

python
def format_forensics_for_log(ctx: Optional[Dict[str, Any]]) -> str

Parameters

ParamField Optional

The dict returned by :meth:ShutdownForensicsProtocol.snapshot, or `None`.

Returns

ResponseField str

A single-line, human-readable summary. Never raises.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 5765