[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72690":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":9,"languages":9,"totalLinesOfCode":9,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},72690,"generative_agents","joonspk-research\u002Fgenerative_agents","joonspk-research","Generative Agents: Interactive Simulacra of Human Behavior",null,21509,3017,167,115,0,35,77,224,105,120,"Apache License 2.0",false,"main",[],"2026-06-12 04:01:06","\n\n# Generative Agents: Interactive Simulacra of Human Behavior \n\n\u003Cp align=\"center\" width=\"100%\">\n\u003Cimg src=\"cover.png\" alt=\"Smallville\" style=\"width: 80%; min-width: 300px; display: block; margin: auto;\">\n\u003C\u002Fp>\n\nThis repository accompanies our research paper titled \"[Generative Agents: Interactive Simulacra of Human Behavior](https:\u002F\u002Farxiv.org\u002Fabs\u002F2304.03442).\" It contains our core simulation module for  generative agents—computational agents that simulate believable human behaviors—and their game environment. Below, we document the steps for setting up the simulation environment on your local machine and for replaying the simulation as a demo animation.\n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FIsabella_Rodriguez.png\" alt=\"Generative Isabella\">   Setting Up the Environment \nTo set up your environment, you will need to generate a `utils.py` file that contains your OpenAI API key and download the necessary packages.\n\n### Step 1. Generate Utils File\nIn the `reverie\u002Fbackend_server` folder (where `reverie.py` is located), create a new file titled `utils.py` and copy and paste the content below into the file:\n```\n# Copy and paste your OpenAI API Key\nopenai_api_key = \"\u003CYour OpenAI API>\"\n# Put your name\nkey_owner = \"\u003CName>\"\n\nmaze_assets_loc = \"..\u002F..\u002Fenvironment\u002Ffrontend_server\u002Fstatic_dirs\u002Fassets\"\nenv_matrix = f\"{maze_assets_loc}\u002Fthe_ville\u002Fmatrix\"\nenv_visuals = f\"{maze_assets_loc}\u002Fthe_ville\u002Fvisuals\"\n\nfs_storage = \"..\u002F..\u002Fenvironment\u002Ffrontend_server\u002Fstorage\"\nfs_temp_storage = \"..\u002F..\u002Fenvironment\u002Ffrontend_server\u002Ftemp_storage\"\n\ncollision_block_id = \"32125\"\n\n# Verbose \ndebug = True\n```\nReplace `\u003CYour OpenAI API>` with your OpenAI API key, and `\u003Cname>` with your name.\n \n### Step 2. Install requirements.txt\nInstall everything listed in the `requirements.txt` file (I strongly recommend first setting up a virtualenv as usual). A note on Python version: we tested our environment on Python 3.9.12. \n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FKlaus_Mueller.png\" alt=\"Generative Klaus\">   Running a Simulation \nTo run a new simulation, you will need to concurrently start two servers: the environment server and the agent simulation server.\n\n### Step 1. Starting the Environment Server\nAgain, the environment is implemented as a Django project, and as such, you will need to start the Django server. To do this, first navigate to `environment\u002Ffrontend_server` (this is where `manage.py` is located) in your command line. Then run the following command:\n\n    python manage.py runserver\n\nThen, on your favorite browser, go to [http:\u002F\u002Flocalhost:8000\u002F](http:\u002F\u002Flocalhost:8000\u002F). If you see a message that says, \"Your environment server is up and running,\" your server is running properly. Ensure that the environment server continues to run while you are running the simulation, so keep this command-line tab open! (Note: I recommend using either Chrome or Safari. Firefox might produce some frontend glitches, although it should not interfere with the actual simulation.)\n\n### Step 2. Starting the Simulation Server\nOpen up another command line (the one you used in Step 1 should still be running the environment server, so leave that as it is). Navigate to `reverie\u002Fbackend_server` and run `reverie.py`.\n\n    python reverie.py\nThis will start the simulation server. A command-line prompt will appear, asking the following: \"Enter the name of the forked simulation: \". To start a 3-agent simulation with Isabella Rodriguez, Maria Lopez, and Klaus Mueller, type the following:\n    \n    base_the_ville_isabella_maria_klaus\nThe prompt will then ask, \"Enter the name of the new simulation: \". Type any name to denote your current simulation (e.g., just \"test-simulation\" will do for now).\n\n    test-simulation\nKeep the simulator server running. At this stage, it will display the following prompt: \"Enter option: \"\n\n### Step 3. Running and Saving the Simulation\nOn your browser, navigate to [http:\u002F\u002Flocalhost:8000\u002Fsimulator_home](http:\u002F\u002Flocalhost:8000\u002Fsimulator_home). You should see the map of Smallville, along with a list of active agents on the map. You can move around the map using your keyboard arrows. Please keep this tab open. To run the simulation, type the following command in your simulation server in response to the prompt, \"Enter option\":\n\n    run \u003Cstep-count>\nNote that you will want to replace `\u003Cstep-count>` above with an integer indicating the number of game steps you want to simulate. For instance, if you want to simulate 100 game steps, you should input `run 100`. One game step represents 10 seconds in the game.\n\n\nYour simulation should be running, and you will see the agents moving on the map in your browser. Once the simulation finishes running, the \"Enter option\" prompt will re-appear. At this point, you can simulate more steps by re-entering the run command with your desired game steps, exit the simulation without saving by typing `exit`, or save and exit by typing `fin`.\n\nThe saved simulation can be accessed the next time you run the simulation server by providing the name of your simulation as the forked simulation. This will allow you to restart your simulation from the point where you left off.\n\n### Step 4. Replaying a Simulation\nYou can replay a simulation that you have already run simply by having your environment server running and navigating to the following address in your browser: `http:\u002F\u002Flocalhost:8000\u002Freplay\u002F\u003Csimulation-name>\u002F\u003Cstarting-time-step>`. Please make sure to replace `\u003Csimulation-name>` with the name of the simulation you want to replay, and `\u003Cstarting-time-step>` with the integer time-step from which you wish to start the replay.\n\nFor instance, by visiting the following link, you will initiate a pre-simulated example, starting at time-step 1:  \n[http:\u002F\u002Flocalhost:8000\u002Freplay\u002FJuly1_the_ville_isabella_maria_klaus-step-3-20\u002F1\u002F](http:\u002F\u002Flocalhost:8000\u002Freplay\u002FJuly1_the_ville_isabella_maria_klaus-step-3-20\u002F1\u002F)\n\n### Step 5. Demoing a Simulation\nYou may have noticed that all character sprites in the replay look identical. We would like to clarify that the replay function is primarily intended for debugging purposes and does not prioritize optimizing the size of the simulation folder or the visuals. To properly demonstrate a simulation with appropriate character sprites, you will need to compress the simulation first. To do this, open the `compress_sim_storage.py` file located in the `reverie` directory using a text editor. Then, execute the `compress` function with the name of the target simulation as its input. By doing so, the simulation file will be compressed, making it ready for demonstration.\n\nTo start the demo, go to the following address on your browser: `http:\u002F\u002Flocalhost:8000\u002Fdemo\u002F\u003Csimulation-name>\u002F\u003Cstarting-time-step>\u002F\u003Csimulation-speed>`. Note that `\u003Csimulation-name>` and `\u003Cstarting-time-step>` denote the same things as mentioned above. `\u003Csimulation-speed>` can be set to control the demo speed, where 1 is the slowest, and 5 is the fastest. For instance, visiting the following link will start a pre-simulated example, beginning at time-step 1, with a medium demo speed:  \n[http:\u002F\u002Flocalhost:8000\u002Fdemo\u002FJuly1_the_ville_isabella_maria_klaus-step-3-20\u002F1\u002F3\u002F](http:\u002F\u002Flocalhost:8000\u002Fdemo\u002FJuly1_the_ville_isabella_maria_klaus-step-3-20\u002F1\u002F3\u002F)\n\n### Tips\nWe've noticed that OpenAI's API can hang when it reaches the hourly rate limit. When this happens, you may need to restart your simulation. For now, we recommend saving your simulation often as you progress to ensure that you lose as little of the simulation as possible when you do need to stop and rerun it. Running these simulations, at least as of early 2023, could be somewhat costly, especially when there are many agents in the environment.\n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FMaria_Lopez.png\" alt=\"Generative Maria\">   Simulation Storage Location\nAll simulations that you save will be located in `environment\u002Ffrontend_server\u002Fstorage`, and all compressed demos will be located in `environment\u002Ffrontend_server\u002Fcompressed_storage`. \n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FSam_Moore.png\" alt=\"Generative Sam\">   Customization\n\nThere are two ways to optionally customize your simulations. \n\n### Author and Load Agent History\nFirst is to initialize agents with unique history at the start of the simulation. To do this, you would want to 1) start your simulation using one of the base simulations, and 2) author and load agent history. More specifically, here are the steps:\n\n#### Step 1. Starting Up a Base Simulation \nThere are two base simulations included in the repository: `base_the_ville_n25` with 25 agents, and `base_the_ville_isabella_maria_klaus` with 3 agents. Load one of the base simulations by following the steps until step 2 above. \n\n#### Step 2. Loading a History File \nThen, when prompted with \"Enter option: \", you should load the agent history by responding with the following command:\n\n    call -- load history the_ville\u002F\u003Chistory_file_name>.csv\nNote that you will need to replace `\u003Chistory_file_name>` with the name of an existing history file. There are two history files included in the repo as examples: `agent_history_init_n25.csv` for `base_the_ville_n25` and `agent_history_init_n3.csv` for `base_the_ville_isabella_maria_klaus`. These files include semicolon-separated lists of memory records for each of the agents—loading them will insert the memory records into the agents' memory stream.\n\n#### Step 3. Further Customization \nTo customize the initialization by authoring your own history file, place your file in the following folder: `environment\u002Ffrontend_server\u002Fstatic_dirs\u002Fassets\u002Fthe_ville`. The column format for your custom history file will have to match the example history files included. Therefore, we recommend starting the process by copying and pasting the ones that are already in the repository.\n\n### Create New Base Simulations\nFor a more involved customization, you will need to author your own base simulation files. The most straightforward approach would be to copy and paste an existing base simulation folder, renaming and editing it according to your requirements. This process will be simpler if you decide to keep the agent names unchanged. However, if you wish to change their names or increase the number of agents that the Smallville map can accommodate, you might need to directly edit the map using the [Tiled](https:\u002F\u002Fwww.mapeditor.org\u002F) map editor.\n\n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FEddy_Lin.png\" alt=\"Generative Eddy\">   Authors and Citation \n\n**Authors:** Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, Michael S. Bernstein\n\nPlease cite our paper if you use the code or data in this repository. \n```\n@inproceedings{Park2023GenerativeAgents,  \nauthor = {Park, Joon Sung and O'Brien, Joseph C. and Cai, Carrie J. and Morris, Meredith Ringel and Liang, Percy and Bernstein, Michael S.},  \ntitle = {Generative Agents: Interactive Simulacra of Human Behavior},  \nyear = {2023},  \npublisher = {Association for Computing Machinery},  \naddress = {New York, NY, USA},  \nbooktitle = {In the 36th Annual ACM Symposium on User Interface Software and Technology (UIST '23)},  \nkeywords = {Human-AI interaction, agents, generative AI, large language models},  \nlocation = {San Francisco, CA, USA},  \nseries = {UIST '23}\n}\n```\n\n## \u003Cimg src=\"https:\u002F\u002Fjoonsungpark.s3.amazonaws.com:443\u002Fstatic\u002Fassets\u002Fcharacters\u002Fprofile\u002FWolfgang_Schulz.png\" alt=\"Generative Wolfgang\">   Acknowledgements\n\nWe encourage you to support the following three amazing artists who have designed the game assets for this project, especially if you are planning to use the assets included here for your own project: \n* Background art: [PixyMoon (@_PixyMoon\\_)](https:\u002F\u002Ftwitter.com\u002F_PixyMoon_)\n* Furniture\u002Finterior design: [LimeZu (@lime_px)](https:\u002F\u002Ftwitter.com\u002Flime_px)\n* Character design: [ぴぽ (@pipohi)](https:\u002F\u002Ftwitter.com\u002Fpipohi)\n\nIn addition, we thank Lindsay Popowski, Philip Guo, Michael Terry, and the Center for Advanced Study in the Behavioral Sciences (CASBS) community for their insights, discussions, and support. Lastly, all locations featured in Smallville are inspired by real-world locations that Joon has frequented as an undergraduate and graduate student---he thanks everyone there for feeding and supporting him all these years.\n\n\n","Generative Agents 项目旨在创建能够模拟人类行为的交互式计算代理。其核心功能包括通过生成式模型让这些代理在特定环境中表现出类似人类的行为模式，如决策、社交互动等，并且整个系统基于OpenAI的技术支持运行。技术特点上，它利用了高级的人工智能算法来增强代理的行为仿真能力，同时提供了一个游戏环境作为演示平台。该项目适用于需要研究或开发更加真实的人机交互场景的研究者和开发者，比如虚拟现实应用、复杂系统模拟等领域。",2,"2026-06-11 03:43:11","high_star"]