class_docstr: Base class for a person on messenger that can act in a ParlAI world.
class_docstr_tok: ["Base","class","for","a","person","on","messenger","that","can","act","in","a","ParlAI","world","."]
docstr: Send an agent a message through the mturk manager.
docstr_tok: ["Send","an","agent","a","message","through","the","mturk","manager","."]
code: def observe(self, act):
      """
      Send an agent a message through the mturk manager.
      """
      if "payload" in act:
          resp = self.manager.observe_payload(
              self.id,
              act["payload"],
              act.get("quick_replies", None),
              act.get("persona_id", None),
          )
      else:
          if act["id"] != "":
              msg = "{}: {}".format(act["id"], act["text"])
          else:
              msg = act["text"]
          resp = self.manager.observe_message(
              self.id,
              msg,
              act.get("quick_replies", None),
              act.get("persona_id", None),
          )
      try:
          mid = resp[0]["message_id"]
          if mid not in self.observed_packets:
              self.observed_packets[mid] = act
      except Exception:
          print(
              "{} could not be extracted to an observed message".format(
                  resp
              )
          )
  
file_path: ParlAI/parlai/chat_service/services/messenger/agents.py
imports: import time
  from parlai.chat_service.core.agents import ChatServiceAgent
label_desc: Use image node_id 2 for calling the MessengerAgent obj's underlying member method code with example usage: obj.observe(act) without return types