Agents.jl v6 + releases announcement post

Hi everyone,

we are happy to announce v6 of Agents.jl. This could well be the most major-est of Agents.jl major changes. We also hope that this will be last major increment of Agents.jl version, or at least, the last one in the foreseeable future.

We will also be using this Discourse post to post further useful update messages for Agents.jl, so feel free to subscribe here for future updates (we are stopping the REPL messages!).

This new release futures a true plethora of improvements, bugfixes, performance enhancements, and more, a summary of which you can find in the changelog. In this post I will only summarize the most noteworthy features!

Major player in making this release possible is @Tortar who contributed lot’s of new features and performance improvements! Thanks @Tortar!

AgentBasedModel API

Agents.jl now defines a standard interface for what quantifies as an “agent based model” (ABM). Other developers may hook up into the interface to create new model types. A model type only governs how the time evolution of the ABM takes place. Hence, the time evolution “functions” (the stepping functions) are now part of the model struct, and are not given as arguments to step!. This change was made to 1) be more harmonious with the rest of dynamic modelling packages of Julia such as DifferentialEquations.jl or DynamicalSystems.jl (in fact, the AgentBasedModel API was designed to be nearly identical to the DynamicalSystem API). But also 2) to orthogonalize the time evolution with all other Agents.jl features, such as e.g., data collection or movement of agents in a space or searching for nearby agents, etc. Hence, all of these orthogonal features can be used out of the box for a new type of agent based model.

This is particularly useful for developers of other agent based models such as Vanaha.jl (@sfuerst) or CellBasedModels.jl (@gatocor). We believe that it is possible now to integrate these packages directly with the rest of Agents.jl (should the developers wish so), taking advantage of performance enhancements that have been put in place over the years in Agents.jl for e.g., filtering or neighborhood searches, or taking advantage of the flexible Agents.jl data collection, or the existing plotting and GUI infrastructure (all of these things are orthogonal to the AgentBasedModel API).

Generic event queue ABM

To test drive this new API we developed a completely different ABM than the “standard” one that has been the only option in Agents.jl in all previous versions. This new “event queue” ABM operates in continuous time, in contrast to the “standard” ABM that operates in discrete time (or steps).

The event queue ABM is similar to what most people think as “Gillespie ABM”
but much more general. We considered several options for the backend of this
model, such as JumpProcesses.jl or other similar packages, but in the end
we decided to opt for generality of modelling possibilities and implemented
a simple event queue system, where events representing possible agent actions
are pushed into a continuous time queue and triggered when their time comes.

Currently the exact configuration for this event queue abm is in experimental status. We want to first see how the users interact with it to finalize its interface in the next minor release 6.1.

Multi-agent models: incredible inheritance logic and 0 performance downside

Arguably the strongest enhancement of existing features is at multi-agent
models which have multiple different types of agents.
Two highlights there are:

  1. The @agent macro now has incredible “inheritance” logic parallelizing
    as much as possible object oriented inheritance when creating custom
    structs representing user-defined agent types. The macro supports
    all features of Julia’s native struct definition. It supports inheritance
    from another type, and subtyping of any supertype.
  2. The new @multiagent macro allows defining multiple agent “types”.
    These are not true individual Julia structs, but instead “shadow” a
    single Julia struct. Yet, from the user’s side, they look identical to
    how one would handle multi different structs. These “shadow types”
    have 0 performance drops versus using a single agent type (in their
    most optimal performance configuration). This is absolutely major,
    as type instability was the main performance
    hit we had at multi-agent models. The new comparison of performance differences
    in multi-agent models can be found in the new docs.

Brand new Tutorial and updated documentation

To reflect the new features such as different types of ABMs or the new handling of multi-agent models we have fully revamped the tutorial and re-written it almost from scratch! We believe the new tutorial makes a better job of guiding a newcomer through all major Agents.jl features. The rest of the documentation has also been updated accordingly to reflect v6.

For more see the changelog!


It was a pleasure to help to build some more infrastructure for agent based modelling. I started to use Julia one year ago and one of the reasons why I started to contribute to Agents.jl was to help myself to learn the language…then I become addicted to improve things here and there :smile:

Really hope the functionalities we developed for this new version will be helpful for people using Agents.jl!


Just want to say this release looks great, thanks all, and great job with the docs, it’s a pleasure to read!


Yes, indeed, a big thank you to @Tortar for all the work. It’s much appreciated!

On a related note, this release also brings a rework of the internals of Agents.jl visualisations. For most users this won’t be noticeable because I tried to keep the necessary changes in line with the previous approach to visualising ABMs. As such, the documentation for plotting static and interactive ABMs hasn’t changed much, see here.

However, the internal changes were necessary to create a more easily approachable API for ABM developers who want to plot their models with custom spaces or who want to change the default plotting behaviour.[1] Agents.jl visualisations now heavily rely on multiple dispatch and by that became more modifiable without having to delve all too deep into the existing code base. Have a look at this section in the developer docs for some more information on what’s possible now. Have fun plotting your ABMs and if you feel anything is missing here, please get in touch. :slight_smile:

  1. Please note that I would still consider this API experimental and subject to change. We’ve tested it with examples from AgentsExampleZoo.jl as well as some custom spaces and are relatively confident that it should cover the most important cases. If you find something that doesn’t work or isn’t clear to you, shoot us a message and we will try to sort things out. ↩︎


Indeed, @fbanning 's plotting re-work was a big step that enabled the AgentBasedModel to be orthogonal to plotting, hence allowing completely new model types to be able to hook up to the plotting interface easily.

Hi all. I’m really enjoying working with Agents.jl, and have just updated my model to v6. Thanks for all your efforts!

I have a question about scheduling multiagent models. I used to use Schedulers.ByType, is there an equivalent for models with the @multiagent macro? Should I use Schedulers.ByProperty with a function that checks the kindof for each agent? Thanks!


yes! In fact, under the hood ByType is ByProperty with typeof function. However in the future we will add a convenience function for it as well.

1 Like

Hello, I am totally new to agents.jl, and I was looking to the Shelling Segregation Model example (that I propose to students in manually-coded way here and I wanted to show them the “ok, now you can use an ABM framework” way).

However that specific example has been removed in the Agents v6 version… would it be possible to port it to v6… it is pretty basic, so I assume it shoudn’t be too complex…


please do not use this thread to ask Agents.jl questions. This thread is for posting update messages for Agents.jl so that people may follow it without getting notifications for other things. Instead, ask a question by opening a new discourse post.

The Schelling example is now the main tutorial, it has not been removed: Tutorial · Agents.jl

1 Like