On Message • AI Agent SDK

on_message: Register a message handler.

on_message

Method

</div>

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

Register a message handler.

Signature

python
def on_message(handler: Callable[[BotMessage], Any]) -> Callable

Parameters

ParamField Callable

Function to call when a message is received

Returns

ResponseField Callable

The handler function (for decorator use)

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 1180