Mesa: Agent-based modeling in Python#
Mesa is an Apache2 licensed agent-based modeling (or ABM) framework in Python.
Mesa allows users to quickly create agent-based models using built-in core components (such as spatial grids and agent schedulers) or customized implementations; visualize them using a browser-based interface; and analyze their results using Python’s data analysis tools. Its goal is to be the Python-based counterpart to NetLogo, Repast, or MASON.
A visualisation of the Wolf Sheep model build with Mesa.
Features#
Built-in core modeling components
Flexible agent and model management through AgentSet
Browser-based Solara visualization
Built-in tools for data collection and analysis
Example model library
Using Mesa#
Installation Options#
To install our latest stable release (3.0.x), run:
pip install -U mesa
To also install our recommended dependencies:
pip install -U mesa[rec]
On a Mac, this command might cause an error stating zsh: no matches found: mesa[all]
.
In that case, change the command to pip install -U "mesa[rec]"
.
To install our latest pre-release:
pip install -U --pre mesa[rec]
Resources#
For help getting started with Mesa, check out these resources:
Getting started - Learn about Mesa’s core concepts and components
Migration Guide - Upgrade to Mesa 3.0
Mesa Examples - Browse user-contributed models and implementations
GitHub Discussions - Ask questions and discuss Mesa
Matrix Chat Room - Real-time chat with the Mesa community
Development and Support#
Mesa is an open source project and welcomes contributions:
GitHub Repository - Access the source code
Issue Tracker - Report bugs or suggest features
Contributors Guide - Learn how to contribute
The original Mesa conference paper is available here.