def _get_interscene_messages(
    key: str,
    agent_name: str,
    scene_type_spec: scene_lib.SceneTypeSpec,
) -> list[str]:
  """Get messages to for both players and game master before and after a scene.

  Args:
    key: either get the scene's `premise` or its `conclusion` messages. Each
      message should be a string.
    agent_name: get interscene messages for which agent
    scene_type_spec: configuration of the scene

  Returns:
    messages: a list of strings to report.
  """
  if key == 'premise':
    section = scene_type_spec.premise if scene_type_spec.premise else {}
  elif key == 'conclusion':
    section = scene_type_spec.conclusion if scene_type_spec.conclusion else {}
  else:
    raise ValueError(f'Unknown key: {key}')
  raw_messages = section.get(agent_name, [])

  messages = []
  for raw_message in raw_messages:
    if isinstance(raw_message, str):
      result = raw_message
      messages.append(result)

  return messages
Get messages to for both players and game master before and after a scene.

  Args:
    key: either get the scene's `premise` or its `conclusion` messages. Each
      message should be a string.
    agent_name: get interscene messages for which agent
    scene_type_spec: configuration of the scene

  Returns:
    messages: a list of strings to report.
  
concordia/environment/scenes/runner.py