Is Supervised • AI Agent SDK

is_supervised: Return whether the process appears to run under a service manager.

is_supervised

Function

</div>

This function is defined in the protocols module.

Return whether the process appears to run under a service manager.

Pure predicate. A process is considered supervised when either:

  • its parent is PID 1 (`ppid == 1` — reparented to init / the container
  • entrypoint), or
  • the systemd `INVOCATION_ID` environment variable is present (the unit
  • was started by systemd).

Signature

python
def is_supervised(ppid: Optional[int], invocation_id: Optional[str]) -> bool

Parameters

ParamField Optional[int]

The parent PID, or `None` when unavailable.

ParamField Optional[str]

The value of `$INVOCATION_ID, or None`/empty.

Returns

ResponseField bool

`True` when either supervision signal is present.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 5815