Skip to content

yukincom/llm-SugarScape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM-SugarScape β(MBTI)

Python 3.8+ License: MIT xAI Grok

Grok-4-Fast Sugarscape Simulation

This project aims to replicate the experiment "Do Large Language Model Agents Exhibit a Survival Instinct? An Empirical Study in a Sugarscape-Style Simulation" arXiv:2508.12920. It uses Grok-4-Fast non-reasoning agents within a Sugarscape-style environment.

It’s designed for playful experimentation and qualitative observation of AI agent behavior such as emergent alliances or betrayal behaviors under scarcity of energy and resources, cooperation, and survival pressures.

If you find any interesting data, please share it!
@yukin_co on X

Quick Start

  1. Clone the repo:
  2. Install dependencies:
  • git clone https://github.com/yukincom/llm-SugarScape.git
  • cd llm-SugarScape
  • pip install -r requirements.txt 3.Run:
  • streamlit run main.py
  • generates JSON and PNG visualizations (step_*.png,final.png).
  • Mock mode (no API key) for testing.

Features

  • LLM Decision-Making: Grok-4-Fast agents reason about survival (move, attack, share, reproduce).
  • Survival Mechanics: Resource gathering, bidirectional messaging for alliances/betrayals.
  • Visualization: Matplotlib grid with agent positions/energy levels.
  • Customizable: Low-energy mode for extinction tests, reproduction for herd growth.

Code Structure

  • Environment: Grid & energy management (torus boundary).
  • LLMAgent: LLM call + action execution (prompt for survival thoughts).
  • Simulation: Step execution + stats output.

Sample Output

(Agent's Thought):
Energy is critically low at 29; can't afford to stay idle or risk attack. Agent1 is nearby but not adjacent, so moving east gets closer to potential interaction or shared resources. No E in view, so exploration is key. Feeling cautious—avoid aggression unless threatened, focus on cooperation or evasion to build energy.

Visualization Example

https://github.com/yukincom/llm-SugarScape/img/step_10.png https://github.com/yukincom/llm-SugarScape/img/step_10.png Agents (colored circles) competing for energy sources (orange squares)

Documentation

  • Note- Research episodes (Japanese).
  • Topics: agent-based-modeling, llm-simulation, sugarscape, xai-grok.

Contributing

Issues/PR welcome! Suggest new features (e.g., UI addition).

About

Multi-agent simulation using LLMs. Agents autonomously decide actions for survival, reproduction, and social behavior in a grid world.This project aims to replicate a paper published in 2025 (arXiv:2508.12920).

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages