class_docstr: Simple interactive world involving just two agents talking.
  
  In more sophisticated worlds the environment could supply information, e.g. in
  tasks/convai2 both agents are given personas, so a world class should be written
  especially for those cases for given tasks.
docstr: Agent 0 goes first.
  
  Alternate between the two agents.
docstr_tok: ["Agent","0","goes","first",".","Alternate","between","the","two","agents","."]
code: def parley(self):
      """
      Agent 0 goes first.
  
      Alternate between the two agents.
      """
      if self.turn_cnt == 0:
          self.p1, self.p2 = self.get_contexts()
  
      acts = self.acts
      agents = self.agents
      if self.turn_cnt == 0 and self.p1 != "":
          # add the context on to the first message to agent 0
          context_act = Message(
              {"id": "context", "text": self.p1, "episode_done": False}
          )
          agents[0].observe(validate(context_act))
      try:
          act = deepcopy(agents[0].act())
      except StopIteration:
          self.reset()
          self.finalize_episode()
          self.turn_cnt = 0
          return
      acts[0] = act
      if self.turn_cnt == 0 and self.p2 != "":
          # add the context on to the first message to agent 1
          context_act = Message(
              {"id": "context", "text": self.p2, "episode_done": False}
          )
          agents[1].observe(validate(context_act))
      agents[1].observe(validate(act))
      acts[1] = agents[1].act()
      agents[0].observe(validate(acts[1]))
      self.update_counters()
      self.turn_cnt += 1
  
      if act["episode_done"]:
          self.finalize_episode()
          self.turn_cnt = 0
  
file_path: ParlAI/parlai/tasks/interactive/worlds.py
imports: from copy import deepcopy
  from typing import Optional
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.worlds import DialogPartnerWorld, validate
  from parlai.core.message import Message
label_desc: Use image node_id 6 for calling the InteractiveWorld obj's underlying member method code with example usage: obj.parley() without return types