Getting Started#

Mesa-LLM is an extension of the Mesa agent-based modeling framework that enables language-model-based reasoning inside agents, while preserving Mesa’s execution model, scheduling, and environments.

Mesa-LLM allows agents to reason using natural language prompts, enabling more flexible, interpretable, and adaptive decision-making within structured simulations.

Agents in Mesa-LLM are still standard Mesa agents. The only difference is how decisions are made, not how models run.

Overview#

If you want a high-level understanding of Mesa-LLM structure and capabilities, start here:

LLM Backend Setup#

Mesa-LLM leverages various LLM providers through the LiteLLM library. To run the examples and tutorials, you typically need one of the following:

  • Local LLM (Default in Tutorials): Ollama is used for local inference. It must be installed, and the local server must be running at http://localhost:11434.

  • Cloud LLM: Providers like OpenAI, Anthropic, or Gemini require an API key set in your environment variables.

Refer to the Tutorial Setup section in the first tutorial for more details on Ollama setup.

For provider-specific setup, including cloud API keys and custom Ollama endpoints, see Basic LLM Setup and Custom API Endpoints.

Tutorials#

If you want to learn Mesa-LLM step by step, follow these tutorials:

Examples#

Mesa-LLM ships with example models demonstrating how language-based reasoning integrates with classic agent-based modeling patterns.

These examples are useful if you are already familiar with Mesa and want to see how LLM-powered agents behave in practice. You can find them here: Mesa-LLM Examples

Source Code#

Community and Support#