Is Command • AI Agent SDK

is_command: Check if message is a gateway control command.

is_command

Method

</div>

This is a method of the BotMessage class in the protocols module.

Check if message is a gateway control command.

Content of untrusted or non-interactive provenance (`allow_control is False) is never interpreted as a control command, even if its text starts with / and it is attributed to a privileged identity — it is handled as plain text instead. This closes the control-plane confused-deputy gap where a webhook payload, a relayed/mirrored bot-authored message, or a proactive/wake inject could drive privileged session control (/stop, /new, /compress`, …).

Signature

python
def is_command() -> bool

Returns

ResponseField bool

The result of the operation.

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 670