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

# Lifecycle Command Policy Protocol • AI Agent SDK

> LifecycleCommandPolicyProtocol: Protocol for guarding an agent from stopping its own gateway.

# LifecycleCommandPolicyProtocol

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

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

Protocol for guarding an agent from stopping its own gateway.

Pure, import-free decision contract consulted by the wrapper *before* a
shell/CLI tool executes and *before* a scheduled job is registered. The
wrapper supplies the resolved command string (and, when a script file is
involved, its text); the policy returns a :class:`LifecycleCommandDecision`
that either allows the command or refuses it because its effect is to
stop / restart / reload / kill *this* gateway process. Concrete pattern
sets are swappable (a plugin may supply a richer one); this contract keeps
the *decision* testable in isolation, symmetric with
:class:`SendPolicyProtocol` / :class:`GatewayConcurrencyPolicyProtocol`.

A config-driven default (:class:`LifecycleCommandGuardPolicy`) is provided
for the common `praisonai gateway stop` / `pkill … gateway` /
`systemctl stop &lt;unit&gt;` case.

## Methods

<CardGroup cols={2}>
  <Card title="evaluate()" icon="function" href="../functions/LifecycleCommandPolicyProtocol-evaluate">
    Return a :class:`LifecycleCommandDecision` for `command`.
  </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#L4958">
  `praisonaiagents/gateway/protocols.py` at line 4958
</Card>
