> ## 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**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

AI Agent

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

> [card] [evaluate()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/LifecycleCommandPolicyProtocol-evaluate.md)
>
> Return a :class:`LifecycleCommandDecision` for `command`.

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L6932)
>
> `praisonaiagents/gateway/protocols.py` at line 6932


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.