Skip to main content

LifecycleCommandPolicyProtocol

Defined in the protocols 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 <unit> case.

Methods

evaluate()

Return a :class:LifecycleCommandDecision for command.

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 4958