Generative Agents and Emergent Simulation
Park et al. 2023 (UIST '23, arXiv:2304.03442) populated **Smallville**, a sandbox of 25 agents, with three components: a **memory stream** (a natural-language log), **reflection** (higher-level syntheses the agent writes about its own stream), and a **plan** (day-level behavior, then sub-plans). The headline result is the Valentine's Day party. One agent was seeded with "wants to throw a Valentine's Day party," nothing else was scripted, and invitations spread through the population, dates got coordinated, and the party happened, among 24 agents who started with no knowledge of it. Ablations show all three components are required for believability. The documented failures are spatial-norm errors, like entering closed stores and sharing single-person bathrooms. This is the reference architecture for agent simulations and multi-agent social evaluation in 2026.
Learning Objectives
- Name the three components of the Park et al. 2023 architecture (memory stream, reflection, plan) and what each contributes, using the ablation results.
- Compute a memory's retrieval score from recency, importance, and relevance, and explain why retrieval is ranked rather than filtered.
- Trace how one seeded goal becomes a coordinated party through observation, reflection, and plan with no central orchestrator.
- Run the stdlib miniature, read its output, and identify which parts of the spread are hard-coded versus emergent.
- Describe the three documented failure modes (spatial norm errors, memory overflow, reflection hallucination) and the production mitigations for them.
Problem
Most multi-agent systems are tightly scripted teams: the planner plans, the coder codes, the reviewer reviews. That works for well-defined tasks. It does not produce the unscripted behavior you get when agents have memory, priorities, and an open world. Research, society simulation, and increasingly game AI need that second kind.
Smallville is the benchmark for it. Before Park 2023, the best agent simulations were shallow script-followers. After it, the pattern became the default for generative agents in open worlds. If you build an agent simulation in 2026, you are either using Smallville's three components or you need to justify why you are not.
Concept
The three components
Memory stream. An append-only log of observations, actions, reflections, and plans. Each entry has a timestamp, a type, a description in natural language, and derived metadata: recency, importance (self-rated 1-10 by the agent), and relevance (cosine similarity to the current query).
[2026-02-14 09:12:03] observation: Isabella Rodriguez asked me if I like jazz
[2026-02-14 09:14:22] reflection: I enjoy long conversations about music
[2026-02-14 10:05:00] plan: Attend Isabella's Valentine's Day party tonight
Retrieval combines the three scores: score = w_recency * e^(-decay * age) + w_importance * importance + w_relevance * cos_sim. The top-k entries go into the current prompt.
Reflection. Every N memories, or on an important event, the agent generates higher-order syntheses from its recent memories. Reflection entries go back into the stream and are retrievable like any other memory. This is how agents build "understandings", the architecture's version of long-term beliefs.
Plan. Top-down decomposition. First a day-level plan in broad strokes ("go to work, have dinner with Klaus"), then hour-level plans, then action-level plans. Plans are revisable: when an observation contradicts a plan, the agent replans the affected segment.
Why all three matter (ablation)
Park et al. ran ablations that dropped observation, reflection, and plan in turn. Each ablation hurts believability:
- Without observation the agent misses context and acts on stale beliefs.
- Without reflection the agent cannot form higher-order beliefs, so interactions stay shallow.
- Without plan behavior becomes reactive noise and goals dissipate.
Human raters score believability highest with all three present, and dropping any one produces a measurable regression.
The Valentine's Day emergence
One agent, Isabella Rodriguez, is seeded with the goal "wants to throw a Valentine's Day party at Hobbs Cafe on Feb 14 at 5pm." The 24 other agents receive no such seed. Over simulated days:
- Isabella's plan includes inviting people.
- Each invitation becomes an observation in a neighbor's memory stream.
- That neighbor's reflection generates beliefs: "Isabella is throwing a party."
- The neighbor's plan incorporates "attend party on Feb 14."
- Neighbors tell other neighbors. The invitation spreads without central coordination.
- At 5pm on Feb 14, several agents converge at Hobbs Cafe.
This is emergence in the technical sense. System-level behavior (a party) came out of local interactions (bilateral invitations plus individual planning) with no central orchestrator.
The documented failure modes
Park et al. explicitly document three:
- Spatial norm errors. Agents walk into closed stores, try to use the same single-person bathroom, and eat in rooms not meant for eating. The model does not infer social-physical norms from the environment alone.
- Memory overflow. In deep simulation runs, the cost of memory retrieval grows. The practical remedy is periodic memory compaction (summarize and prune) plus decay on low-importance entries.
- Reflection hallucination. Reflections can invent relationships that are not in the memory stream. Mitigate by including source memory ids in reflection prompts and verifying them at retrieval time.
These show up in production, so any 2026 agent simulation inherits them.
Three-component implementation rules
- Memory is append-only. Don't mutate a memory entry. Corrections are new entries.
- Importance scores are cheap. Call the LLM to rate importance 1-10 at write time and cache the score.
- Retrieval is ranked, not filtered. Take the top-k by combined score. Hard filters lose context.
- Reflection runs periodically. Trigger it when the sum of importance of unprocessed memories exceeds a threshold (e.g., 150).
- Plans are revisable. When a new observation contradicts a plan, regenerate the affected segment only, not the whole plan.
Generative agents beyond Smallville
The 2024-2026 follow-up literature extends the architecture:
- Multi-agent social simulation for policy and market research. Smallville-like populations simulate user behavior in response to features. It is faster than an A/B test, though the accuracy is contested.
- NPC AI for games. RPGs built on Smallville agents produce emergent storylines instead of scripted quests.
- Generative-agent evaluation benchmarks. The metric stops being task accuracy and becomes believability and coherence of behavior over long runs.
The architecture is the reference. Extensions swap components (a vector store for memory, retrieval-augmented reflection, a neurosymbolic plan) but keep the three-part structure.
Why this matters for multi-agent engineering
Smallville is the proof of concept that multi-agent emergence is cheap when the components are right. The architecture has since been replicated on open-source models, and smaller LLMs lose believability gracefully rather than sharply. A production system that needs emergent social behavior takes this shape. A system that needs tight task execution should use the supervisor, roles, and primitives patterns from earlier in this phase.
Build It
code/main.py implements the three components in stdlib Python with scripted agent policies and no real LLM. It reproduces the Valentine's-party emergence in miniature:
MemoryandAgent.stream: an append-only list of observations, reflections, and goals, each with a timestamp and an importance score.retrieve_top_k(stream, query, tick, k): ranks memories by recency, importance, and relevance. Relevance here is keyword overlap, not embedding similarity.Agent.reflect(tick): scripted reflection over recent high-importance memories.Agent.update_plan(tick): adds a plan to attend the party once the agent holds the matching belief.- Scenario: 5 agents over 6 ticks. Agent 0 starts with a goal to host a party at tick 5. Invitations spread on a fixed schedule, and the agents converge.
Run:
python3 code/main.py
Expected output: a tick-by-tick trace, then final locations, then a small retrieval demo. In the default run all 5 agents move to HobbsCafe at tick 5. One seed produced the coordinated arrival without any orchestrator.
Use It
outputs/skill-simulation-designer.md designs a generative-agent simulation. It covers the number of agents, memory schema, reflection cadence, plan horizon, and evaluation metric.
Ship It
Rules for production simulations:
- Memory is the database. Pick a real store (vector DB, Postgres) at scale. In-memory stdlib is for prototypes.
- Log the retrieval trace. For each action, log the top-k memories that drove it. This is how you debug.
- Budget per-agent tokens. An agent's retrieve, reflect, and plan steps cost O(k) LLM calls per tick. N agents × T ticks × calls per tick can dwarf your budget.
- Compact memory periodically. Summarize and prune low-importance entries. Retention policy is a design decision, not a detail.
- Detect spatial and social norm violations explicitly. The architecture does not learn them.
I'd run main.py before rereading the concepts. The trace is short: invitations at ticks 0 to 2, nothing at ticks 3 and 4, and then all five agents move to HobbsCafe at tick 5. Read it next to run_simulation and you can trace which line caused each move.
What you'll notice is how much of the spread is hard-coded. Agent 0 invites agents 1 and 2 at tick 0, agent 1 invites agent 3 at tick 1, and agent 2 invites agent 4 at tick 2, all as fixed if tick == branches. The code demonstrates the pipeline from observation to reflection to belief to plan, not agents deciding whom to tell. That is why exercise 1 needs real work: with 10 agents, agents 5 through 9 are never invited and stay home, so you have to extend the invitation schedule before the question means anything.
I'd also keep the miniature in proportion to the paper. Retrieval adds recency, importance, and relevance with equal weight, uses a decay of 0.3, and scores relevance as 0.6 for a keyword hit and 0.1 otherwise, where the paper's formula uses embedding similarity. Reflection is a string match on "invited" and "party at", so the reflection-hallucination failure and its source-id check never come up here. If you want to feel that failure, swap in an LLM for reflect and log which memories each belief came from.
Exercises
- Run
code/main.py. Confirm 3+ agents converge at the party. Increase agents to 10. Does the emergence still happen? - Remove the reflection step. What does behavior look like? Map to the ablation finding in Park 2023.
- Introduce a competing seeded goal ("Klaus wants to give a research talk at 5pm"). Do agents split, or does one goal dominate? What determines it?
- Add spatial constraints: Hobbs Cafe holds at most 4 agents. Does the simulation handle overflow gracefully, or does it hit the "single-person bathroom" failure pattern?
- Read Park et al. (arXiv:2304.03442) Section 6 (emergent behavior experiments). Identify one behavior not reproducible in your miniature. What component of the architecture would you need to enhance?
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| Memory stream | "The agent's diary" | Append-only log of observations, actions, reflections, plans. |
| Recency | "How new is the memory" | Exponential-decay score by age. |
| Importance | "How much does the agent care" | Self-rated 1-10 at write time. Cached. |
| Relevance | "How related to the current query" | Cosine similarity (embedding-based). |
| Reflection | "Higher-order belief" | Synthesis generated from recent memories, re-ingested as a new memory. |
| Plan | "Day/hour/action decomposition" | Top-down plan tree. Revisable when observations contradict. |
| Smallville | "Park 2023's sandbox" | 25-agent simulation that produced the Valentine's Day emergence. |
| Believability | "The quality metric" | Human-rater score for whether behavior seems like a plausible agent. |
Further Reading
- Park et al., Generative Agents: Interactive Simulacra of Human Behavior: the reference architecture.
- UIST '23 paper page: publication venue.
- Smallville code release: reference Python implementation.
- Hayes-Roth 1985, A Blackboard Architecture for Control: prior art for structured-memory agents.
Code
- main.py (python, 147 lines)