Ecological systems — populations, communities, ecosystems, and the biosphere itself — are composed of interacting subsystems that exchange matter and energy across semi-permeable boundaries while maintaining stable macrostates over time. That structure closely mirrors the Markov blanket and Bayesian mechanics formalism underlying the free energy principle, which is why a research program under the banner of "variational ecology" has emerged to model organisms and their niches as coupled inference systems. The literature here is heavier on theory and simulation than on field data: this page surveys the conceptual foundations, the modeling patterns researchers are using, the tools available, and the empirical gaps the field still needs to close.
Why the domain fits
The free energy principle describes ergodic random dynamical systems that maintain a nonequilibrium steady state by minimizing variational free energy, an upper bound on the surprise of their sensory states under a generative model. Ecological systems satisfy this description at every scale: organisms, populations, and ecosystems maintain characteristic distributions of states (abundances, resource levels, climatic variables) and exhibit self-organized patterns resilient to perturbation. Ramstead and colleagues coined "variational ecology" to capture this, treating organisms as inference machines that parameterize generative models of their niche while niche construction lets environments serve as the co-adapting "external states" of that same system. Because ecological nestedness (populations within communities within ecosystems within the biosphere) maps directly onto a hierarchy of Markov blankets, the field's own multi-scale structure is what makes it a natural fit rather than a metaphorical stretch.
Application patterns in the literature
Concrete modeling patterns recur across the corpus: generative models of ecological variables (resource states, predator cues, developmental environments), policy selection via expected free energy that trades off pragmatic value against epistemic (uncertainty-reducing) value, and hierarchical formulations where slow variables (climate, genetics) constrain fast ones (behavior, phenotype). Constant and colleagues formalized developmental niche construction as a slow gradient flow on time-averaged free energy, in which organisms modify environmental variables such as nest structures or parental-care environments to stabilize preferred developmental trajectories. Bruineberg, Rietveld, and Parr extended this to a joint agent-environment free energy measure of "fit," and the "cognitive ecology of surprise" framework applies active inference to predator-prey dynamics, arguing that predators benefit from generating surprise while prey minimize it through vigilance and habitat choice. Heins and colleagues' PNAS paper on collective behavior from surprise minimization is the most fully developed simulation result, showing that continuous-time agents individually minimizing free energy reproduce flocking- and schooling-like group motion without hand-coded behavioral rules. At the largest scale, Rubin, Parr, Da Costa, and Friston model the biosphere's carbon cycle and metabolic rates as a planetary Markov blanket, describing Earth system resilience and climate regulation as if the biosphere were minimizing a free energy functional.
Tools and institutional infrastructure
The pymdp Python package implements discrete Markov-decision-process active inference and underlies several of the ecological application patterns described here (patch choice, discrete habitat selection, simplified foraging games), while SPM/MATLAB tutorial scripts and Heins et al's published GitHub code for continuous-time collective-behavior simulations provide adaptable starting points. Albarracin, Hipolito, and colleagues have built active inference models of common-pool resource management, offering templates for social-ecological applications even though their current focus is human behavior rather than ecological systems directly. An "environment-centric active inference" preprint proposes defining Markov blankets from the environment's perspective, a direction relevant to ecological modeling but not yet backed by widely available code. The Active Inference Institute is the report's cited institutional hub for this research program, having run an Active Inference Lab since around 2021 with livestreams and discussions spanning in silico and robotics work as well as biogeography and Earth system resilience, and it maintains knowledge-base entries on ecological and evolutionary dynamics.
Open problems
The report is explicit that empirical, data-driven applications remain sparse relative to the theoretical and simulation literature: there are almost no published tests that compare active inference predictions against alternative ecological models (optimality models, reinforcement learning) using real behavioral or environmental data. A second open problem is scaling consistently from organisms to ecosystems and the biosphere without arbitrary choices about what counts as an "internal state" at each level — the report notes it is unclear whether an ecosystem should be modeled as a single agent or as a population of interacting agents whose dynamics only look inference-like in aggregate. A third is interpretive: applying "belief" language to plants, microbial communities, or the biosphere risks overstating cognitive claims, and the report recommends treating active inference as a modeling convenience rather than an ontological commitment for non-cognitive systems. Finally, the report flags concrete methodological gaps (software that scales past small discrete MDPs, techniques for estimating free energy proxies from noisy ecological time series) and normative questions raised once social-ecological governance models start encoding "preferred states" that embed value judgments about growth versus biodiversity.
Reference Backbone
Karl J. Friston (2010). The free-energy principle: a unified brain theory? Nature Reviews Neuroscience. DOI: 10.1038/nrn2787. Christopher L. Buckley, Chang Sub Kim, Simon McGregor, Anil K. Seth (2017). The free energy principle for action and perception: A mathematical review. Journal of Mathematical Psychology. DOI: 10.1016/j.jmp.2017.09.004. Giovanni Pezzulo, Francesco Rigoli, Karl J. Friston (2017). Active Inference, homeostatic regulation and adaptive behavioural control. Progress in Neurobiology. DOI: 10.1016/j.pneurobio.2017.08.001. Maxwell J. D. Ramstead, Karl J. Friston, Axel Constant, Lancelot Da Costa, Casper Hesp, Beren Millidge, Alexander Tschantz (2023). On Bayesian Mechanics: A Physics of and by Beliefs. arXiv.