Skip to content

Parallel Stepping Conflict #162

@hillhack

Description

@hillhack

Parallel Stepping Conflict

mesa-llm enables parallel stepping by patching Mesa's AgentSet.shuffle_do.
When model.agents.step() is executed, it creates a single flat batch of all agents, which are then run concurrently.

The Conflict

The scheduler treats a MetaAgent M and one of its constituent agents A as independent peers and schedules them simultaneously.

If M internally triggers its agents:

for agent in self.agents:
    agent.step()

then A will be stepped twice in the same model tick:

  1. Once by the parallel scheduler
  2. Once by its parent MetaAgent

This leads to inconsistent state updates.


Fix: Create a "Team Badge" (is_component)

Introduce a small internal flag on agents called is_component.

self.is_component: bool = False

Meaning:

  • False → Independent agent (scheduled normally)
  • True → Component of another agent (not scheduled directly)

Behavior

The scheduler ignores agents where:

agent.is_component == True

This ensures that component agents are only stepped by their parent MetaAgent, preventing duplicate execution in a single tick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions