async def run(self, with_message=None) -> Message | None:
"""Observe, and think and act based on the results of the observation"""
if isinstance(with_message, str):
msg = Message(content=with_message)
elif isinstance(with_message, Message):
elif isinstance(with_message, list):
msg = Message(content="\n".join(with_message))
msg.cause_by = UserRequirement
if not await self._observe():
# If there is no new information, suspend and wait
logger.debug(f"{self._setting}: no news. waiting.")
rsp = await self.react()
# Reset the next action to be taken.
# Send the response message to the Environment object to have it relay the message to the subscribers.
self.publish_message(rsp)