bug: Reasoning.execute_tool_call() and aexecute_tool_call() use model.steps which does not exist in Mesa 4.x
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 73
- Forks
- 89
- Avg merge
- 14d 58m
- Merged PRs (30d)
- 2
Description
## Describe the bug
`reasoning.py` base class uses `self.agent.model.steps` in both
`execute_tool_call()` and `aexecute_tool_call()`. `model.steps` was
removed in Mesa 4.x, causing `AttributeError` on every tool call
execution across all reasoning strategies — CoT, ReAct, and ReWOO all
call these methods internally.
## To Reproduce
```python
from mesa.model import Model
from mesa_llm.llm_agent import LLMAgent
from mesa_llm.reasoning.cot import CoTReasoning
class MyModel(Model):
def __init__(self):
super().__init__()
self.agent = LLMAgent(
model=self,
reasoning=CoTReasoning,
step_prompt="Do something"
)
model = MyModel()
model.agent.step() # crashes here — model.steps does not exist
```
## Expected behavior
Tool call execution should work correctly in Mesa 4.x using the internal
`_time` attribute as the step counter.
## Actual behavior
```
AttributeError: 'MyModel' object has no attribute 'steps'
```
## Root cause
`reasoning.py` lines 126 and 149:
```python
# Both occurrences — incorrect
plan = Plan(step=self.agent.model.steps, llm_plan=response_message, ttl=ttl)
```
## Fix
```python
plan = Plan(step=int(getattr(self.agent.model, "_time", 0)), llm_plan=response_message, ttl=ttl)
```
## Additional context
The same fix has already been applied in:
- `record_model.py` (PR #195)
- `st_lt_memory.py` (PR #199)
This is the last remaining occurrence of `model.steps` in the codebase.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in reasoning.py at execute_tool_call() and aexecute_tool_call(), especially the two Plan constructions around lines 126 and 149. Compare the related changes in record_model.py and st_lt_memory.py, then run the provided Mesa 4.x reproduction to verify CoT, ReAct, and ReWOO tool calls no longer raise AttributeError and that no model.steps occurrences remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100