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:
| Type | Python Type | Example Use |
|---|---|---|
| int | int | Age, health points |
| float | float | Energy, speed, wealth |
| bool | bool | Is alive, has immunity |
| str | str | Name, 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.