text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKUse casesQA and Chat over DocumentsAnalyzing structured dataExtractionInteracting with APIsChatbotsSummarizationCode UnderstandingAgent simulationsCAMEL Role-Playing Autonomous Cooperative AgentsGenerative Agents in LangChainSimulated Environment: GymnasiumMulti-Player Dungeons & DragonsMulti-agent authoritarian speaker selectionMulti-agent decentralized speaker selectionMulti-Agent Simulated Environment: Petting ZooAgent Debates with ToolsTwo-Player Dungeons & DragonsAgentsAutonomous (long-running) agentsMulti-modalUse casesAgent simulationsGenerative Agents in LangChainOn this pageGenerative Agents in LangChainThis notebook implements a generative agent based on the paper Generative Agents: Interactive Simulacra of Human Behavior by Park, et. al.In it, we leverage a time-weighted Memory object backed by a LangChain Retriever.# Use termcolor to make it easy to colorize the outputs.pip install termcolor > /dev/nullimport logginglogging.basicConfig(level=logging.ERROR)from datetime import datetime, timedeltafrom typing import Listfrom termcolor import coloredfrom langchain.chat_models import ChatOpenAIfrom langchain.docstore import InMemoryDocstorefrom langchain.embeddings import OpenAIEmbeddingsfrom langchain.retrievers import TimeWeightedVectorStoreRetrieverfrom langchain.vectorstores import FAISSUSER_NAME = "Person A"  # The name you want to use when interviewing the agent.LLM = ChatOpenAI(max_tokens=1500)  # Can be any LLM you want.Generative Agent Memory Componentsâ€‹This tutorial highlights the memory of generative agents and its impact on their behavior. The memory varies from standard LangChain Chat memory in two aspects:Memory FormationGenerative Agents have extended memories, stored in a single stream:Observations - from dialogues or interactions with the virtual world,