Agent-Based Modeling: A Practical Introduction
August 12, 2026

Agent-based modeling (ABM) simulates a system by defining the behaviour of its individual parts and letting the system-level behaviour emerge, rather than describing the whole system with equations from the top down.
A quick orientation, since the term collides with a very different modern usage:
- ABM is a scientific method, established in complexity science decades before the current wave of AI agents. Different field, different meaning — see the disambiguation below.
- You specify agents and rules, not outcomes. The interesting result is what the rules produce collectively.
- Its purpose is usually explanation, not prediction. ABM answers "what mechanism could produce this pattern?" more reliably than "what number comes next?"
- The main tools are free: NetLogo for accessibility, Mesa for Python.
The three ingredients
Every agent-based model has the same structure.
Agents. Autonomous entities with internal state and behavioural rules. A person, a firm, a vehicle, a cell, an ant. Each acts on local information — critically, agents don't see the whole system, only their neighbourhood.
An environment. The space agents occupy and interact through. Sometimes a literal grid, sometimes a network, sometimes an abstract space of shared resources.
Rules of interaction. How agents respond to each other and their surroundings. Usually simple conditionals: if a neighbour does X, do Y.
Then you run it forward in time and observe. The output that matters is emergence — system-level structure that nobody encoded. Traffic jams appear in models where no rule mentions congestion. Segregation appears where no agent is strongly prejudiced. Flocking appears where no bird knows what a flock is.
Three classic models worth knowing
Schelling's segregation model (1971). Agents on a grid relocate if too few neighbours resemble them. The finding that made it famous: even a mild preference — wanting merely a third of your neighbours to be similar — produces sharply segregated patterns. Individual tolerance doesn't guarantee collective integration. It remains the cleanest demonstration that macro patterns need not reflect micro intentions.
Boids (1986). Three rules — avoid crowding, match neighbours' heading, steer toward the local centre — produce convincing flocking. No leader, no global plan. Widely used in computer graphics ever since.
Epidemiological models. Agents with individual contact patterns, locations and susceptibility. The advantage over classical compartmental equations is heterogeneity: you can model that some people have far more contacts than others, which changes conclusions about interventions substantially.
Each illustrates the same point. Simple local rules, complex global behaviour, and a result that would be difficult to reach by writing an equation for the aggregate.
When ABM is the right tool
| Use ABM when | Use equations when |
|---|---|
| Individuals differ in ways that matter | The population is well-mixed and homogeneous |
| Interaction is local, via space or network | Everyone effectively interacts with everyone |
| Adaptation and learning change behaviour | Behaviour is fixed |
| You want to explain a mechanism | You want a fast, tractable forecast |
| Feedback loops make aggregation misleading | Averages describe the system honestly |
The deciding question is usually heterogeneity. If averaging over your population loses something essential, you probably need agents. If the average genuinely describes the system, equations are faster, more tractable and easier to analyse.
The honest limitation: ABMs are hard to validate. A model that reproduces an observed pattern hasn't proven its mechanism is the real one — several rule sets can produce similar output. This is why ABM findings are usually framed as "these rules are sufficient to produce this pattern," not "this is what causes it." Treat any ABM presenting itself as predictive with more scepticism than one presenting itself as explanatory.
The software
NetLogo is the standard entry point. A purpose-built language and environment from Northwestern, with an extensive library of ready-made models covering biology, economics, physics and social science. Reading and modifying those models is the fastest way to learn the method. Its accessibility is deliberate — it was designed for teaching, and that makes it excellent for exploration even at research level.
Mesa is the Python option, and the better choice if your analysis pipeline is already Python. It provides the core components — schedulers, spatial grids, data collection — plus browser-based visualisation, and the documentation covers the standard patterns. Its real advantage is that model output lands directly in pandas and the rest of the scientific Python stack.
AnyLogic, Repast and GAMA cover more specialised ground: multi-method simulation, large-scale distributed runs, and explicitly spatial models with GIS integration respectively.
Start with NetLogo if you're learning the method. Start with Mesa if you already know Python and the modelling is one step in a larger analysis. The Santa Fe Institute, where much of the foundational complexity-science work originated, remains a good source for the theoretical background.
"Agent-based modeling" vs "AI agents"
These are different things that increasingly get confused, and the confusion is worth clearing up because searching one term now surfaces the other.
Agent-based modeling is a simulation methodology from complexity science. Its agents are simple — usually a handful of rules — and the point is emergence across many of them. Nobody's agent is intelligent; the interesting behaviour comes from interaction at scale.
AI agents are software systems that use language models to pursue goals, call tools and act. Here the individual agent is sophisticated, and there's usually only one. We covered how those are built in AI agent builders, and the way the capability gets packaged and shared in Claude Skills.
They overlap in one genuinely interesting place: using language models as the agents inside a simulation, to study social dynamics with richer behaviour than rules allow. That's an active research direction, and early enough that results should be read carefully — the validation problem above gets harder, not easier, when agent behaviour is itself opaque.
Getting started
- Open NetLogo's model library and run Schelling. Change the tolerance parameter. Watch the output change more than you expect.
- Modify an existing model before writing one. Every practitioner's first original model is too complicated.
- Start with the fewest rules that could produce the pattern. Complexity is easy to add and hard to interpret.
- Run it many times. ABMs are stochastic; a single run tells you almost nothing. Look at distributions across runs.
- Sweep your parameters. The interesting result is usually where behaviour changes sharply, not the value at any single setting.
- Write down what would falsify your model before you start tuning it.
Step four is where beginners most often go wrong: presenting one run as a result. Step six is what separates a model that teaches you something from one that confirms what you already believed.
One practical note on reproducibility. Published models are frequently shared but rarely re-run, because running someone else's setup means matching their environment, dependencies and versions. That gap between shared and runnable is a general problem in computational work, and it's the one Taku is built around for AI workflows specifically — mirroring a setup that already works for someone rather than reassembling it. It's a desktop AI workspace in Beta, not simulation software, so for ABM itself NetLogo and Mesa remain the tools.
FAQ
What is agent-based modeling used for?
Studying systems where individual variation and local interaction drive the outcome: epidemic spread, market dynamics, traffic, crowd movement, ecology, organisational behaviour, and urban development. It's strongest when you want to understand a mechanism rather than forecast a value.
What's the difference between agent-based modeling and simulation generally?
ABM is one kind of simulation. Discrete-event simulation models a queue of events; system dynamics models stocks and flows with differential equations. ABM is distinguished by modelling individual actors with their own state and rules, then observing what their interaction produces.
Is agent-based modeling machine learning?
No. Rules in a classical ABM are specified by the modeller, not learned from data. The two can be combined — agents that adapt via reinforcement learning, or models calibrated against observed data — but the method itself predates and is independent of ML.
Which software should I learn first?
NetLogo, unless you already work in Python, in which case Mesa. NetLogo's model library is the single best learning resource in the field, and reading working models is faster than any tutorial.
How many agents do I need?
Enough for the pattern to emerge, which is often far fewer than expected — Schelling's result is visible with a few hundred. Add agents when you have a reason, not for realism's sake; large models are slower to run and much harder to interpret.