diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 80a4d6744..b6f6b7d20 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -443,6 +443,9 @@ class Role(SerializationMixin, ContextMixin, BaseModel): """If the role belongs to env, then the role's messages will be broadcast to env""" if not msg: return + if all(to in {any_to_str(self), self.name} for to in msg.send_to): # Message to myself + self.put_message(msg) + return if not self.rc.env: # If env does not exist, do not publish the message return