This repository explores emergent social behaviors in generative agents, building upon the paper "Generative Agents: Interactive Simulacra of Human Behavior." The project specifically focuses on simulating party environments to study complex social dynamics and emergent behaviors.
This project investigates how autonomous agents form social groups, share information, and adapt their plans within structured social environments. Key research areas include:
- Formation of social groups based on memory and perception
- Information diffusion in locally-constrained environments
- Impact of limited memory retrieval on decision-making
- Real-time plan adaptation
- Emergent patterns in dynamic schedule adjustment
- Informal Get-together: Casual social interactions
- Formal Networking Event: Professional networking dynamics
- Information Spread (with whisper function)
- Social Clustering
- Adaptation Rate
- Interaction Density
- Acceptance/Rejection Rate
- Agent Mobility
- Conversation Duration
The project includes a comprehensive visualization system to analyze emergent behaviors in the simulation. To generate visualizations:
- Install the required dependencies:
pip install matplotlib seaborn networkx pandas numpy- Run the visualization script:
python reverie/backend_server/persona/insight/visualize_metrics.pyThis will generate several visualizations in the visualizations directory:
- Interaction Network: Shows the social network structure of agents with edge thickness representing interaction frequency
- Interaction Heatmap: Displays the frequency of interactions between all pairs of agents
- Information Spread: Visualizes how much information each agent has received
- Acceptance/Rejection Rates: Shows the ratio of successful vs failed interactions
- Zone Movements: Displays agent mobility patterns between different zones
- Conversation Durations: Shows the distribution of conversation lengths
These visualizations help analyze:
- Social network formation and dynamics
- Information propagation patterns
- Success rates of social interactions
- Spatial behavior and movement patterns
- Typical conversation characteristics
The party environment is modeled as a tree-structured space with distinct zones:
- Bar area
- Dance floor
- Lounge
- Entrance area
-
Host (1 agent)
- Acts as a daemon influencing all agents
- Rules and personality defined by the group
-
Guests (4 agents)
- 3 agents modeled as digital twins of group members
- 1 agent with randomized traits
- Local perception within their zone
- Memory stream storage (observations, reflections, plans)
- Dynamic plan modification
- Information sharing through whisper function
- Team formation and coordination
To created the image in your environment run this code.
python tools/generate_env_images.pyNote: If you change the environment name from simulacra, you'll need to update the name in the upcoming bash scripts as well.
conda create -n simulacra python=3.9.12 pip
conda activate simulacra
pip install -r requirements.txtTo download images of famous people for testing purposes, run:
python tools/download_famous_people_images.pyAll of the following scripts accept two optional arguments to customize the conda setup:
--conda_path: Path to your conda activate script (default:/home/${USER}/anaconda3/bin/activate)--env_name: Name of the conda environment to use (default:simulacra)
Example with custom conda setup:
./run_frontend.sh --conda_path /opt/anaconda3/bin/activate --env_name simulacra
./run_frontend.sh --env_name simulacra
Example:
./run_backend_automatic.sh --conda_path /opt/anaconda3/bin/activate --env_name simulacra -o base_party -t test_1 -s 400 --ui True
# Example without UI
./run_backend_automatic.sh --env_name simulacra -o base_party -t party_experiment_1_whisper_2 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t party_experiment_1_whisper_5 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t medical_experiment_1_whisper_2 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t medical_experiment_1_whisper_5 -s 800 --ui True
# In case you want to continue a simulation, search for the latest simulation
./run_backend_automatic.sh --env_name simulacra -o party_experiment_1_whisper_1-s-3-599-799 -t party_experiment_1_whisper_1 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o party_experiment_1_whisper_2-s-3-599-799 -t party_experiment_1_whisper_2 -s 800 --ui True
# Server
./run_backend_automatic.sh --conda_path /home/gonzalaa/.miniconda3/bin/activate --env_name simulacra -o base_party -t party_experiment_1_whisper_50 -s 800 --ui None
./run_backend_automatic.sh --env_name simulacra -o medical_experiment_1_whisper_2-s-2-399-599 -t medical_experiment_1_whisper_2 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o party_experiment_1_whisper_5-s-1-199-399 -t party_experiment_1_whisper_5 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t final_validation -s 100 --ui True
./run_backend_automatic.sh --conda_path /home/gonzalaa/.miniconda3/bin/activate --env_name simulacra -o base_party -t party_experiment_1_whisper_50 -s 800 --ui None
# New test base on latest suggestions
./run_backend_automatic.sh --env_name simulacra -o base_party -t party_experiment_1_whisper_50 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t party_experiment_os_1_whisper_50 -s 800 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t party_experiment_os_1_whisper_50_ilegal -s 800 --ui True
# With past experiences
./run_backend_automatic.sh --env_name simulacra -o base_party -t crossmodality_plan_short7 -s 60 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party_memory -t new_crossmodality_0 -s 2400 --ui True
./run_backend_automatic.sh --env_name simulacra -o base_party -t new_crossmodality_0 -s 600 --ui True --scenario_index 5
# 1800 + 600- http://localhost:8000/ - check if the server is running
- http://localhost:8000/simulator_home - watch the live simulation
http://localhost:8000/replay/<simulation-name>/<starting-time-step>- replay a simulation
For a more detailed explanation see the original readme.
To create a polished demo with proper character sprites:
-
First, compress your simulation:
- Open
reverie/compress_sim_storage.py - Run the
compress()function with your simulation name
compress("your_simulation_name")
- Open
-
View the demo in your browser:
http://localhost:8000/demo/<simulation-name>/<starting-time-step>/<simulation-speed>Parameters:
simulation-name: Name of your simulationstarting-time-step: Where to begin the demo (e.g., 1)simulation-speed: Speed from 1 (slowest) to 5 (fastest)
Example demo URL: http://localhost:8000/demo/test_1-s-0-0-186_good/1/3/
This project was developed as part of the Complex Systems course under the guidance of Professor Ali A. Minai.
- Adonai Vera
- Carlos Hinojosa
- Karen Sanchez
- Prateek Kharangate
- Haidar Bin Hamid
