Skip to content

WorldSimMulti-agent community simulation

Simulate how communities react to new rules, events, or policies — in TypeScript, in 5 minutes.

What is WorldSim?

WorldSim is an embeddable multi-agent simulation engine for Node.js. You define a world, add agents with personalities and goals, optionally load rules or a crisis trigger, then let the engine advance tick by tick while agents reason, talk, use tools, build relationships and produce a report.

Use it when you want to test questions like:

  • How does a village react to water rationing?
  • How does a marketplace respond to a price shock?
  • How does a rumor spread through social groups?
  • What changes when agents only hear or see what is physically near them?

How WorldSim Works

At runtime WorldSim is a loop around five ideas:

ConceptWhat it means
WorldThe container for time, agents, rules, plugins, stores and reports.
TicksDiscrete simulation steps. A tick can represent a minute, an hour, a day or any turn in your scenario.
AgentsLLM-driven actors with personality, mood, energy, memory, goals and optional tools.
RulesJSON/PDF instructions evaluated by governance agents to warn, block or allow actions.
PluginsExtension points for logging, reports, Studio, phones, movement, perception, custom tools and domain logic.

The default interaction model is simple and backward-compatible: agent speech is routed through conversations, neighborhoods, proximity and finally broadcast. For more realistic worlds you can opt into the perception layer, where speech and entity events become stimuli that agents must physically perceive before they can react.

ModeUse it whenBehavior
legacy (default)You want classic social simulations and maximum compatibility.Messages flow through the legacy router and can fall back to broadcast.
perceptionLocation, senses, attention and causal threading matter.Agents only react to perceived stimuli; strict mode can drop unheard speech.

What To Build First

GoalStart here
Watch a ready-made scenarionpx worldsim demo or npx worldsim studio
Build your own policy simulationCopy evaluation/scenarios/water-rationing/
Test realistic location/senses behaviorRead Perception Layer and copy evaluation/scenarios/village-realistic/
Compare legacy vs perceptionnpm run eval:compare-perception
Integrate WorldSim in an appUse WorldEngine, stores, plugins and the generated SimulationReport

Key Capabilities

FeatureDescription
LLM-agnosticOpenAI, Anthropic proxies, Ollama — anything OpenAI-compatible
Personality systemMood, energy, goals, beliefs, knowledge per agent
Realistic perceptionOpt-in stimulus/perception/attention/topic/needs stack for physics-aware agent interactions
Social dynamicsRelationship tracking with strength decay, neighborhoods
Rule enforcementHard/soft rules, governance agent with autonomous control
Scalability1000+ agents via concurrency caps, activity scheduling, token budgets
Zero-config persistenceIn-memory by default; plug in Redis, Neo4j, PostgreSQL for production
Real-time streamingSocket.IO events for live dashboards
Simulation reportsAuto-generated analysis with mood heatmaps and action metrics

Released under the MIT License.