-
-
Notifications
You must be signed in to change notification settings - Fork 272
Add dormant_alliances example demonstrating MetaAgent lifecycle features #459
Copy link
Copy link
Open
Description
Summary
This proposes adding a new example dormant_alliances to demonstrate the new
MetaAgent lifecycle features being added in mesa/mesa#3684.
What it models
Countries (agents) form alliances (MetaAgents). Each step, countries lose power
from attrition. When a country's power hits zero it is defeated and removed. If
an alliance loses more than half its founding members, it goes DORMANT — suspended
but not destroyed. Dormant alliances can reactivate if they recruit enough
unaffiliated countries to recover.
Features demonstrated
| Feature | Where used |
|---|---|
MetaAgentState (ACTIVE / DORMANT / DISSOLVED) |
Alliance.step() |
deactivate() |
Triggered when >50% of founders are defeated |
activate() |
Triggered when dormant alliance recruits enough members |
on(signal, handler) |
Alliance registers _on_member_defeated |
emit(signal, ...) |
CountryAgent fires "member_defeated" on defeat |
cascade_step = True |
Alliance steps all members automatically |
to_dict() |
Used by DataCollector for structured logging |
Files
examples/dormant_alliances/ contains init.py, agents.py (CountryAgent + Alliance), model.py (DormantAlliancesModel), app.py (Solara visualization), and README.md.
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels