LifecycleCommandGuardPolicy
Defined in the protocols module.AI Agent Config-driven, command-anchored guard against gateway self-lifecycle hits. The default referenced by
gateway.lifecycle_guard blocks in
gateway.yaml and the BotOS(..., lifecycle_policy=...) Python
surface. It is intentionally minimal and dependency-free so the decision
lives in core and is provable in isolation; the wrapper owns the consult
points (shell-tool executor, scheduler job registration) and the audit log.
Matching is structural, not prose-based, to avoid false positives on
ordinary English (e.g. “please stop the gateway from spamming”):
praisonai gateway stop|restart|reload— the CLI self-control verbs, matched only whenpraisonaiandgatewayappear as adjacent command tokens followed by a lifecycle verb.pkill/kill/killallnaming the gateway (a configuredprocess_namestoken —praisonaiby default — appearing as a whole component in the argument list or a-fpattern).systemctl/launchctl/scstop/restart/killon a unit whose name mentions the gateway (same whole-component match).
api-gateway, kong-gateway) are not
tripped, while the real praisonai-gateway unit still matches.
The scan is applied to every ;/&&/||/pipe-separated segment of
the command and to any additional script text supplied, so a command that
shells out to a wrapper script cannot smuggle the intent past the guard.
default_allow is a fail posture: on any internal parsing error the guard
keeps today’s behaviour (allow) unless default_allow=False is set for a
strict, fail-closed deployment. enabled=False disables the guard
entirely (an operator who legitimately wants an agent to manage the
process).
Example::
Constructor
bool
default:"True"
No description available.
Optional
No description available.
bool
default:"True"
No description available.
Methods
evaluate()
Return a :class:
LifecycleCommandDecision for command.Source
View on GitHub
praisonaiagents/gateway/protocols.py at line 4986
