Skip to main content

BotMessage

Defined in the protocols module.
AI Agent Represents a message in a messaging platform. Attributes: message_id: Platform-specific message identifier content: Message content (text or structured data) message_type: Type of message sender: User who sent the message channel: Channel where the message was sent timestamp: Message timestamp reply_to: ID of message being replied to thread_id: Thread identifier (for threaded conversations) attachments: List of attachment URLs or data quoted: Resolved reply/quote context (see :class:QuotedRef). When a user replies to or quotes an earlier message the adapter resolves the referenced content and attaches it here so the agent sees the referent instead of answering context-blind. Rendered into the prompt as a quoted block by :meth:prompt_text. metadata: Additional platform-specific metadata allow_control: Control-trust primitive. True (the default) only for interactive human turns; producers set it False for content of untrusted or non-interactive provenance (generic webhook payloads, relayed/mirrored bot-authored content, proactive/wake/scheduler injects). When False the message is never classified as a gateway control command (is_command returns False), even if its text starts with / and it is attributed to a privileged identity — it is handled as plain text instead.

Properties

str
No description available.
Union
No description available.
MessageType
No description available.
Optional[BotUser]
No description available.
Optional[BotChannel]
No description available.
float
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
List
No description available.
Optional[QuotedRef]
No description available.
Dict[str, Any]
No description available.
bool
No description available.

Methods

text()

Get message text content.

prompt_text()

Text for the agent turn, with any resolved quote rendered inline.

is_command()

Check if message is a gateway control command.

command()

Extract command name if this is a command message.

command_args()

Extract command arguments if this is a command message.
  • from_dict: Create from dictionary.
  • to_dict: Convert to dictionary.

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 538