DEV Community

Cover image for AI Agents That Live Inside a Dreamed-Up World
Shridhar Shah
Shridhar Shah

Posted on

AI Agents That Live Inside a Dreamed-Up World

An agent watches a game, learns to hallucinate the next frame, then plays inside its own dream — but only the model that knows players react to each other stays true.

TL;DR: The hottest idea in agents right now: don't feed them the real world — let them dream it. An agent watches some footage, learns to hallucinate the next frame, and practices inside its own head. I built a tiny one, and found the catch: a dream only stays true if it knows the players react to each other. Runs on a laptop.


The world

Two players in an 11-cell corridor: a predator steps toward the prey, the prey steps away. Every move is a reaction. An agent watches random games, then closes its eyes and dreams 15 frames ahead, feeding each prediction back in as the next input. I built two dreamers from the exact same footage:

  • single-player — predicts each player from its own position alone
  • multiplayer — predicts both positions together

Training an agent inside its own learned dream goes back to Ha & Schmidhuber's World Models (2018); the open frontier is making that dream multiplayer — modeling agents reacting to each other, not just physics.

The 10-second version

% of the dream still matching reality, this many frames ahead:

frames ahead 1 3 5 10 15
single-player dream 11 0 0 9 0
multiplayer dream 100 100 100 100 100

The single-player dream falls apart almost immediately. The multiplayer dream stays locked to reality the whole way.

How it works

real = dream = start
for _ in range(15):
    real  = real_next(*real)   # what actually happens
    dream = model(*dream)      # feed the dream its OWN last frame
    match += (dream == real)
Enter fullscreen mode Exit fullscreen mode

Same footage, same loop. The only difference: whether the model predicts the two players jointly or independently.

Why single-player collapses

The prey moves because the predator moved. A model that looks at the prey alone can't see that — so its tiny errors compound each frame until the dream is pure fiction. The multiplayer model conditions on both, so it captures the reaction and keeps re-predicting the real game.

A dream you can act in is a superpower — an agent can practice a thousand risky moves for free. But a dream that forgets everyone else reacts to you isn't practice. It's a delusion.

Why it's exciting

The proven part: training agents inside a learned dream works — from World Models (2018) to DreamerV3 (2023) mastering 150+ tasks, and Genie (2024) learning playable worlds from video alone. Dreamed worlds let agents rehearse infinitely, safely, at zero real-world cost.

Where it's heading: those dreams are mostly single-agent today. The 2026 push is multiplayer — worlds where agents model each other. The lesson from this demo is the whole ballgame: model the reactions or the dream drifts. Get it right and agents can plan against each other entirely in imagination.

Try it

git clone https://github.com/Shridhar-2205/secret-lives-of-agents
cd secret-lives-of-agents/03-dreamed-world && python demo.py
Enter fullscreen mode Exit fullscreen mode

The series — The Secret Lives of AI Agents

  1. Agents invent their own language
  2. Agents build a culture on a decaying notepad
  3. Agents that live inside dreamed-up worlds (you're here)

Shridhar Shah — Senior Software Engineer on the AI team at Cisco. GitHub · LinkedIn

Sources & further reading: Ha & Schmidhuber, World Models (2018) — the "train inside a dream" idea · Hafner et al., Mastering Diverse Domains through World Models (DreamerV3, 2023) · Bruce et al., Genie: Generative Interactive Environments (2024).

Top comments (0)