A world of AI agents

Terrarium

Every person in it is an AI agent with a mind of its own.

A language model is each person's intelligence: it reads what they see, need, believe and remember, and decides what they do. Put a hundred of them in a world with seasons, scarcity and each other, and watch what kind of society comes of it.

terrariumfirst winter · live
This world is running in your browser right now. Click it to take the controls: Space pauses, Tab follows someone else, ? lists the rest.

The core idea

Each person is an agent

The simulation is only the body and the world. The mind is an AI agent: every day it gets one person's view of things and answers with what they do. Here is one day of one person, Bria, start to finish.

  1. 1 · Perceive

    What Bria knows

    ~ ~ * * .
    ~ * * . .
    . * B K .
    . . . △ .
    . . . . *
    Body
    hunger 30% · energy 70% · carrying 9 food
    Sees
    Kael, beside her, looks hungry and carries nothing
    Believes
    food to the north; Kael is trustworthy
    Remembers
    Kael gave her 2 food on day 21
  2. 2 · Ask the mind

    Her view, as a prompt

    ## Who you are
    You are Bria: cooperative, outgoing,
    calm. You want to be respected.
    You carry 9 food (it slowly spoils).
    I remember: Kael gave me 2 food
    on day 21.
    
    ## Current Situation (Day 34)
    Autumn. Resources are dwindling.
    Nearby: Kael (looks hungry,
    carrying 0 food)
    
    ## Available Actions
    GATHER · EAT · REST · MOVE
    GIVE <name> <n> · COURT · BUILD
    CLAIM · ATTACK · …
  3. 3 · The agent decides

    Her mind answers

    REASONING: Kael shared with me when I
    was short. He looks hungry, and I have
    more than I need before winter.
    ACTION: GIVE Kael 3

    The model is free to choose anything on the list, including stealing, fighting or doing nothing. Nothing in the engine nudges it either way.

  4. 4 · The world resolves

    Everyone's choices, at once

    • → Bria gave 3 food to Kael
    • ◇ Hana gathered 2 wood
    • ♥ Orin courted Lira
    • ▣ Jora claimed land at (7, 2)

    The engine applies the physics of every action together: who has the food now, what got built, who got hurt. It never decides for anyone.

  5. 5 · Remember

    And it changes them

    Kael
    “Bria gave me 3 food.” Trust in Bria rises.
    Bria
    “I gave Kael 3 food.” Six left for the winter.
    Next day
    both decide again, a little different for it

An illustration of one day, in the format the engine sends to the model (shortened). In the browser, where no model runs, the same loop runs on instinct.

Many minds, one world

Every person is a separate agent with its own context. They don't share a brain, a plan or a goal; they only share the world, and what they can see of each other in it.

The world turns

Food grows and spoils, herds wander, weather and illness come and go.

Every agent thinks, on its own

BBriaKKaelHHanaOOrinLLiraJJoraNNikoPPetraAAricFFaye

One call per person per day, each seeing only what that person sees.

All at once

Every choice resolves together against the same morning, so walking away doesn't dodge a blow.

Beliefs update

Each remembers what they did, what was done to them, and what they saw.

↻ then the next day, and the next. Over seasons and generations, patterns form that no one wrote.

Inside a mind

What the agent is given is layered, from what never changes to what changes every day. Beliefs are not facts: they come from experience, and they can be out of date or wrong.

How it works, in full →

  1. IdentityPersonality (five traits), values, one life aspiration. Stable for life.
  2. BeliefsWhere food is, who can be trusted, whose land this is. Learned, and fallible.
  3. TodayWhat they see, how hungry and tired they are, who is near, what was offered.
  4. ActionGather, eat, rest, share, court, build, claim, trade, teach, take, fight.

Nothing is scripted

There is no code for markets, chiefs or feuds. There are agents with needs, a world with rules, and time. What you see in a run comes out of that.

  • Sharing. Food flows from those with plenty to those without, most readily between kin and friends, and between people who have given before.
  • Ownership. People claim the land around their homes. Owners ward off trespassers; most intruders back off, and a desperate few don't.
  • Conflict. When food runs short and trust runs low, some take by force what they can't find, and those they wrong remember.
  • Families. Courtships turn into bonds, bonds into children. In a big enough world, generations follow one another.
  • Hard years. Droughts and storms come without warning; illness passes between neighbours. Settlements rise, decay and are rebuilt.

Two kinds of mind

The intelligence can come from either of two places. Either way, the world never chooses for anyone.

With a language model

They deliberate

Give Terrarium a Claude API key and each person is a Claude agent that thinks its day through. Whether to share, steal, court, fight or make peace is the agent's own call.

Run it with Claude →

Without one

They act on instinct

In your browser, people run on instinct: fast rules from behavioural ecology and social psychology, from Hamilton's rule for sharing to the logic of contests over land, with every source listed.

The science behind instinct →

The world they live in

A grid of land with its own physics, indifferent to the agents on it.

  • *
    SeasonsSpring growth, summer plenty, a winter that kills off standing food.
  • .
    Valleys and uplandsFertile land in patches, barren high ground between. Climbing costs effort.
  • ~
    Lakes and fishWater no one can cross, fished down and refilling.
  • ♣
    ForestsWood regrows slowly; thick woods hide what's beyond them.
  • d
    Wild gameHerds that breed, wander and can be hunted out.
  • !
    Weather and illnessDroughts, storms and fevers, on no one's schedule.

More about the world →

Terrarium is a societal petri dish. You make a world with rules, fill it with AI agents, one mind per person, and see what grows.

It asks one question: can social structure emerge on its own, from agents free to act within a world’s constraints? Not markets, chiefs or alliances written into the code, but ones that appear because hungry, sociable, mistaken agents found them useful.

It’s free and open source. The engine is written in Rust, the viewer runs in a terminal or, compiled to WebAssembly, right here in your browser.

made by raskell.io