Agent Types

In Loom, agent types are called archetypes. Each archetype becomes a Python class that extends Mesa's Agent base class.

Defining an Archetype

An archetype has two main parts:

  • Properties — Typed instance variables with default values
  • Behaviors — Visual graphs that define step logic

Double-click an archetype name to rename it. The name becomes the Python class name (e.g., "Predator" → PredatorAgent).

Properties

Properties are typed fields on the agent. Click + in the Properties section to add one. Supported types:

TypePython TypeExample Use
intintAge, health points
floatfloatEnergy, speed, wealth
boolboolIs alive, has immunity
strstrName, state label

Properties can be read with Get Property and written withSet Property nodes inside behaviors. You can also drag the G (get) and S (set) handles from the property list directly onto the canvas.

Ordering

The order of archetypes determines the order agents are created at initialization. Use the up/down arrows (visible on hover) to reorder archetypes and behaviors. Behavior order matters — it controls the call sequence in the generated step() method.

Multiple Archetypes

Models can have multiple archetypes. Each archetype is independent — they have their own properties and behaviors. Agents of different types can interact through spatial queries like Get Neighbors.