mesa / mesa/mesa-llm

Spatial API Unification

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

Description

Currently, mesa-llm manually checks for both legacy `pos` (from `mesa.space`) and `cell.coordinate` (from `mesa.discrete_space`) in multiple places.
This change introduces a unified spatial API within `LLMAgent`.

### Proposed Changes

**[MODIFY] `llm_agent.py`**

- Add `@property pos` that returns the correct coordinate by checking both `self.cell` and base `Agent.pos`.
- Add `move_to(pos)` method:
- Uses `grid.move_agent()` for `mesa.space`
- Updates `self.cell` for `mesa.discrete_space`
- Update `_build_observation()` to use `self.pos`.

**[MODIFY] `inbuilt_tools.py`**

- Remove `_get_agent_position` helper.
- Update `@requires` decorators to use `agent.pos`.
- Simplify `move_one_step` and `teleport_to_location` to use `agent.pos` and `agent.move_to()`.

Contributor guide

Open the contributing guide

Research direction

Start with llm_agent.py and inbuilt_tools.py, then read the existing mesa.space and mesa.discrete_space handling around LLMAgent, _build_observation(), and the movement tools. Done means both spatial APIs use LLMAgent.pos and move_to(), the helper is removed, and observation and movement behavior remain correct for both cases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.