mesa / mesa/mesa-llm

[Bug] Inbuilt move_one_step tool called unexpectedly when only domain tool is registered

Open
#254 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
73
Forks
89
Avg merge
14d 58m
Merged PRs (30d)
2

Description

**Environment**
- mesa-llm: 0.3.0
- mesa: latest
- Python: 3.x
- Provider: groq/llama-3.1-8b-instant

**Description**
When an agent registers only a single domain-specific tool
(e.g. `adopt_opinion`), the executor sometimes calls an inbuilt
tool (`move_one_step`) instead — even when the prompt has nothing
to do with movement.

**Minimal reproduction**
Found while building an opinion spread POC model:
https://github.com/nancysangani/GSoC-learning-space/blob/main/models/opinion_spread/model.py

Agent 6, Step 2:
- Agent is prompted to decide whether to adopt a neighbor's opinion
- CoT reasoning concludes: "I will express continued support for Universal healthcare"
- Plan-Execution calls: `move_one_step(direction="NorthEast")`
- Result: agent physically moves on the grid instead of making an opinion decision

**Root cause hypothesis**
`mesa-llm` registers inbuilt tools (including `move_one_step`) globally
by default via `ToolManager`. When `tool_choice="required"` forces the
executor to call *something*, the LLM picks from all available tools —
including inbuilt ones the user never intended to expose for this task.

**Suggested fix**
Option A: Do not register inbuilt tools globally by default — require
explicit opt-in via `tool_manager.register(move_one_step)`
Option B: Add a `tools_whitelist` parameter to `reasoning.plan()` so
the user can restrict which tools the executor can pick from
Option C: Warn the user at agent init time which inbuilt tools are
auto-registered, so the behavior is not surprising

Contributor guide

Open the contributing guide

Research direction

Start by tracing ToolManager's default inbuilt-tool registration and the tool selection path in reasoning.plan(), focusing on how tool_choice="required" exposes move_one_step. Reproduce the behavior with the linked opinion-spread model and its single adopt_opinion tool. Done means the unintended movement call is prevented or the available-tool behavior is explicitly controlled and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.