Examples#

The examples folder contains LLM agent-based models implemented using Mesa-LLM. They serve as demonstrations of Mesa-LLM’s capabilities and starting points for your own models.

This folder contains both basic and advanced examples that demonstrate different aspects of Mesa-LLM.

Epstein Civil Violence Model#

Joshua Epstein’s model of how a decentralized uprising can be suppressed or reach a critical mass of support.

Location: examples/epstein_civil_violence

This example demonstrates:

  • Agent decision-making based on social dynamics

  • LLM-powered agent reasoning in conflict scenarios

  • Integration of multiple agent types with different behaviors

Negotiation Model#

Implementation of a negotiation model where two types of agents (buyer and seller) negotiate over a product.

Location: examples/negotiation

This example demonstrates:

  • Agent-to-agent communication

  • LLM-based negotiation strategies

  • Dynamic pricing and offer-counteroffer mechanisms

Sugarscrap-g1mt Model#

Implementation of Epstein & Axtell’s classic Sugarscape (G1MT) model, where Trader agents harvest resources (Sugar & Spice), consume them according to metabolic needs, and trade with neighbors based on economic rationality (MRS).

Location: examples/sugarscrap_g1mt

This example demonstrates:

  • LLM-powered survival decision-making

  • Resource regeneration and environmental dynamics

  • Marginal Rate of Substitution (MRS)-driven economic behavior

  • Emergent price equilibrium and wealth distribution