This article reports on a study investigating how computational essays can be used to redistribute epistemic agency--cognitive control and responsibility over ones own learning--to students in higher education STEM. Computational essays are a genre of scientific writing that combine live, executable computer code with narrative text to present a computational model or analysis. The study took place across two contrasting university contexts: an interdisciplinary data science and modeling course at Michigan State University, USA, and a third-semester physics course at the University of Oslo, Norway. Over the course of a semester, computational essays were simultaneously and independently used in both courses, and comparable datasets of student artifacts and retrospective interviews were collected from both student populations. These data were analyzed using a framework which operationalized the construct of epistemic agency across the dimensions of programming, inquiry, data analysis and modeling, and communication. Based on this analysis, we argue that computational essays can be a useful tool in redistributing epistemic agency to students within higher education science due to their combination of adaptability and disciplinary authenticity. However, we also argue that educational contexts, scaffolding, expectations, and student backgrounds can constrain and influence the ways in which students choose to take up epistemic agency.