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
def on_message(handler: Callable[[BotMessage], Any]) -> CallableParameters
ParamField
CallableFunction to call when a message is received
Returns
ResponseField
CallableThe handler function (for decorator use)
Source
View on GitHubpraisonaiagents/bots/protocols.py at line 1180