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

# Spawn Diagnostic • AI Agent SDK

> spawn_diagnostic: Fire-and-forget a detached diagnostic into ``log_dir``.

# spawn\_diagnostic

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**ShutdownForensicsProtocol**](../classes/ShutdownForensicsProtocol) class in the [**protocols**](../modules/protocols) module.

Fire-and-forget a detached diagnostic into `log_dir`.

Must never raise and must not block the caller; the diagnostic runs in
a detached session so it survives a `SIGKILL` on the process group.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def spawn_diagnostic(ctx: Dict[str, Any], log_dir: Optional[str]) -> None
```

## Parameters

<ParamField query="ctx" type="Dict[str, Any]" required={true}>
  No description available.
</ParamField>

<ParamField query="log_dir" type="Optional[str]" required={true}>
  No description available.
</ParamField>

## Source

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