Skip to content

Add agent activation, event scheduling and time progression tutorials#3280

Merged
EwoutH merged 18 commits intomesa:mainfrom
EwoutH:new_tutorials
Feb 15, 2026
Merged

Add agent activation, event scheduling and time progression tutorials#3280
EwoutH merged 18 commits intomesa:mainfrom
EwoutH:new_tutorials

Conversation

@EwoutH
Copy link
Copy Markdown
Member

@EwoutH EwoutH commented Feb 11, 2026

I did an attempt to write some tutorials for Agent activation, event scheduling and time progression.

# Title Content
0 First Model Unchanged — MoneyAgent, MoneyModel, shuffle_do, run_for
1 AgentSet (updated) get, select, agg, groupby, set, sort, to_list — all about querying and inspecting agents
2 Agent Activation (new) do, shuffle_do, mapmaking agents act. Covers random/sequential/simultaneous/staged/type-based/conditional activation. Includes a predator-prey example combining patterns.
3 Event Scheduling & Time (new) run_for/run_until, schedule_event (at/after), schedule_recurring with Schedule, Priority, cancellation. Complete central bank economy example combining steps + events.

What I found quite hard is:

  • step() is deeply embedded in ABM. Not only in Mesa, but in the field in general (NetLogo ticks, etc.). How far do we want to wander from there?
  • There are now quite some ways to determine agent activation orders:
    • Selecting subsets of agents
    • Activating those in different activation regimes
    • Scheduling events with different priorities

We build a lot of ways to Rome, the question is which do we advice by default, and which are a nice bonus?

For now, I think this tutorial strikes an acceptable balance, and it better than not having one at all. But I'm really curious about your thoughts on this.

Rendered in Readthedocs:

  1. Working with AgentSets
  2. Agent Activation
  3. Event Scheduling & Time

New Tutorial Lineup
1AgentSet (new)get, select, agg, groupby, set, sort, to_list — all about querying and inspecting agents2Agent Activation (new)do, shuffle_do, map — making agents act. Covers random/sequential/simultaneous/staged/type-based/conditional activation. Includes a predator-prey example combining patterns.3Event Scheduling & Time (new)run_for/run_until, schedule_event (at/after), schedule_recurring with Schedule, Priority, cancellation. Complete central bank economy example combining steps + events.
@EwoutH EwoutH requested review from quaquel and tpike3 February 11, 2026 15:49
@EwoutH EwoutH added the docs Release notes label label Feb 11, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the Next Steps at the end as the tutorials have all changed.

@tpike3
Copy link
Copy Markdown
Member

tpike3 commented Feb 14, 2026

@EwoutH You have done some incredible work with Mesa, it is really great!

I had some minor comments. I am going to hit approve so I don't slow down the process. When we get to Mesa 4 we will probably need to look holistically at the tutorials, but for another day.

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 14, 2026

Thanks a lot for your extensive review! Will process your comments.

@quaquel could you also give this a look, from your professional background?

@EwoutH EwoutH mentioned this pull request Feb 14, 2026
42 tasks
@quaquel
Copy link
Copy Markdown
Member

quaquel commented Feb 14, 2026

The new tutorials are not all shown in the docs because getting_started.md has not been updated.

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 14, 2026

I will do all the updating, renaming and referencing once after the rest is settled

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 15, 2026

I fixed all the numbers, links and references. They are now also rendered in Readthedocs:

  1. Working with AgentSets
  2. Agent Activation
  3. Event Scheduling & Time

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 15, 2026

Updating/adding tutorials is quite cumbersome with the current numbering systems. Open to ideas on how to improve this.

For now, some pointers, if anyone needs to do this in the future:

  1. Always use relative links with .ipynb extension

    [Tutorial Name](N_tutorial_name.ipynb)[Tutorial Name](https://mesa.readthedocs.io/.../N_tutorial_name.html)[Tutorial Name](N_tutorial_name.html)
  2. When renumbering a tutorial, update:

    • Filename
    • All links pointing TO it from other tutorials
    • Colab/Binder badge URLs in its header
    • References in tutorial descriptions ("builds on [X]...")
  3. Always update these files when adding/reordering:

    • docs/getting_started.md - tutorials list
    • docs/overview.md - navigation sidebar
  4. Common patterns to search for:

    • "Next Steps" sections
    • "Tutorial Description" prerequisite references
    • "This is from the [X tutorial]..." in code explanations
    • Badge URLs: colab-badge and mybinder links

@quaquel
Copy link
Copy Markdown
Member

quaquel commented Feb 15, 2026

A couple of high-level remarks:

  • Why separate AgentSet and agent activation? I would also expect agent activation to come before the other functionality of AgentSet
  • I would consider leaving out the remark on before Mesa 3 and just talk about common activation patterns instead. Mesa 2 is ancient history by now.
  • I would not discuss model.steps at all. I would like to delete that on Mesa 4 asap.
  • On Schedule, I suggest reordering it: start, end, interval, count.

@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 15, 2026

  • Why separate AgentSet and agent activation? I would also expect agent activation to come before the other functionality of AgentSet

I first tried it in one but it got quite long. I choose for this order because then you first learn about selections and subsets of agents, and then on letting them do stuff.

On the other points, I agree, I will try to find some time. Otherwise it can be a follow-up PR.

@EwoutH EwoutH merged commit 30f8989 into mesa:main Feb 15, 2026
15 checks passed
@EwoutH
Copy link
Copy Markdown
Member Author

EwoutH commented Feb 15, 2026

Merging, I think this is a net improvement. Any follow-up PRs are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants