Tone Dark
Tint
16 Predicting what's next: a world model for the agent's environment

The thing brains do that most agents do not.

The previous chapter covered predicting the agent's own behavior. This chapter covers the prospective complement: predicting the system the agent operates in or observes. The two are different problems with different math. Predicting the agent is about constraining what the agent might do next. Predicting the environment is about constraining what the world is about to look like, before the agent has to act on it.

Open with a fact from neuroscience because it makes the engineering point cleanly. Your brain does not passively receive what your eyes see. It runs a continuous predictive model of what the next visual frame should look like, and only the differences from prediction get full attention. The brain is fundamentally a prediction machine, not a passive receiver. There is an instructive corollary: people who are congenitally blind never build a visual predictive model, and one prominent hypothesis (Pollak and Corlett, 2020) is that this is one reason their rates of schizophrenia are dramatically lower than in the sighted population. Schizophrenia in the predictive-coding view is a hierarchical predictive system that has started trusting its own predictions more than reality. No predictive system, no hierarchical predictive failure.

Take the engineering analogy seriously. A reactive agent with no predictive model is bounded by ground-truth latency but cannot hallucinate predictions. An agent with a strong predictive model is fast but can drift into prediction-driven confabulation. The whole engineering content of this chapter is in that tradeoff: building the predictive model is the easy part; designing against the failure mode is the hard part.

The thesis: most agents today are reactive. They read, then decide, then act. A predictive agent runs a model of the environment in parallel with its loop, uses the predictions to act faster and detect anomalies for free, and pays for that with a new failure mode the manual has not covered yet: the agent that trusts its predictions over reality and stops checking.

What a predictive world model actually gives you

Four concrete things, in order of how often they pay off:

A common confusion is worth clearing up before going further. LLMs are next-token predictors, but next-token prediction is not what this chapter is about. The LLM predicts the next token in a language sequence. A world model predicts the next state of an external system: the next reading from a sensor, the next row in a database, the next request from a user, the next price in a feed. The two can be combined (an LLM can be the implementation of a world model if you give it the right prompt and history), but they are conceptually distinct. Mixing them up causes operators to assume their agent already has a world model when it does not.

Three kinds of predictive models, by what they predict

Different agents need different things predicted. Naming the three kinds keeps the engineering choices honest.

TypeWhat it predictsUsed byTypical implementation
State-transition model Given the current state and the action the agent is about to take, what state will the world be in next? Agents that act and need to plan: trading agents, robots, multi-step workflow agents Markov chain, neural state-space model, foundation-model-with-history
Observation model Given a stream of past observations, what is the next observation likely to be? Pure observer agents: monitoring, clinical, industrial sensors, fraud detection Time-series forecaster, LSTM, lightweight transformer
Intent model Given the user's recent behavior, what are they likely to want or do next? Conversational agents, support agents, autonomous assistants LLM with conversation history, learned-preference classifier, clustering over user trajectories

Most production agent systems benefit from at least one of these; many benefit from two. The mistake is trying to build a single predictor that does all three. They have different inputs, different update rates, and different acceptable error tolerances, and bundling them produces a model that does each of them poorly. Pick the kind you actually need, build it well, ship it, then decide whether to add another.

The math, kept simple

Most of the math for predictive models is one idea written four different ways. The idea is surprise minimization: a good predictor assigns high probability to what actually happens, and low probability to what does not. Over time the predictor learns by adjusting itself to reduce surprise on future observations.

The single equation you need to make this operational is the surprise of a single observation given the predictor's distribution:

surprise(o) = -log p(o | model, history)

Read it like this. If your model said this observation was likely (probability close to 1), the log is close to 0 and the surprise is small. If your model said this observation was very unlikely (probability close to 0), the log goes very negative and the negative of it is very large; the surprise is large. Surprise is just how unexpected the actual observation was, in units of "how many bits the model lost." This is the same as cross-entropy, the same as negative log-likelihood, and the same as what training loss is computing every time you fine-tune a model. The vocabulary changes by field; the math is one equation.

Three useful corollaries fall out of this:

Three production patterns, lightest to heaviest

A predictive model is not a single technique. Three patterns cover almost every real production case; pick the lightest one that gets you the property you need.

Two patterns operators sometimes mistake for predictive models, and what makes them different:

Pure observer agents: when prediction is the entire product

Most of this manual covers agents that act. A growing class of agents only watches, and for those the predictive model is not an optimization, it is the agent. Three examples worth naming, because they teach the pattern:

Pure observer agents have a clean architecture. The decide step in the perceive-decide-act loop is replaced by "compute surprise; if surprise exceeds threshold, route to a human or to a higher-level acting agent." The act step is just "emit alert" or "do nothing." The whole loop is dominated by the predictor and the threshold logic. This is the cleanest production deployment of a predictive model, and the manual's existing chapter on agents that watch instead of answer is the right reading after this one.

Agent schizophrenia: the failure mode you must design against

Return to the brain analogy from the opening, because this is where it earns its keep. The predictive-coding view of schizophrenia argues that the brain's positive symptoms (hallucinations, delusions) arise when the predictive system places too much weight on its predictions and not enough on the sensory data contradicting them. The brain "knows" what should be there and supplies it, even when the eyes and ears disagree. Confabulation is the system trusting its priors over its inputs.

Agents with predictive models can fail the same way. Concretely:

The defenses against this are not exotic. They are discipline, applied at the right places:

The honest framing is that adding a predictive model adds a new privileged sub-system. Every privileged sub-system needs its own audit, its own reputation accounting, and its own fail-safe. The defenses above are not optional; they are what makes the predictive layer safe to deploy. Skip them and you have built an agent that can hallucinate consistency with predictions that no longer hold, which is precisely the failure mode the brain analogy warned about.

How prediction connects to the rest of the manual

A predictive layer touches almost every earlier chapter. Naming the connections keeps the architecture coherent.

Practical guidance

The four-line summary. A predictive world model gives you anomaly detection for free, lower latency through speculative execution, compressed memory, and faster failure detection. It costs you a new privileged sub-system that can develop agent schizophrenia by trusting predictions over reality. The defenses are not exotic: reality-check ratio, confidence intervals, surprise thresholds, audit on every predicted action, and treating the predictor's reputation as part of the trust engine. Build a reactive agent first; add a predictor when its specific benefits earn the specific failure mode it introduces.