def get_final_document_list(self):
    """Returns the final documents for the current step.

    Returns:
      List of documents at the end of an episode.
    """
    # If we `stop after seeing results we don't like`, we use the _previous_
    # rather than the latest results for the final reward.
    if common_flags.USE_AGGREGATED_DOCUMENTS.value == 1:
      if self.stop_after_seeing_new_results:
        return get_aggregated_documents(self.state.history[:-1])
      else:
        return get_aggregated_documents(self.state.history)
    else:
      if self.stop_after_seeing_new_results and len(self.state.history) > 1:
        return self.state.history[-2].documents
      else:
        return self.state.history[-1].documents
Returns the final documents for the current step.

    Returns:
      List of documents at the end of an episode.
    
language/search_agents/muzero/env.py