Mesa Python agent-based modeling framework with data collection and browser visualization.
Overview Mesa is an Apache-2.0-licensed Python framework for agent-based modeling. It provides model and agent components, spatial structures, data collection and browser-based visualization while leaving the simulated rules in the author's Python code.[1]
Contents Building agent models AgentSet manages collections of agents and supports explicit activation patterns. Authors can combine framework components with custom implementations to represent interactions and collect observations. This approach suits teams that want their simulation logic inside a Python project rather than a separate modeling language. A browser visualization is a presentation layer, not evidence that the model requires no Python runtime.[1] [2]
Collecting useful observations DataCollector distinguishes model-wide, individual-agent, agent-type and table data. Reporters select attributes or compute values when collection occurs, and the accumulated records can become pandas data frames. Choosing reporters and collection intervals is part of experimental design: gathering every value does not automatically identify the quantities needed to assess a hypothesis.[3]
Version migration The migration guide documents changes to agent initialization, identifiers, scheduling and visualization. Older examples based on scheduler classes should not be assumed to run unchanged with current AgentSet workflows. More recent guidance also makes random seeds explicit for repeated batch experiments. Version and seed choices should accompany reference outputs when a model is shared or upgraded.[2]
Deployment and rights Mesa's core is open source under Apache-2.0. Visualization, plotting and network-modeling workflows can require recommended optional dependencies in addition to the basic package. The data-collection documentation also notes a serialization limitation when reporters use lambda functions. A portable project therefore includes dependency and reporter choices, not just the main model class.[1] [3]
When it substitutes Mesa can replace NetLogo for custom agent-based simulations when Python integration and programmatic data analysis are priorities. This assessment assumes a rewrite of behavior and experiment controls, not direct loading of NetLogo files. Activation order, random inputs, observations and visual controls must be compared before the rewritten model is treated as equivalent.[1] [2] [3] [4]
References Mesa overview Apache2 Python agent framework, Solara and optional dependencies
vendor · retrieved 2026-10-07 Mesa migration guide AgentSet, seeding, visualization and scheduling changes
vendor · retrieved 2026-10-07 Mesa data collection Model/agent reporters, pandas outputs and serialization caveat
vendor · retrieved 2026-10-07 What is NetLogo? Agents, desktop platforms and authoring
vendor · retrieved 2026-10-07 Also included: 3 capabilities and 0 substitute relationships. Check substitutes in section 1 and capabilities in section 3.