Releases: mesa/mesa
v3.5.1
Highlights
Mesa 3.5.1 is a maintenance release that backports bug fixes, performance improvements, and minor enhancements from the Mesa 4.0 development branch to the stable 3.5.x series.
The event scheduling system stabilized in 3.5.0 receives several enhancements: EventGenerator gains pause()/resume() methods (#3431) and a next_scheduled_time property (#3423). EventList adds a compact() method for cleaning up cancelled events (#3359). Monotonic time is now enforced in event scheduling (#3343), and a memory leak from strong references in EventGenerator is fixed (#3360).
Performance is improved for Event.__lt__ (#3336), EventList.peek_ahead (#3413), and EventList.__len__ (#3512), which all avoid unnecessary allocations.
Bug fixes include inconsistent state when assigning a CellAgent to a full cell (#3374), atomic agent addition in FixedCell (#3415), time rewind prevention (#3329), and removal of legacy model.steps usage from solara_viz (#3344).
Finally, tooltip support is added to the Altair visualization backend (#3392). Type hints are improved across the event system and AgentSet. Benchmarks are updated to use Scenario, and the Wolf-Sheep example is optimized (#3503).
What's Changed
🛠 Enhancements
- Fix Schedule validation for start > end by @souro26 in #3326
- Event fixes by @quaquel in #3331
- Fail fast on unsupported lambda/partial callbacks in schedule_event by @falloficarus22 in #3320
- fix: use weakref in EventGenerator to prevent memory leak by @Krishsharma179 in #3360
- Add compaction method to EventList to reduce performance degradation under heavy cancellation by @souro26 in #3359
- Add type hints to internal generator in AgentSet.select by @Tushar1733 in #3410
- Add tooltip support to Altair backend by @annapurna-gupta in #3392
- add next_scheduled_time property to EventGenerator by @souro26 in #3423
- add pause and resume to EventGenerator by @souro26 in #3431
🐛 Bugs fixed
- Fix unbounded growth of
Model._event_generatorsby @EwoutH in #3317 - fix: prevent time rewind in _advance_time by adding early return by @Krishsharma179 in #3329
- Remove
model.stepsusage from solara_viz by @codebreaker32 in #3344 - Enforce monotonic time invariant in event scheduling by @souro26 in #3343
- Fix inconsistent state when assigning CellAgent to full cell by @souro26 in #3374
- fix: FixedCell setter atomically adds agent before updating reference (fixes #3411) by @Rishav23av in #3415
- Cell capacity bugfix by @quaquel in #3524
⚡ Performance improvements
- Optimize
Event.__lt__to avoid tuple allocation by @souro26 in #3336 - Use generator in peek_ahead instead of list allocation by @souro26 in #3413
- avoid temporary list allocation in EventList.len by @souro26 in #3512
🔍 Examples updated
- Clean up pd_grid example activation logic by @EwoutH in #3349
- Use scenario for all examples in benchmarks by @codebreaker32 in #3314
- Optimise Wolf-sheep performance by @PietroMondini in #3503
📜 Documentation improvements
- Add AgentSet to docs by @EwoutH in #3316
- Improve type annotations in mesa.time.event by @Tushar1733 in #3419
- docs: clarify proposal-first contribution flow and update PR/issue templates by @wang-boyu in #3395
🔧 Maintenance
- Remove additional lines of code used for testing by @codebreaker32 in #3335
- Add tests for execution ordering and cancellation invariants for EventList by @souro26 in #3353
- Fix benchmark workflow permissions for fork PRs by @EwoutH in #3459
New Contributors
- @Krishsharma179 made their first contribution in #3329
- @Tushar1733 made their first contribution in #3410
- @annapurna-gupta made their first contribution in #3392
- @Rishav23av made their first contribution in #3415
- @PietroMondini made their first contribution in #3503
- @m-y-mo made their first contribution
Full Changelog: v3.5.0...v3.5.1
Mesa 4.0 alpha 0
Highlights
Mesa 4.0 alpha 0 (v4.0.0a0) is the first pre-release of the next major version of Mesa. It removes long-deprecated APIs, cleans up the core architecture, and introduces experimental timed actions for agents. This is an alpha release intended for early testing , expect rough edges and further breaking changes before the stable 4.0 release.
Breaking changes: deprecated APIs removed
Mesa 4.0 follows through on deprecations announced in Mesa 3.x by removing several legacy components:
seedparameter removed (#3318): Theseedkeyword argument toModel.__init__(), deprecated since Mesa 3.4, is gone. Usernginstead (or pass it through aScenario).reset_rnghas also been updated to resetmodel.randomalongside the NumPy generator.model.stepsremoved (#3328): The step counter has been replaced bymodel.time, completing the shift to a time-centric simulation model. All internal usages now referencemodel.time, and the step-wrapping machinery has been simplified accordingly.batch_runremoved (#3325): Thebatch_runfunction and all associated files have been removed. Users should manage experiment execution throughScenarioand direct model control (see #3134 for background).mesa.spaceremoved (#3337): The legacy space module andagent.poshave been removed. Usemesa.discrete_spacefor grid-based and network models.PropertyLayerandHasPropertyLayersmixin removed (#3340, #3432): The standalonePropertyLayerclass is replaced by raw NumPy arrays stored directly on the grid asproperty_layers. Property access on cells now uses native property closures on a dynamicGridCellclass, simplifying the internals.- Simulator classes removed (#3530): The
Simulator,ABMSimulator, andDEVSimulatorclasses and the entiremesa.experimental.devspackage have been removed, completing the deprecation cycle started in Mesa 3.5.0. Their functionality is covered bymodel.run_for(),model.run_until(),model.schedule_event(), andmodel.schedule_recurring(). Note that the core event system remains fully functional inmesa.time.
Experimental: Timed agent actions
Mesa 4.0a0 introduces an experimental Action system (#3461), giving agents a built-in concept of doing something over time. Actions integrate with Mesa's event scheduling for precise timing, support interruption with progress tracking, and can be resumed.
from mesa.experimental.actions import Action
class Forage(Action):
def __init__(self, sheep):
super().__init__(sheep, duration=5.0)
def on_complete(self):
self.agent.energy += 30
def on_interrupt(self, progress):
self.agent.energy += 30 * progress # Partial credit
sheep.start_action(Forage(sheep))Key features include:
- Subclassable with
on_start(),on_resume(),on_complete(), andon_interrupt(progress)hooks - Live-computed
progress,remaining_time, andelapsed_timeproperties - Callable duration and priority for state-dependent values (e.g.,
duration=lambda a: a.distance / a.speed) - Interrupted actions remember progress and can be resumed, scheduling only the remaining duration
- Agent integration via
agent.start_action(),agent.interrupt_for(),agent.cancel_action(), andagent.is_busy
This is an experimental feature and may change in future releases. See the PR description for the full API reference and design rationale.
Event system improvements
The event scheduling system introduced in Mesa 3.5 receives several enhancements:
EventGeneratornow supportspause()andresume()for temporarily suspending recurring events without terminating the generator (#3431)- A
next_scheduled_timeproperty onEventGeneratorexposes the time of the next scheduled execution (#3423) EventListgains acompact()method to clean up cancelled events and improve performance under heavy cancellation (#3359)- Event scheduling now enforces monotonic time, scheduling events in the past raises a clear error (#3343)
- Memory leak from
EventGeneratorholding strong references is fixed via weak references (#3360)
Architecture and internals
- Exception hierarchy (#3197): A new
mesa.errorsmodule introduces a baseMesaErrorclass with specific exceptions likeCellNotEmptyError, replacing genericExceptionusage. Related PRs tighten exception types across the codebase (#3380). DiscreteSpaceis now an abstract base class (#3387): Subclasses must implement spatial hooks likefind_nearest_celland_connect_cells, enforcing a consistent spatial API contract.HasObservablesrenamed toHasEmitters(#3367): The reactive programming mixin now uses more precise terminology reflecting its role as a generic event emitter system.- Tooltip support in Altair backend (#3392): Agent data can now be shown on hover in Altair-based visualizations.
Performance improvements
Several targeted optimizations improve simulation performance:
Event.__lt__avoids tuple allocation (#3336)EventList.peek_aheaduses a generator instead of list allocation (#3413)EventList.__len__avoids temporary list allocation (#3512)- Continuous space agent removal is optimized (#3491)
This pre-release is meant for early testing of new features and providing us with feedback to guide Mesa 4.0 development. We don't recommend using it in production. Install with:
pip install -U --pre mesa
What's Changed
⚠️ Breaking changes
- Remove seed kwarg by @quaquel in #3318
- remove model.steps by @quaquel in #3328
- Remove batch_run.py by @quaquel in #3325
- Remove mesa.space by @quaquel in #3337
- Remove PropertyLayer and HasPropertyLayers mixin by @codebreaker32 in #3340
- Delete property_layer.py by @codebreaker32 in #3432
- Remove deprecated
mesa.experimental.devssimulator module by @EwoutH in #3530
🧪 Experimental
- Refactor: Rename HasObservables to HasEmitters by @Nithurshen in #3367
- FEAT: Add class-level subscribe to HasEmitters by @Nithurshen in #3368
- Add time column to empty dataframe in
datarecorderby @codebreaker32 in #3408 - Add explicit
RUN_ENDEDsignal for terminal data handling inDataRecorderby @codebreaker32 in #3424 - Add Actions: event-driven timed agent behavior (v2) by @EwoutH in #3461
- Remove ContinuousSpaceAgent.pos property by @satharyasin-hub in #3528
- Updating Scenario in preparation for replacing batch runner by @quaquel in #3493
🛠 Enhancements made
- Use scenario for all examples in benchmarks by @codebreaker32 in #3314
- Fix Schedule validation for start > end by @souro26 in #3326
- Event fixes by @quaquel in #3331
- Modify Space Drawers to use explicit Cell positions by @codebreaker32 in #3323
- Enforce default physical layout for Network spaces by @codebreaker32 in #3355
- Add manual dirty flag optimization to AgentDataSet by @souro26 in #3346
- Update
Networkto useCell.positionandlayoutfor Visualisation by @codebreaker32 in #3345 - Fail fast on unsupported lambda/partial callbacks in schedule_event by @falloficarus22 in #3320
- fix: use weakref in EventGenerator to prevent memory leak by @Krishsharma179 in #3360
- POC: Exception Hierarchy for Mesa 4.0 by @Nithurshen in #3197
- Convert DiscreteSpace to an Abstract Base Class by @codebreaker32 in #3387
- Tighten exception types and wrap missing-cell lookups by @falloficarus22 in #3380
- Add compaction method to Eventlist to reduce performance degradation under heavy cancellation by @souro26 in #3359
- Add type hints to internal generator in AgentSet.select by @Tushar1733 in #3410
- Add tooltip support to Altair backend by @annapurna-gupta in #3392
- add next_scheduled_time property to EventGenerator by @souro26 in #3423
- Update mesa.examples models to use scenario by @quaquel in #3363
- add pause and resume to EventGenerator by @souro26 in #3431
- Add static dependency injection to
@computed_propertyfor@emitsupport by @codebreaker32 in #3462 - fix: prevent IndexError and add clear error message in select_random_empty_cell() when grid is full by @BEASTSHRIRAM in #3500
🐛 Bugs fixed
- Fix unbounded growth of
Model._event_generatorsby @EwoutH in #3317 - fix: prevent time rewind in _advance_time by adding early return by @Krishsharma179 in #3329
- Remove
model.stepsusage from solara_viz by @codebreaker32 in #3344 - Enforce monotonic time invariant in event scheduling by @souro26 in #3343
- Fix inconsistent state when assigning CellAgent to full cell by @souro26 in #3374
- Fix: Enforce strict layout validation in Network space by @Nithurshen in #3386
- fix: FixedCell setter atomically adds agent before updating reference (fixes #3411) by @Rishav23av in #3415
- Fix checkout of untrusted code in benchmark.yml by @jackiekazil in #3438
- Fixes a cache-invalidation bug for
SignalingListby @codebreaker32 in #3486 - Fix incorrect warnings and exception types in
model.pyanddatacollection.pyby @codebyNJ in #3434 - Fix sliding window eviction crash in ModelDataSet by @ShreyasN707 in #3389
- fix: InputText widget returns string seed causing model reset to fail by @R1patil in #3518
⚡ Performance improvements
- Optimize
Event.__lt__to avoid tuple allocation by @souro26 in #3336 - Use generator in peek_ahead instead of list allocation by @souro26 in #3413
- avoid temporary list allocation in EventList.len by @souro26 in #3512
- Optimise
_remove_agentin Continuous Space by @codebreaker32 in #3491
🔍 Examples updated
- Clean up pd_grid example activation logic by @EwoutH in #3349
- Optimise Wolf-sheep performance by @PietroMondini in #3503
📜 Documentation improvements
- Add AgentSet to docs by @EwoutH in #3316
- add general exception handling guidance to CONTRIBUTING.md by @falloficarus22 in #3394...
v3.5.0
Highlights
Mesa 3.5.0 is a major feature release that introduces a public event scheduling API, stabilizes the event system, and lays the groundwork for Mesa 4.0 by deprecating several legacy patterns.
Public event scheduling and time advancement
The headline feature of 3.5.0 is a new public API for event scheduling and time advancement directly on Model (#3266). Instead of interacting with experimental Simulator classes, users can now schedule events and advance time with simple, expressive methods:
# Run the model for a duration
model.run_for(10) # Advance 10 time units
model.run_until(50.0) # Run until absolute time 50
# Schedule one-off events
model.schedule_event(callback, at=25.0) # At absolute time
model.schedule_event(callback, after=5.0) # Relative to now
# Schedule recurring events
from mesa.time import Schedule
model.schedule_recurring(func, Schedule(interval=10, start=0))For traditional ABMs, model.run_for(1) is functionally equivalent to model.step(), but this generalizes naturally to event-driven and hybrid models. The mental model shifts from "execute step N" to "advance time, and whatever is scheduled will run."
Our new Agent activation and event scheduling tutorials cover this extensively (#3280).
Stabilized event scheduling system
The event scheduling system (EventList, Event, EventGenerator, Schedule, Priority) has been moved from mesa.experimental.devs to the new stable mesa.time module (#3276), making event-based simulation a first-class feature of Mesa. The new Schedule dataclass provides a clean way to define recurring timing patterns with interval, start, end, and count parameters (#3250). See our migration guide.
Deprecations toward Mesa 4.0
This release deprecates several legacy patterns to prepare for Mesa 4.0:
- Simulator classes deprecated (#3277):
ABMSimulatorandDEVSimulatorare replaced by the newModelmethods above. seedparameter deprecated (#3147): Use therngparameter inModel.__init__()instead.- AgentSet sequence behavior deprecated (#3208): Indexing/slicing on
AgentSetis deprecated in favor of the newto_list()method. - Portrayal dictionaries deprecated (#3144): Use
AgentPortrayalStyleandPropertyLayerStyleinstead.
See our migration guide for more detail.
Internal architecture improvements
Under the hood, Model now uses an EventGenerator internally for step scheduling (#3260), unifying the step mechanism with the broader event system. A new _HardKeyAgentSet (#3219, #3224) replaces WeakKeyDictionary-based storage for model-managed agent collections, eliminating weak reference overhead while preventing memory leaks through automatic downgrading when creating views. An AbstractAgentSet base class (#3210) formalizes the AgentSet interface. Discrete spaces now distinguish between logical cell indices and physical spatial positions (#3268), laying the foundation for stacked spaces by adding a Cell.position property.
New agent creation from DataFrames
Agents can now be created directly from a pandas DataFrame (#3199), mapping columns to constructor arguments:
agents = MyAgent.from_dataframe(model, df)Experimental features
Several experimental features see significant progress in this release.
Scenarios
Explicit Scenario support (#3103, #3168) provides a structured way to define and manage computational experiments separately from model logic. Scenarios encapsulate parameter sets and can be used with SolaraViz (#3178), which automatically routes slider parameters to the correct Scenario or Model and reconstructs scenarios on reset.
class MyScenario(Scenario):
density: float = 0.7
class MyModel(Model):
def __init__(self, width=40, scenario=None):
super().__init__(scenario=scenario)
# 'density' is auto-detected as a Scenario parameter
page = SolaraViz(MyModel(), model_params={"width": 40, "density": Slider("Density", 0.7, 0, 1, 0.1)})Reactive model and data collection
The Model class is now reactive (#3212): model.time is observable, and signals are emitted when agents are registered or deregistered, enabling event-driven architectures. Building on this, a new DataRecorder (#3145, #3295) provides a decoupled, event-driven data collection system that separates what to collect (DataRegistry) from when and how to store it, with memory, SQLite, Parquet, and JSON backends.
self.recorder = DataRecorder(self)
self.data_registry.track_agents(self.agents, "agent_data", "wealth").record(self.recorder)
self.data_registry.track_model(self, "model_data", "gini").record(
self.recorder, configuration=DatasetConfig(start_time=4, interval=2)
)Other experimental progress includes improved meta-agent support with overlapping memberships (#3172).
Note that experimental features are in active development and can have (breaking) changes in every release.
What's Changed
⏳ Deprecations
- Deprecate the agent and propertylayer portrayal dicts by @EwoutH in #3144
- Deprecate
seedparameter in favor ofrngin Model by @quaquel in #3147 - Deprecate AgentSet sequence behavior and add
to_list()method by @codebyNJ in #3208 - Deprecate Simulator classes, add migration guide entry by @EwoutH in #3277
🎉 New features added
- Add DataFrame support to Agent creation by @falloficarus22 in #3199
- Add Schedule dataclass and refactor EventGenerator by @EwoutH in #3250
- Add public event scheduling and time advancement methods by @EwoutH in #3266
🛠 Enhancements made
- Fix: Cell.get_neighborhood() RecursionError for large radius (#3105) by @Nithin9585 in #3106
- Replace PropertyDescriptor with properties by @quaquel in #3125
- Ensure Cell only uses slots by @quaquel in #3121
- Allow list inputs for
MesaSignalobservable names and signal types by @Sonu0305 in #3139 - Optimise create_agents by replacing 'ListLike' approach with itertools by @codebreaker32 in #3163
- Micro optimization of grid.select_random_empty_cell by @quaquel in #3214
- Introduce AbstractAgentSet to agent.py and refactor AgentSet to inherit from it by @codebreaker32 in #3210
- Introduce
_HardKeyAgentSetin agents.py by @codebreaker32 in #3219 - Refactor step scheduling to use
EventGeneratorinternally by @EwoutH in #3260 - fix: handle deprecated space_kwargs gracefully in SpaceRenderer by @DipayanDasgupta in #3269
- Distinguish Logical Index from Physical Position by @codebreaker32 in #3268
🧪 Experimental features
- Add explicit support for Scenarios by @quaquel in #3103
- feat: Add SignalType enum for type-safe signal definitions. by @codebyNJ in #3056
- Replace Computable Descriptor with @computed in mesa_signals by @codebreaker32 in #3153
- Add scenario property to Agent class by @EwoutH in #3164
- replace AttributeDict with a dataclass by @quaquel in #3138
- Enable type-hinted Scenario subclassing and fix Model generic typing by @EwoutH in #3168
- Optimise mesa_signals by skipping signals for empty subscribers to reduce subsequent overheads by @codebreaker32 in #3198
- Add EventGenerator class for recurring event patterns by @EwoutH in #3201
- Support multiple and overlapping meta-agent memberships by @falloficarus22 in #3172
- fix: update meta_agents extract_class to use to_list() by @Jayantparashar10 in #3241
- Making Model reactive by @quaquel in #3212
- Add data registry by @quaquel in #3156
- Add
DataRecorderfor reactive Data Storage andDatasetConfigfor Configuration by @codebreaker32 in #3145 - Support Scenarios in SolaraViz visualization by @falloficarus22 in #3178
- Add
DataSet.record()by @quaquel in #3295 - Resolve
DataRecorderoff-by-one timestamp error by @codebreaker32 in #3299 - Adding batch and suppress to mesa_signals by @quaquel in #3261
- Only emit signal of new value of observable is different from old value by @quaquel in #3312
🐛 Bugs fixed
- Fix batch_run Data Collection to Ensure Accuracy and Capture All Steps by @codebreaker32 in #3109
- Fix network visualization bug: Replace array indexing with dictionary lookup by @codebyNJ in #3045
- Fix TypeError in find_combinations when evaluation_func is None by @codebyNJ in #3112
- Make create_meta_agent deterministic by @quaquel in #3183
- Fix seed logic to ensure reproducibility by @codebreaker32 in #3192
- Bugfix for pickling dynamically modified grids by @quaquel in #3217
- check whether model reporter is a partial function by @wang-boyu in #3220
- Prevent RecursionError and data loss in Cell/Grid deepcopy by @falloficarus22 in #3222
- fix: update alliance_formation example to use AgentSet.to_list() by @souro26 in #3235
- fix: preserve falsy evaluation values in find_combinations by @souro26 in #3237
- Naming collision in meta-agents
add_atrributesby @tpike3 in #3239 - fix: update Altair tooltip type inference for compatibility by @souro26 in #3234
- Fix Solara Altair dependency updates by @falloficarus22 in #3244
🔍 Examples updated
- Update wolf-sheep example to use new event scheduling API by @EwoutH in #3278
- Update Epstein Civil Violence model to use the new experimental
Scenarioclass by @EwoutH in #3167
📜 Documentation improvements
- Add deprecation of passing portrayal arguments to draw() methods to migration guide by @EwoutH in #3202
- docs: clarify SolaraViz keyword-only model arguments by @Arjun-Sasi in #3044
- docs: Add Mesa migration guide for AgentSet sequence behavior by @codebyNJ in #3218
- docs: improve Boltzmann Wealth Model READM...
v3.5.0 beta 0
Highlights
Mesa 3.5.0 will be a major feature release that introduces a public event scheduling API, stabilizes the event system, and lays the groundwork for Mesa 4.0 by deprecating several legacy patterns.
Because of the size of this release, we're now first releasing beta release v3.5.0b0. Feedback and bug reports are welcome and appreciated!
Public event scheduling and time advancement
The headline feature of 3.5.0 is a new public API for event scheduling and time advancement directly on Model (#3266). Instead of interacting with experimental Simulator classes, users can now schedule events and advance time with simple, expressive methods:
# Run the model for a duration
model.run_for(10) # Advance 10 time units
model.run_until(50.0) # Run until absolute time 50
# Schedule one-off events
model.schedule_event(callback, at=25.0) # At absolute time
model.schedule_event(callback, after=5.0) # Relative to now
# Schedule recurring events
from mesa.time import Schedule
model.schedule_recurring(func, Schedule(interval=10, start=0))For traditional ABMs, model.run_for(1) is functionally equivalent to model.step(), but this generalizes naturally to event-driven and hybrid models. The mental model shifts from "execute step N" to "advance time, and whatever is scheduled will run."
Stabilized event scheduling system
The event scheduling system (EventList, Event, EventGenerator, Schedule, Priority) has been moved from mesa.experimental.devs to the new stable mesa.time module (#3276), making event-based simulation a first-class feature of Mesa. The new Schedule dataclass provides a clean way to define recurring timing patterns with interval, start, end, and count parameters (#3250).
Deprecations toward Mesa 4.0
This release deprecates several legacy patterns to prepare for Mesa 4.0:
- Simulator classes deprecated (#3277):
ABMSimulatorandDEVSimulatorare replaced by the newModelmethods above. seedparameter deprecated (#3147): Use therngparameter inModel.__init__()instead.- AgentSet sequence behavior deprecated (#3208): Indexing/slicing on
AgentSetis deprecated in favor of the newto_list()method. - Portrayal dictionaries deprecated (#3144): Use
AgentPortrayalStyleandPropertyLayerStyleinstead.
See our migration guide for more detail.
Internal architecture improvements
Under the hood, Model now uses an EventGenerator internally for step scheduling (#3260), unifying the step mechanism with the broader event system. A new _HardKeyAgentSet (#3219, #3224) replaces WeakKeyDictionary-based storage for model-managed agent collections, eliminating weak reference overhead while preventing memory leaks through automatic downgrading when creating views. An AbstractAgentSet base class (#3210) formalizes the AgentSet interface.
New agent creation from DataFrames
Agents can now be created directly from a pandas DataFrame (#3199), mapping columns to constructor arguments:
agents = MyAgent.from_dataframe(model, df)Experimental features
Several experimental features see significant progress: explicit Scenario support for computational experiments (#3103, #3168), a data registry for structured data collection (#3156), reactive model support (#3212), and improved meta-agent support with overlapping memberships (#3172).
Installation
Install this beta release with:
pip install --upgrade --pre mesa
What's Changed
⏳ Deprecations
- Deprecate the agent and propertylayer portrayal dicts by @EwoutH in #3144
- Deprecate
seedparameter in favor ofrngin Model by @quaquel in #3147 - Deprecate AgentSet sequence behavior and add
to_list()method by @codebyNJ in #3208 - Deprecate Simulator classes, add migration guide entry by @EwoutH in #3277
🎉 New features added
- Add DataFrame support to Agent creation by @falloficarus22 in #3199
- Add Schedule dataclass and refactor EventGenerator by @EwoutH in #3250
- Add public event scheduling and time advancement methods by @EwoutH in #3266
🛠 Enhancements made
- Fix: Cell.get_neighborhood() RecursionError for large radius (#3105) by @Nithin9585 in #3106
- Replace PropertyDescriptor with properties by @quaquel in #3125
- Ensure Cell only uses slots by @quaquel in #3121
- Allow list inputs for
MesaSignalobservable names and signal types by @Sonu0305 in #3139 - Optimise create_agents by replacing 'ListLike' approach with itertools by @codebreaker32 in #3163
- Micro optimization of grid.select_random_empty_cell by @quaquel in #3214
- Introduce AbstractAgentSet to agent.py and refactor AgentSet to inherit from it by @codebreaker32 in #3210
- Introduce
_HardKeyAgentSetin agents.py by @codebreaker32 in #3219 - Refactor step scheduling to use
EventGeneratorinternally by @EwoutH in #3260 - fix: handle deprecated space_kwargs gracefully in SpaceRenderer by @DipayanDasgupta in #3269
🧪 Experimental features
- Add explicit support for Scenarios by @quaquel in #3103
- feat: Add SignalType enum for type-safe signal definitions. by @codebyNJ in #3056
- Replace Computable Descriptor with @computed in mesa_signals by @codebreaker32 in #3153
- Add scenario property to Agent class by @EwoutH in #3164
- replace AttributeDict with a dataclass by @quaquel in #3138
- Enable type-hinted Scenario subclassing and fix Model generic typing by @EwoutH in #3168
- Optimise mesa_signals by skipping signals for empty subscribers to reduce subsequent overheads by @codebreaker32 in #3198
- Add EventGenerator class for recurring event patterns by @EwoutH in #3201
- Support multiple and overlapping meta-agent memberships by @falloficarus22 in #3172
- fix: update meta_agents extract_class to use to_list() by @Jayantparashar10 in #3241
- Making Model reactive by @quaquel in #3212
- Add data registry by @quaquel in #3156
🐛 Bugs fixed
- Fix batch_run Data Collection to Ensure Accuracy and Capture All Steps by @codebreaker32 in #3109
- Fix network visualization bug: Replace array indexing with dictionary lookup by @codebyNJ in #3045
- Fix TypeError in find_combinations when evaluation_func is None by @codebyNJ in #3112
- Make create_meta_agent deterministic by @quaquel in #3183
- Fix seed logic to ensure reproducibility by @codebreaker32 in #3192
- Bugfix for pickling dynamically modified grids by @quaquel in #3217
- check whether model reporter is a partial function by @wang-boyu in #3220
- Prevent RecursionError and data loss in Cell/Grid deepcopy by @falloficarus22 in #3222
- fix: update alliance_formation example to use AgentSet.to_list() by @souro26 in #3235
- fix: preserve falsy evaluation values in find_combinations by @souro26 in #3237
- Naming collision in meta-agents
add_atrributesby @tpike3 in #3239 - fix: update Altair tooltip type inference for compatibility by @souro26 in #3234
- Fix Solara Altair dependency updates by @falloficarus22 in #3244
🔍 Examples updated
📜 Documentation improvements
- Add deprecation of passing portrayal arguments to draw() methods to migration guide by @EwoutH in #3202
- docs: clarify SolaraViz keyword-only model arguments by @Arjun-Sasi in #3044
- docs: Add Mesa migration guide for AgentSet sequence behavior by @codebyNJ in #3218
- docs: improve Boltzmann Wealth Model README structure and clarity by @souro26 in #3229
- Update SpaceRenderer API in Tutorials 4, 5, and 6 by @falloficarus22 in #3231
- Fix docstring in
mesa_signals/core.pyby @codebreaker32 in #3255 - cleanup by @quaquel in #3258
- Migrate tutorials and examples to model.run_for() by @falloficarus22 in #3270
🔧 Maintenance
- Fix pickling for scheduled events by serializing weak-referenced callbacks safely by @EwoutH in #3205
- Unify event list between Model and Simulator by @EwoutH in #3204
- Fix: Replace 'assert ValueError' with proper return None by @codebyNJ in #3189
- Update
model.pyto replaceAgentSetwith_HardKeyAgentSetby @codebreaker32 in #3224 - Use type(model.value).init in ModelCreator param check by @falloficarus22 in #3264
- Stabilize event scheduling system from experimental to mesa.time by @EwoutH in #3276
New Contributors
- @champ-byte made their first contribution in #3098
- @Arjun-Sasi made their first contribution in #3044
- @souro26 made their first contribution in #3235
- @Jayantparashar10 made their first contribution in #3241
- @ApurvaPatil2401 made their first contribution in #3249
Full Changelog: v3.4.1...v3.5.0b0
v3.4.2
Highlights
Mesa 3.4.2 is a bugfix release that addresses a critical memory leak affecting all Mesa models.
A memory leak where model instances could never be garbage collected after agents were created was found (#3179). The root cause was the Agent._ids class attribute: a defaultdict that stored references to model instances to ensure unique_id values were unique per model. Because this was a class-level attribute persisting across the Python process, any model used as a key maintained a hard reference indefinitely, preventing cleanup of the model and all its associated objects even after going out of scope.
This bug has serious implications for users running multiple simulations or batch experiments, as each model instance would accumulate in RAM rather than being cleaned up, eventually exhausting available memory. The fix moves unique_id assignment from the Agent class into Model.register_agent(), with each model now maintaining its own agent_id_counter instance attribute (#3180). This eliminates persistent class-level references and allows proper garbage collection of model objects.
This release also includes a fix for PropertyLayer.from_data() to prevent unintended side effects (#3122), along with several small documentation improvements (#3104, #3124, #3127), and expanded contribution guidelines detailing Mesa's development philosophy and workflow (#3135).
Upgrading to Mesa 3.4.2 is highly recommended.
pip install --upgrade mesa
What's Changed
🐛 Bugs fixed
- Ensure PropertyLayer.from_data() does not have side effects by @quaquel in #3122
- Fix for Memory leak by @quaquel in #3180
📜 Documentation improvements
- Document
Agenthashability requirement by @Sonu0305 in #3104 - Fix
chart_property_layersdocstring by @Sonu0305 in #3124 - Fix
remove_property_layerdocstring by @Sonu0305 in #3127 - Add Mesa development process guidelines by @EwoutH in #3135
Full Changelog: v3.4.1...v3.4.2
v3.4.1
Highlights
Mesa 3.4.1 is a patch release with bug fixes, performance improvements, and documentation enhancements. This release addresses issues affecting data collection, memory management, and grid operations while introducing performance optimizations.
This release resolves several bugs affecting simulation accuracy: fixed multiple batch_run and DataCollector issues including agenttype_reporters support (#3095), sparse data collection (#2988), and proper handling of multiple collect() calls per step (#3058); resolved MultiGrid._empty_mask not updating correctly (#3019) and infinite loops in select_random_empty_cell() (#3014); fixed a memory leak in ContinuousSpace agent removal (#3031); corrected EventList.peek_ahead() chronological ordering (#3010); and ensured FixedAgent state consistency after removal (#3100).
Several optimizations improve Mesa's performance: PropertyLayer was refactored to implement the NumPy interface directly, enabling standard NumPy syntax (#3074); select_random_empty_cell() now uses vectorized NumPy operations instead of slow O(N) Python iteration (#3087); and Cell.is_empty/is_full checks were optimized to remove unnecessary O(n) copies (#3069).
The documentation received several improvements including version warnings for visualization tutorials (#2949), updated contribution guidelines (#3028), and implementation of Vale for consistent documentation style (#3022). The entire mesa.space module is now marked as maintenance-only (#3082), with users encouraged to use mesa.discrete_space for new projects. Generic type parameters were added to Agent, AgentSet, and Model classes to improve static type checking (#2885).
We're excited to welcome 9 new contributors to Mesa in this release! Thank you to everyone who contributed bug fixes, performance improvements, and documentation enhancements.
What's Changed
🛠 Enhancements made
- Optimize Cell is_empty/is_full by @codebyNJ in #3069
- Refactor PropertyLayer to implement NumPy interface and deprecate wrappers by @codebreaker32 in #3074
- Optimise select_random_empty_cell() in grid.py by @codebreaker32 in #3087
- Add generic type parameters to Agent, AgentSet, and Model by @SiddharthBansal007 in #2885
🐛 Bugs fixed
- Fix: peak_ahead returns events in correct chronological order by @Nithin9585 in #3010
- fix: prevent infinite loop in select_random_empty_cell via heuristic fallback by @DipayanDasgupta in #3014
- Fix: datacollector missing attribute error by @codebyNJ in #3041
- Fix: Add deepcopy to agent reporters to prevent mutable reference lea… by @Nithin9585 in #3038
- Add initialization check in Simulator.run_for() by @codebreaker32 in #3036
- Fix: Method Reporter Validation in DataCollector by @vedantvakharia in #3002
- Fix MultiGrid._empty_mask not updated correctly by @Nithin9585 in #3019
- Fix: Correct data retrieval in batch_run when DataCollector.collect() called multiple times per step by @Nithin9585 in #3058
- Fix: IndexError in batch_run with sparse data collection by @Nithin9585 in #2988
- Fix: Add agenttype_reporters support to batch_run by @BhoomiAgrawal12 in #3095
- Fix memory leak in ContinuousSpace agent removal by @Nithin9585 in #3031
- Minor Refactoring in solara_viz by @codebreaker32 in #3059
- Fix: Correct
FixedAgentstate after removal by @Sonu0305 in #3100
🔍 Examples updated
- Resolve FIXME in
sugarscape_g1mt/agents.pyby @Sonu0305 in #3062 - Update alliance formation mode by @quaquel in #3075
📜 Documentation improvements
- document Model.time in Model API by @Gee307 in #3020
- docs: Add example structure and policy to contributing guide by @EwoutH in #3028
- Changed broken documentation link in docs/tutorials/1_adding_space.ipynb by @ShashwatAwate in #2973
- Updated CONTRIBUTING.md to replace old black documentation with new ruff format. by @falloficarus22 in #3071
- docs: Add Mesa 3.3+ version warnings to visualization tutorials by @Srinath0916 in #2949
- Implementation of Vale by @vedantvakharia in #3022
- Mark whole
mesa.spacemodule maintenance-only by @quaquel in #3082
🔧 Maintenance
- CI: Restore coverage collection after test reorganization by @falloficarus22 in #3006
- Fix flaky Playwright test in
test_examples_viz.pyby @vedantvakharia in #3039 - tests: consolidate Solara viz tests and restore Altair coverage #2993 by @DipayanDasgupta in #3011
- test: add coverage for ignore_missing=True in DataCollector by @disgruntled-penguin in #3054
- test: ensure DataCollector raises ValueError when collecting data for… by @disgruntled-penguin in #3053
- Lint: Enable RUF012 and annotate mutable class attributes with ClassVar by @falloficarus22 in #3033
New Contributors
- @Gee307 made their first contribution in #3020
- @DipayanDasgupta made their first contribution in #3014
- @ShashwatAwate made their first contribution in #2973
- @vedantvakharia made their first contribution in #3039
- @codebyNJ made their first contribution in #3041
- @disgruntled-penguin made their first contribution in #3054
- @Sonu0305 made their first contribution in #3062
- @Srinath0916 made their first contribution in #2949
- @BhoomiAgrawal12 made their first contribution in #3095
Full Changelog: v3.4.0...v3.4.1
v3.4.0
Highlights
The Mesa 3.4.0 feature release introduces universal time tracking, improves batch run reproducibility, and strengthens our deprecation policy. This release also requires Python 3.12+ and includes numerous bug fixes and quality-of-life improvements.
Universal simulation time with model.time
Mesa now provides a single source of truth for simulation time through the model.time attribute (#2903). Previously, time was fragmented across different components - simple models used model.steps as a proxy, while discrete event simulations stored time in simulator.time. This created complexity for features needing consistent time access.
Now all models have a model.time attribute that:
- Automatically increments with each step (by 1.0)
- Works seamlessly with discrete event simulators
- Provides a consistent interface for data collection, visualization, and user code
# Basic usage - time auto-increments
model = Model()
model.step()
print(model.time) # 1.0
# With discrete event simulation
simulator = DEVSimulator()
simulator.setup(model)
simulator.schedule_event_absolute(some_function, 2.5)
simulator.run_until(3.0)
print(model.time) # 3.0The old simulator.time still works but emits a deprecation warning.
Improved batch run reproducibility
The batch_run function has been updated to provide explicit control over random seeds across replications (#2841). Previously, using iterations with a fixed seed caused all iterations to use the same seed, producing identical results instead of independent replications.
The new rng parameter accepts either a single seed value or an iterable of seed values, giving you complete control over reproducibility:
rng = np.random.default_rng(42)
seed_values = rng.integers(0, sys.maxsize, size=(5,))
results = mesa.batch_run(
MoneyModel,
parameters=params,
rng=seed_values.tolist(), # Each iteration uses a different seed
)The old iterations parameter is now deprecated and will be removed in Mesa 4.0. See the migration guide for details on updating your code.
Strengthened deprecation policy
Mesa now has a formal deprecation policy that ensures users have adequate time to migrate while allowing Mesa to evolve (#2900). A related change is that all deprecation warnings now use FutureWarning instead of DeprecationWarning (#2905), making them visible by default since DeprecationWarning is hidden for imported modules.
The policy guarantees:
- New features must be available for at least one minor release before deprecating old ones
- Documentation, migration guides, and examples must be updated before active deprecation
- Breaking changes only occur in major version releases
- Experimental features have more flexibility but still communicate changes
Organization name change
Mesa has migrated from the projectmesa to mesa organization on GitHub (#2880), (#2887), thanks to Daniel Langemann (@dlangemann) who generously transferred the mesa name to us. Our repositories are now accessible at github.com/mesa/mesa instead of github.com/projectmesa/mesa, signaling authority and maturity in a way that better reflects Mesa's position as the agent-based modeling framework in Python. GitHub automatically redirects old links, so existing URLs and git remotes continue to work seamlessly.
Python 3.12+ required
Mesa 3.4.0 drops support for Python 3.11 and now requires Python 3.12 or higher (#2842). This allows Mesa to use modern Python type parameter syntax and prepares the codebase for future Python features. Python 3.14 is now also fully tested in CI.
Other improvements
This release includes significant enhancements to the visualization system, including support for AgentPortrayalStyle in Altair components, improved property layer styling, and better error handling. The experimental cell space module has been removed in favor of the stable mesa.discrete_space module (#2969).
Numerous bugs were fixed, including issues with scalar color handling in matplotlib, empty cell collection indexing, and cell capacity handling. The test suite was reorganized to mirror the source module structure and now treats warnings as errors to prevent accumulation.
We welcome 10 new contributors to the Mesa project in this release! Thank you to everyone who contributed bug fixes, documentation improvements, and feature enhancements.
What's Changed
⏳ Deprecations
- Replace DeprecationWarnings with FutureWarnings by @EwoutH in #2905
- Fix: Auto-increment seed across batch_run iterations by @EwoutH in #2841
🎉 New features added
🛠 Enhancements made
- Refactor SpaceRenderer API to separate setup and draw methods by @Sahil-Chhoker in #2893
- Validate HexGrid torus dimensions by @ShreyasN707 in #2951
- Allow PropertyLayerStyle instance in draw_propertylayer by @ShreyasN707 in #2936
- Support AgentPortrayalStyle in Altair visualization components by @EwoutH in #2985
🐛 Bugs fixed
- Update visualization tabs to be compatible with ipyvuetify 3.0 by @EwoutH in #2919
- Use pandas type checking for numeric dtype detection in Altair backend by @EwoutH in #2917
- Fix for Model.reset_rng by @quaquel in #2946
- Fix scalar color handling in legacy
matplotlibbackend. by @falloficarus22 in #2959 - Fix: IndexError in select_random_agent when cell collection is empty by @Nithurshen in #2983
- Fix: Handle capacity=None in Cell.is_full property by @Nithin9585 in #2981
- Fix/cell capacity zero by @ahmednabiled in #2990
- Fix SolaraViz multipage rendering when renderer is absent by @falloficarus22 in #2966
🔍 Examples updated
- examples: Add Activation Order and Grid Type selectors to EpsteinCivilViolence by @Nithurshen in #2955
📜 Documentation improvements
- Docs: Link to online example model demo in a few places by @EwoutH in #2882
- Update overview.md by @quaquel in #2883
- docs: Changed colab notebook url for tutorial 3 - agentset by @aten2005 in #2890
- Add AI/LLM use guidelines to Code of Conduct by @EwoutH in #2898
- docs: Add deprecation policy to contributor guide by @EwoutH in #2900
- [Docs] Fix typos and inconsistent comments in tutorials by @Mannan-15 in #2948
- Remove capacity constraint on cells from tutorial by @quaquel in #2964
- Fix Navigation Issue by @codebreaker32 in #2938
🔧 Maintenance
- Drop Python 3.11, require Python 3.12+ and update to modern type parameter syntax by @EwoutH in #2842
- Pin Readthedocs build to Python 3.13 by @EwoutH in #2899
- tests: Resolved "Missing Random Number Generator" warnings by @ShreyasN707 in #2911
- tests: Update agent portrayals to use AgentPortrayalStyle by @Tejasv-Singh in #2909
- Add Python 3.14 support to workflows and metadata by @EwoutH in #2843
- Fix dtype/default_value mismatches in PropertyLayer tests to resolve UserWarnings by @ShreyasN707 in #2913
- Replace deprecated np.bmat with np.block in Voronoi Delaunay triangulation by @EwoutH in #2915
- Speed up CI by installing only Playwright chromium-headless-shell by @EwoutH in #2916
- Add deprecation category to release notes by @EwoutH in #2914
- test: Update simulator.time deprecation test to expect FutureWarning by @EwoutH in #2922
- tests: Migrate PropertyLayer portrayals from
dicttoPropertyLayerStyleby @Tejasv-Singh in #2920 - Fix matplotlib figure memory leak warning in tests by @EwoutH in #2924
- Update organization name from
projectmesatomesaby @EwoutH in #2880 - Update dict-based agent portrayals to use
AgentPortrayalStylein tests by @falloficarus22 in #2934 - Remove experimental cell_space module and update references by @EwoutH in #2969
- Fix PropertyLayer default value type mismatch warnings by @falloficarus22 in #2963
- test: Replace deprecated
iterationswithrngin batch_run tests by @EwoutH in #2984 - End of year cleanup by @EwoutH in #2971
- Reorganize tests to mirror source module structure by @EwoutH in #2994
- SolaraViz: move hooks before early return in ComponentsView by @EwoutH in #2925
- Fix reproducibility warnings by adding explicit random parameters by @codebreaker32 in #2978
- ci: treat warnings as errors to prevent accumulation by @EwoutH in #2926
- Reject negative time_delta in schedule_event_relative by @Nithin9585 in #2999
- CI: Add job that runs tests with pip pre-release dependencies by @EwoutH in #1852
- CI: Split off separate coverage job by @EwoutH in #3005
- Model: remove unreleased
step_durationparameter by @EwoutH in #3007
New Contributors
- @GlyphicGuy made their first contribution in #2892
- @aten2005 made their first contribution in #2890
- @Tejasv-Singh made their first contribution in #2908
- @ShreyasN707 made their first contribution in #2911
- @Mannan-15 made their first contribution in #2948
- @falloficarus22 made their first contribution in #2959
- @codebreaker32 made their first contribution in #2938
- @Nithurshen made their first contribution in #2955
- @Nithin9585 made their first contribution in #2981
- @ahmednabiled made their first contribution in #2990
Full Changelog: v3.3.1...v3.4.0
v3.3.1
Highlights
Mesa 3.3.1 is a maintenance release focused on bug fixes and documentation improvements following the major 3.3.0 visualization update.
This release addresses two critical visualization bugs affecting PropertyLayers on HexGrids and property layer data mapping across both Altair and Matplotlib backends.
The documentation received several important updates, including fixes to tutorial code examples, a new guide for Google Summer of Code contributors, and improved organization of the documentation structure. The migration guide has been updated to reflect the deprecation of the old agent_portrayal parameter in favor of the new AgentPortrayalStyle introduced in Mesa 3.3.0.
We're excited to welcome six new contributors to the Mesa project in this release! Thank you to everyone who contributed bug fixes, documentation improvements, and test coverage enhancements.
What's Changed
🐛 Bugs fixed
- Fix visualization error for PropertyLayers on HexGrids. Add tranpose … by @flucco in #2868
- Fix: Property layer data mapping for both Altair and Matplotlib backends by @Sahil-Chhoker in #2869
- Fix: AgentSet initialization should not require explicit random number generator by @verisimilidude2 in #2789
🔍 Examples updated
- Fix missing variable g in the tutorial by @pazmiller in #2849
📜 Documentation improvements
- fix broken link in example by @BigTurtle8 in #2847
- Docs: Fix ValueError in tutorial by adding default value to MoneyModel by @pragam-m25 in #2871
- Add guide for GSoC contributors by @colinfrisch in #2873
- Deprecate
agent_portrayaland update Migration guide by @Sahil-Chhoker in #2872 - Docs: List overview separate from tutorials by @dhiraj-143r in #2878
🔧 Maintenance
- ruff fixes in visualization by @quaquel in #2867
- [pre-commit.ci] pre-commit autoupdate: Update to ruff v0.13 by @pre-commit-ci[bot] in #2840
- Tests: Add test for InputText in UserInputs by @pragam-m25 in #2870
New Contributors
- @BigTurtle8 made their first contribution in #2847
- @pazmiller made their first contribution in #2849
- @flucco made their first contribution in #2868
- @pragam-m25 made their first contribution in #2870
- @dhiraj-143r made their first contribution in #2878
- @verisimilidude2 made their first contribution in #2789
Full Changelog: v3.3.0...v3.3.1
v3.3.0
Highlights
The major highlight of release 3.3.0 is the introduction of a new and improved visualization module. This effort was @Sahil-Chhoker's Google Summer of Code project . The new module is backwards compatible and continues to use Solara. It has several new and improved features to include:
AgentPortrayalStyle: a more user-friendly way to specify agent portrayalPropertyLayerStyle: Makes propertlayer and agent portrayal consistent.SpaceRender: a new component for drawing spaces, agents and property layers with extensive customization- Improved support for Altair and Maplotlib
- Multipage support (e.g., users can display simulation on one page and charts of the model on another)
- Updated tutorials for visualization
You can read more about the update here
In addition, there were many other improvements to mesa, from bug fixes to improved CI/CD pipelines. Thanks to the PyCON sprints and the developers who supported Mesa!
What's Changed
🧪 Experimental features
- Introduction of Space Renderer by @Sahil-Chhoker in #2803
🎉 New features added
- docs/nix flake by @hussainsultan in #2788
🛠 Enhancements made
- Added
AgentPortrayalStyleandPropertyLayerStyleby @Sahil-Chhoker in #2786 - Allow image markers to plot agents by @Holzhauer in #2799
- Renderer null check fix in solaraviz by @Sahil-Chhoker in #2809
- Add Altair plotting functionality by @Sahil-Chhoker in #2810
- Fix: Grid not showing in altair if both draw_structure and draw_agnets are called. by @Sahil-Chhoker in #2817
- Allowing color mapping to integers in AgentPortrayalStyle by @Sahil-Chhoker in #2818
- Added multipage functionality by @Sahil-Chhoker in #2827
🐛 Bugs fixed
- Bugfix ModelCreator for required model parameters and user adjusted model parameters by @Holzhauer in #2780
- Remove unneeded int cast by @derkweijers in #2791
- Add quotes to readme to insure multi-terminal compliance. by @jackiekazil in #2787
- Fix broken docs link - Fix issue 2792 by @catherinedevlin in #2793
- Bug fixes for portrayal components by @Sahil-Chhoker in #2798
- fix : prevent breakdown when citizen_density (Initial Agent Density s… by @colinfrisch in #2806
- Fix issue #2812 by @Tosiekdev in #2821
📜 Documentation improvements
- Benchmarks documentation by @colinfrisch in #2764
- minor corrections in tutorials by @Holzhauer in #2778
- Correct example code in "Overview of the MESA library" by @Holzhauer in #2781
- Updating Examples and Docs inline with the new API. by @Sahil-Chhoker in #2819
🔧 Maintenance
- Add
.coderabbit.yamlfile to allow reviewing and updating our CodeRabbit configuration by @EwoutH in #2761 - add nix flake by @hussainsultan in #2785
- Removing Deprecations Warnings from
agent_portrayalandpropertylayer_portrayaluntil next release. by @Sahil-Chhoker in #2797 - Added Basic Visualization tests by @Sahil-Chhoker in #2767
Other changes
- Update init.py by @tpike3 in #2770
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2751
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2802
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2808
- Bump actions/download-artifact from 4 to 5 by @dependabot[bot] in #2826
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #2825
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #2823
New Contributors
- @derkweijers made their first contribution in #2791
- @hussainsultan made their first contribution in #2785
- @catherinedevlin made their first contribution in #2793
- @Tosiekdev made their first contribution in #2821
Full Changelog: v3.2.0...v3.3.0
v3.2.0
Highlights
Mesa 3.2.0 is a feature-packed release, which stabilizes our discrete space, improves many of our visualisation capabilities, improves our tutorial organization, adds the experimental meta-agents, and includes other quality of life enhancements.
We also celebrate the publication of our peer-reviewed Mesa 3 paper in JOSS. See the updated Citing Mesa section on how to cite us.
Stabilization of Discrete Space
The experimental Cell Space system has been stabilized and is now available as mesa.discrete_space (#2610). This powerful spatial modeling framework enables cell-centric simulations with integrated PropertyLayers and improved agent movement capabilities. Key improvements include:
- Support for dynamic modifications to discrete spaces during simulation (#2755)
- Methods to add/remove cells and connections in real-time
- Full integration with PropertyLayers (#2440) for representing environmental variables
- Compatible with all examples and existing visualizations
The PropertyLayer itself has also been stabilized, allowing for efficient management of spatial environmental properties like terrain, resources, or any grid-based variables. Core examples including Schelling, Game of Life, Boltzmann Wealth, and Virus on Network have been updated to use the new discrete space system.
Enhanced Visualization Experience
The SolaraViz visualization system has received substantial upgrades:
- Command Console (#2697): An interactive Python console embedded directly in the visualization, allowing real-time model inspection and manipulation
- Asynchronous Updates (#2656): Visualization now runs in a separate thread, dramatically improving performance for complex models
- Dark Mode (#2689): Support for Solara Dark theme, automatically matching system preferences
- Improved Error Handling (#2747, #2753): Better visualization of errors with options to view detailed traceback information
- Enhanced UI: Arrow key navigation (#2725), movable input field with auto-scroll (#2710), and other quality-of-life improvements
- PropertyLayer visualisation in Altair (#2643): Support for visualising PropertyLayers using the Altair frontend in Solara.
Restructured and updated tutorial
Our introduction tutorial has been completely restructured (#2731). Instead of one huge notebook, the tutorial is now divided into smaller, focused modules that build progressively:
- Creating Your First Model: Essential basics to get started
- Adding Space: Learn how to use the new discrete space system
- Collecting Data: Effectively gather model statistics
- AgentSet: Master agent management techniques
- Visualization: Series of modules covering basic to advanced visualization
Introducing Meta-Agents
Complex systems often have multiple levels of components. An organization is not one entity, but is made of departments, sub-departments, and people. A person is not a single entity, but it is made of micro biomes, organs and cells. A city is not a single entity, but it is made of districts, neighborhoods, buildings, and people. A forest comprises an ecosystem of trees, plants, animals, and microorganisms.
This reality is the motivation for meta-agents. It allows users to represent these multiple levels, where each level can have meta-agents with constituting agents.
- Meta agents #2748
To demonstrate meta-agents capability there are two examples:
- Dynamic meta-agent creation - Alliance formation, which shows emergent meta-agent formation through a game theoretic based alliance formation.
- Deliberate meta-agent creation - Warehouse model, which provides a pseudo warehouse model to demonstrate meta-agent functionality.
Let us know what you think on our Matrix Channel
Other improvements
- AgentSet's
aggmethod now supports multiple aggregation functions in a single call (#2743) - Many documentation improvements have been made based on feedback by our JOSS reviewers
What's Changed
🎉 New features added
- Stabilize experimental Cell Space as
mesa.discrete_spaceby @quaquel in #2610 - Feat: Added Command Console by @Sahil-Chhoker in #2697
- Stabilize PropertyLayer by @EwoutH in #2440
🛠 Enhancements made
- Visualisation: Add dark mode by @sanika-n in #2689
- Creating threads to update visualization asynchronously by @HMNS19 in #2656
- Movable Input Field with auto-scroll by @Sahil-Chhoker in #2710
- Feat: Added arrow key navigation by @Sahil-Chhoker in #2725
- added property_layer with altair by @sanika-n in #2643
- Debug option for errors in visualisation by @colinfrisch in #2747
- Debug option for errors in visualisation front end by @colinfrisch in #2753
- Add support for dynamic discrete spaces by @quaquel in #2755
- Support multiple functions in AgentSet
aggmethod by @EwoutH in #2743
🔍 Examples updated
- Move boltzmann to cell spaces by @quaquel in #2680
- Move Game of life to cell space by @quaquel in #2681
- Move Schelling to discrete space by @quaquel in #2684
- Move virus_on_a_network to discrete_space by @quaquel in #2688
- Update boid_flockers example include flight direction by @sanika-n in #2696
📜 Documentation improvements
- docs: Split off the overview page, extend with spaces/activation by @EwoutH in #2673
- docs: Add Roles section to CONTRIBUTING.md by @EwoutH in #2694
- [JOSS] Docs: Clarify difference between core and user examples by @EwoutH in #2706
- [JOSS] docs: Improve batch_run documentation for parallel processing by @EwoutH in #2707
- JOSS Tutorial Fixes by @tpike3 in #2708
- Clean-up old images, compress wolf-sheep image, remove version switch artifact by @EwoutH in #2717
- docs: Update citation to JOSS article by @EwoutH in #2740
- update intro tutorial discrete space by @tpike3 in #2731
- docs: fix broken links to Readthedocs in example descriptions by @reyan-singh in #2757
🧪 Experimental features
🐛 Bugs fixed
New Contributors
- @colinfrisch made their first contribution in #2747
- @reyan-singh made their first contribution in #2757
Full Changelog: v3.1.4...v3.2.0