mesa / mesa/mesa-llm

Parallel Stepping Conflict

Open
#162 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
73
Forks
89
Avg merge
14d 58m
Merged PRs (30d)
2

Description

## 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:

```python
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`.

```python
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:

```python
agent.is_component == True
```

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the mesa-llm patch around Mesa's AgentSet.shuffle_do and the model.agents.step() entry point, then inspect how MetaAgent invokes its constituent agents. Confirm the scheduler can distinguish component agents from independent agents, and verify that a component is stepped once through its parent rather than again as a parallel peer.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.