Data Collection

Data collectors track metrics over time and display them as charts in the visualization. In the generated code, they use Mesa's DataCollector.

Setting Up Collectors

In the left panel under Data Collectors, add metrics to track:

  • Name — Label shown in the chart (e.g., "Total Energy")
  • Type — Model reporter or agent reporter
  • Aggregation — For model reporters: how to aggregate agent data (sum, mean, count, min, max)
  • Property — Which agent property to track

Model Reporters

Model reporters compute a single value per step across all agents. Example: "Average Energy" uses mean aggregation on the "energy" property. This appears as a line chart in the visualization.

Agent Reporters

Agent reporters record a value per agent per step. These are useful for detailed analysis but generate more data. Use model reporters for visualization charts and agent reporters when you need per-agent CSV export.

Visualization

Each model reporter automatically gets a live-updating chart in the Solara visualization. The charts appear alongside the grid view when you run the generated code.