Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
Generative Agents,
explained.
Twenty-five AI characters were placed in a pixel-art town with homes, a café, a bar, and one seeded idea: Isabella wants to throw a Valentine's Day party. Two simulated days later, invitations had spread through gossip, someone had asked someone on a date, and five agents walked into the café at the right hour. Nobody scripted any of it. The paper behind "Smallville" is really a paper about one question: what does it take for an LLM to stay in character for a lifetime?
Contents 16 sections
The delta Chatbots forget; characters can't The memory stream: a life, logged Retrieval: recency × importance × relevance Reflection: from events to beliefs Plans that bend without breaking The party, and the evidence Why it still matters How it works The math The evidence Since then Solve it yourself Questions Check yourself Where this sitsWhat changes against task agents: the objective is believability over time
Rungs 1 to 4 optimise task completion. This rung asks a different question — can a population of agents behave plausibly, as characters with histories, over days of simulated time — and the change of objective changes what the architecture must provide. A task agent can forget everything when the task ends. A character cannot, because consistency with its own past is the thing being evaluated.
So memory becomes the system. A memory stream records observations as natural-language entries, and the essential part is how retrieval scores them: by recency, importance and relevance together. Recency alone forgets what mattered; relevance alone surfaces the same few entries forever; and importance is scored by the model when the memory is written, so a proposal of marriage does not compete on equal footing with what was for breakfast.
Two mechanisms build on top of it, and both are about producing behaviour a log cannot. Reflection periodically reads recent memories and writes higher-level conclusions back into the stream — so the agent holds generalisations about people and itself, not only events, and those reflections can themselves be reflected on. And hierarchical planning decomposes a day into hours and hours into actions, with re-planning when something interrupts, which is what keeps behaviour coherent across a long horizon instead of locally sensible and globally aimless. What emerges from the combination is the reported result: information spreading between agents, coordination nobody scripted, relationships that persist.
Chatbots forget; characters can't
An LLM can play a barista for ten minutes. But a believable character has to remember Tuesday's conversation on Friday, hold opinions that build over weeks, keep a daily routine, and react when life interrupts it — all far beyond what fits in a context window. Stuff the raw history in and it overflows; summarize it and the texture of a life vanishes.
The authors' framing predates the agents boom and still cuts deepest: believability isn't a model property, it's an architecture property. The paper's three mechanisms — memory, reflection, planning — are the minimum machinery of a persistent self.
The memory stream: a life, logged
Everything an agent perceives becomes a timestamped natural-language record in its memory stream: "Isabella is decorating the café," "Klaus said he's researching gentrification," "the stove is on fire." Thousands of entries accumulate — a complete experiential log, none of it in context by default.
The stream is deliberately raw and complete. No premature summarization, no discarding — because the architecture's other two mechanisms (retrieval and reflection) decide later what matters. Storage is cheap; judgment is deferred to the moment it's needed.
Retrieval: recency × importance × relevance
At each decision, the agent pulls the handful of memories that should shape it, scored by a weighted sum of three signals:
exponential decay since last access
LLM-rated 1–10 at write time
embedding match to now
The importance score is the quietly brilliant one: at write time, the LLM rates how notable the event is ("ate breakfast" = 1, "broke up with partner" = 9), so momentous memories keep surfacing months later while noise sinks. The triple — recency, importance, relevance — has since become the standard scoring recipe in agent memory systems.
Concretely, each memory's retrieval score is just the sum of the three normalized signals:
Because importance is fixed high for big events, a 3-day-old breakup still outscores this morning's breakfast — while a query about someone's work pulls the relevant memory to the top. The runnable version below shows exactly that flip.
Reflection: from events to beliefs
Raw observations alone make a diarist, not a person. Periodically — when recent importance accumulates past a threshold — the agent reflects: it asks itself the most salient questions about its recent experience, answers them, and writes the conclusions back as new memories citing their evidence.
Reflection: "Klaus is deeply committed to his gentrification research."
Later reflection, citing that one: "Klaus would rather talk about ideas than gossip."
Reflections cite reflections, building a tree of abstractions — the agent literally develops opinions about itself and others that no single observation contains. When Klaus is asked who he'd like at a dinner party, the answer comes from this tree, not from replaying a thousand café scenes.
Plans that bend without breaking
Coherent days need intent. Each agent drafts a day plan in broad strokes ("morning: open the café"), recursively decomposes it into hour- and minute-level actions, and stores the plan in the memory stream — where it competes with everything else. When the world interrupts (a burning stove, an unexpected conversation), the agent reacts, then re-plans the rest of the day around what just happened.
Top-down plans + bottom-up reactions, reconciled through one memory system. That balance — routine without rigidity, reactivity without chaos — is what reads as "alive," and what pure prompt-loop agents never had.
The party, and the evidence
Seed one intention — Isabella wants to host a Valentine's party — and let the simulation run. Over two days: Isabella invites customers; invitees remember and tell others; Maria asks Klaus on a date to the party; five agents arrive at the café at 5pm on the right day. Information diffusion, relationship formation, and coordination — none of it scripted.
| Condition (human judges, interviews) | Believability |
|---|---|
| Full architecture | Most believable — beat even human-authored roleplay in the study |
| No reflection | drops — agents stay shallow, no formed opinions |
| No reflection and no planning | drops further |
| No memory stream access at all | lowest of the architecture conditions — agents contradict their own history |
The ablations are the scientific spine: removing reflection, then planning, then memory access each lowered believability in turn. Memory, reflection and planning aren't features — they're load-bearing.
Why it still matters
Smallville handed the field its memory architecture. The stream + scored retrieval + periodic reflection pattern runs, in some dress, inside most persistent assistants and agent frameworks today — and MemGPT systematized the storage side of the same problem months later. The importance-scored, self-reflecting memory is this paper's fingerprint on production systems.
It also opened the social simulation frontier: populations of agents as laboratories for studying information spread, coordination, and collective behavior — and as the engine behind character-driven games and worlds. And it left a warning the authors made explicitly: agents this believable invite parasocial attachment and manipulation. The more lifelike the simulacrum, the more the guardrails matter.
The trilogy's other panels: Reflexion (learning from failure) and Voyager (skills that compound). The production blueprint: Agent Memory System Design.
How a Smallville agent records, retrieves, reflects and plans
Each of the 25 agents is the same architecture wrapped around gpt-3.5-turbo; GPT-4's API was invitation-only at the time. The town is a sandbox built with the Phaser game framework, and a server translates between game state and text.
- Seed an identity. The authors wrote one paragraph per agent covering occupation and relationships, split into separate seed memories.
- Record observations. At each step the agent perceives nearby agents, objects and its own actions, and each perception becomes a memory object holding a natural-language description, a creation time and a last-access time.
- Rate importance once. When a memory is created the model rates its poignancy from 1, purely mundane like brushing teeth, to 10, like a breakup or a college acceptance. In the paper's example, cleaning up the room scores 2 and asking a crush out scores 8.
- Retrieve by three scores. For the current query, each memory gets recency (exponential decay of 0.995 per sandbox hour since it was last retrieved), its importance, and relevance (cosine similarity between embeddings of the memory and the query). Each score is min–max scaled to the range 0 to 1, the three are added with equal weights, and the top memories that fit the context window go into the prompt.
- Reflect when enough has happened. When the importance scores of recent events sum past 150, the agent reflects, which worked out to two or three times a game day. It takes its 100 most recent memories, asks for the 3 most salient high-level questions they can answer, retrieves memories, including earlier reflections, for each question, and asks for 5 high-level insights, each citing the numbered memories it rests on. The insights are stored as reflections with pointers to their evidence, so reflections on reflections form a tree.
- Plan from the top down. The agent drafts its day in five to eight broad chunks from its summary description and a summary of the previous day, then recursively splits them into hour-long chunks and then into 5 to 15 minute actions. Plans are stored in the memory stream too, so they are retrieved like anything else.
- React and talk. At every step the model is asked whether to continue the plan or react to what was just observed; a reaction regenerates the plan from that moment. Dialogue is generated turn by turn, each line conditioned on what the speaker remembers about the other person.
- Ground actions in the map. The world is a tree of areas and objects, and each agent keeps its own partial copy that can go stale when it leaves an area. To place an action, the agent walks its tree from the root, asking the model for the most suitable area at each level. The model is also asked how the action changes the object, such as a cafe coffee machine going from off to brewing.
The Smallville retrieval score and reflection trigger
h— sandbox hours since m was last retrieved, not since it was created, so a memory that keeps being used stays fresh.importance— the model's 1 to 10 poignancy rating, fixed when the memory is written.em, eq— embeddings of the memory text and of the query.α— the weights, all set to 1 in the paper's implementation.
The decay is slow: 0.995^h halves after about 138 sandbox hours, close to six game days. Because each term is rescaled over the candidates, what counts is spread rather than absolute value: a term that is nearly equal across memories contributes almost nothing to the ranking, while the top candidate on any term always scores 1 on it. Set the relevance weight to zero and the agent retrieves the same few recent, important memories whatever it is asked; set the importance weight to zero and a breakup competes on equal terms with breakfast.
How Smallville was measured: interviews, ablations and two simulated days
The controlled evaluation interviewed agents with 25 questions in five categories: self-knowledge, memory, plans, reactions and reflections. Each question was answered under five conditions, and 100 evaluators recruited online ranked the answers for believability. Ranks became TrueSkill ratings, tested with Kruskal-Wallis and Dunn post-hoc tests.
| Condition | TrueSkill μ (σ) |
|---|---|
| Full architecture | 29.89 (0.72) |
| No reflection | 26.88 (0.69) |
| No reflection, no planning | 25.64 (0.68) |
| Human crowdworkers writing in character | 22.95 (0.69) |
| No observation, reflection or planning | 21.21 (0.70) |
Each component removed lowered believability, and the full architecture beat the memoryless condition, which stands in for earlier LLM agents, by an effect size of 8.16 standard deviations. Every pairwise difference was significant except between the two worst conditions, crowdworkers and the memoryless baseline.
The two-day simulation was measured too. Knowledge of Sam's mayoral candidacy spread from one agent (4 percent) to eight (32 percent), and of Isabella's Valentine's party from one to thirteen (52 percent); none of the agents who claimed to know had hallucinated it. Network density rose from 0.167 to 0.74, and 6 of 453 answers about other agents (1.3 percent) were hallucinated. Five of the twelve invitees came to the party; of the seven who did not, three cited conflicts and four had said they were interested but made no plan to go.
The failures are specific. As memories accumulated, agents chose odder places, such as lunch at the bar once they learned it existed. Norms not written into the world description were broken: agents entered a one-person dorm bathroom that was occupied, and shops after their 5 pm closing. Instruction tuning made agents formal and agreeable, and Isabella rarely said no to party ideas that did not fit her. Agents also embellished, as when Yuriko described her neighbor Adam Smith as the author of Wealth of Nations. The whole run cost thousands of dollars in token credits.
What the authors admit, and what happened next
The cost is acknowledged and is the main barrier: every agent's every step is model calls, and reflection and planning add more, so a couple of dozen agents for a few simulated days is a serious bill. Nothing about the design is cheap, and scaling the population scales the cost linearly at best.
The evaluation is believability judged by human raters, which is the honest measure for the objective and a soft one — there is no ground truth for what a character should do next, so results cannot be compared the way a benchmark score can. The paper is straightforward that the emergent social behaviours were measured in a single two-day run of 25 agents, which is an existence demonstration rather than a controlled effect, and the popular retelling of them was considerably less careful.
Reflection can also compound error: a generalisation inferred from a misunderstanding becomes a durable belief that colours every later retrieval, with nothing to correct it.
How it held up: the memory-stream-plus-scored-retrieval design is the standard answer to agent memory, and the three-way scoring is copied directly in systems that have nothing to do with simulated towns. Reflection as a distinct write-back step — the agent generating summaries of itself — is the other idea that spread. Rung 6 takes issue with one thing here: that the memory is managed for the agent by a retrieval policy someone else chose.
Score a memory stream
Which memories should surface right now? The paper's answer — copied into agent frameworks ever since — is a sum of three signals: recency (exponential decay), importance (an LLM rating 1–10), and relevance (match to the query). Run it over a little life-log and watch the flip: with no particular query, a 3-day-old breakup outranks this morning's breakfast because importance carries it; ask "what is this person researching?" and the gentrification memory leaps to the top on relevance. Change the ratings or the query.
Write the body of retrieve. Everything else in the file is
already written; this is the function the paper is about. Press ▶ Run to check it against
the 5 assertions below — they start red.
- Recency decays exponentially with age
- Importance is the 1-10 rating normalized to 0..1
- Relevance rises with query keyword overlap
- An important old memory outranks a trivial recent one on a blank query
- A relevant memory jumps to the top for its own query
Questions people ask about Generative Agents
What is the retrieval function in the Generative Agents paper?
Every memory gets a score that adds three terms with equal weights. Recency is an exponential decay with factor 0.995 per sandbox hour since the memory was last retrieved. Importance is a 1 to 10 poignancy rating the language model assigns when the memory is created, from mundane events like brushing teeth to life events like a breakup. Relevance is the cosine similarity between the embedding of the memory and the embedding of the current query. Each of the three is min-max scaled to the range 0 to 1 across the candidate memories before they are added, and the highest-scoring memories that fit in the context window go into the prompt.
How does reflection work in the Smallville agents?
Reflection is triggered when the importance scores of the agent's latest events add up past a threshold of 150, which in practice happened two or three times a game day. The agent takes its 100 most recent memories and asks the model for the three most salient high-level questions they can answer. Each question is used as a retrieval query, pulling in relevant memories and earlier reflections. The model is then asked for five high-level insights, each citing the numbered memories that support it. Those insights are stored back in the memory stream as reflections with pointers to their evidence, so later reflections can build on earlier ones and form a tree.
Did the Smallville paper measure information spreading between agents?
Yes, over the two-day end-to-end simulation. At the start only Sam knew he was running for mayor and only Isabella knew about her Valentine's Day party, one agent each, or 4 percent of the town. By the end, eight agents (32 percent) knew of the candidacy and thirteen (52 percent) knew of the party, with no user intervention, and the authors checked that none of the agents claiming to know had hallucinated it. They also measured relationship formation, with network density rising from 0.167 to 0.74, and coordination: five of the twelve invited agents showed up at the cafe on the day.
Which parts of the generative agent architecture mattered most in the ablations?
All of them, in order. Human evaluators ranked interview answers from five conditions, converted into TrueSkill ratings. The full architecture rated highest at 29.89. Removing reflection dropped it to 26.88, removing reflection and planning to 25.64, and removing all access to the memory stream, which stands in for earlier LLM agents, to 21.21. Human crowdworkers writing answers in character scored 22.95, below every condition that had memory. The gap between the full architecture and the memoryless baseline was an effect size of 8.16 standard deviations, and every pairwise difference was significant except crowdworkers against the memoryless baseline.
Where did the Smallville agents go wrong?
The authors list three recurring failure modes. First, as agents accumulated memories and learned more places, retrieval and location choice got worse, and some started eating lunch at the bar, a spot meant for evenings. Second, physical norms that were not written into the world's descriptions were broken, such as agents entering a one-person dorm bathroom that was in use, or shops after their 5 pm closing. Third, instruction tuning made agents overly formal and cooperative; Isabella rarely refused party suggestions even when they did not fit her. In interviews agents also embellished, sometimes with world knowledge from the language model, as when a neighbor named Adam Smith was credited with writing Wealth of Nations.
How much did it cost to run the Smallville simulation?
The paper does not give an exact figure, but the authors say simulating 25 agents for two game days cost thousands of dollars in token credits and took multiple days to complete, using gpt-3.5-turbo. Every agent step involves several model calls: rating the importance of new memories, retrieving, deciding whether to react, planning, placing actions in the world and generating dialogue, with reflection adding more. The authors suggest parallelizing agents, or building language models designed specifically for generative agents, as ways to make the architecture cheaper and closer to real time.
4 questions to test what you just read
Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.
Recency decays by 0.995 per sandbox hour since a memory was last retrieved. After how many hours has an unused memory's raw recency halved, and why does retrieval keep some memories young?
Show answer
0.995^h = 0.5 gives h = ln 0.5 / ln 0.995 ≈ 138 hours, almost six game days. The clock resets on retrieval, not on creation, so a memory that keeps being pulled into prompts stays recent while one that is never used fades.
Isabella's party invitation spread from 1 agent to 13 of 25 in two days, yet only 5 of 12 invitees came. What do the paper's follow-up interviews reveal about the gap between hearing about an event and attending it?
Show answer
Attending needs more than a memory: the agent must retrieve the invitation while planning and fit it into its day. Of the seven who stayed away, three cited conflicting plans and four said they were interested but never planned to go, so the invitation was remembered without shaping the schedule.
Because each retrieval score is min-max scaled over the candidates, what happens to the ranking if every candidate memory has the same importance rating?
Show answer
Min–max scaling divides by the range, so with no spread the importance term carries no ranking information (it is constant, or undefined in a naive implementation) and recency and relevance alone decide the order. A term only steers retrieval to the extent the candidates differ on it.
Agents without reflection scored 26.88 against 29.89 for the full architecture. Which kind of interview question should reflection help most, and why?
Show answer
Questions that need synthesis, such as choosing a companion or a gift. Raw observations favor whoever the agent meets most often; reflections hold generalizations, like what someone is passionate about, that no single observation states. In the paper's example, without reflection Klaus picks his dorm neighbor Wolfgang, whom he only sees in passing.
Agents that act
Give the model a tool, then a loop, then a memory, then a world. Ends on the 2026 paper measuring how badly the whole stack degrades over many turns.
- 1ReAct2023
- 2Toolformer2023
- 3Reflexion2023
- 4Voyager2023
- 5Generative Agents2023
- 6MemGPT2023
- 7LLMs Get Lost in Multi-Turn Conversation2026
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Paper Breakdowns
- MemGPTAn operating system for LLM memory. Context window as RAM, external storage as disk, and the model as its own memory manager — paging facts in and out with function calls, revising core memories when facts change, and summarizing under memory pressure. The architecture behind modern agent memory (and Letta).Read →
- ReflexionAgents that learn from their own mistakes — reinforcement through words instead of weights. Fail, write a verbal reflection on why, store it in episodic memory, retry with the lesson in context. Actor + Evaluator + Reflector took GPT-4 from 80% to 91% on HumanEval, and the pattern now lives inside every self-correcting agent.Read →
- VoyagerThe Minecraft agent that never stops learning. An automatic curriculum picks the next just-hard-enough goal, the agent writes code to achieve it, debugs against environment feedback, and saves every verified program to a compounding skill library. 3.3× more items, 15.3× faster tech tree — and the blueprint for agents that build their own tools.Read →
- LLMs Get Lost in Multi-Turn ConversationThe ICLR 2026 Outstanding Paper that measured a failure everyone had felt: give a top model a fully-specified task in ONE prompt (concat) and it shines; split the IDENTICAL requirements across several turns (sharded) and 15 leading LLMs fall apart — ~39% average drop. The decomposition is the punchline: APTITUDE (best-case ability) barely moves, but RELIABILITY craters — the spread between a model's best and worst runs roughly DOUBLES. The mechanism is premature commitment: handed partial info, the model guesses a full answer early, locks it in, and when a later turn contradicts it "gets lost and does not recover." A small decay model captures the shape — concat R=p (flat), sharded R=p·(1−q)^(turns−1) (geometric decay), so longer chats get less reliable and the whole loss lives in a reliability term while the ceiling p is untouched. Fixes: front-load the spec, or consolidate/recap a long chat back into one fresh full-spec message. Worked math plus runnable code.Read →
- AlexNetThe paper that started the deep learning revolution. AlexNet won ImageNet 2012 by a landslide — cutting top-5 error from ~26% to ~15% — proving deep CNNs with big data and GPUs beat decades of hand-engineered features. ReLU, dropout, GPU training, and data augmentation, explained.Read →
- Seq2SeqTeaching neural nets to translate. An encoder LSTM reads an input sentence into a single fixed vector; a decoder LSTM writes the translation out. The architecture that made neural machine translation work — and whose fixed-vector bottleneck directly motivated the attention mechanism.Read →