Self-Models, Body Schemas, and Affordances

Michael BrenndoerferJune 18, 202660 min read

Part of World Models Handbook

Explains how world models represent the agent itself: agent-environment boundaries, learned body schemas, capabilities, affordances.

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Self-Models, Body Schemas, and Affordances

Imagine a warehouse robot arm asked to pick up a mug from a cluttered shelf. To solve this, the arm's world model must represent far more than the mug. It must know where its own joints are right now, how its end effector moves when a command is issued, which shelf locations it can physically reach from its current posture, and whether the mug is graspable given its gripper. In deployments around people, it may also benefit from representing goals or beliefs when those hidden variables improve predictions of how a nearby person will respond. These quantities concern the relationship between a specific agent and a specific world, not only the mug's intrinsic physics.

Notice how different these representations are from the object models of earlier chapters. A model of how a mug slides, tips, or breaks can transfer across agents; a reachability map is tied to a particular embodiment and state. A mug's mass does not depend on who holds it, while grasp success depends on the gripper, controller, and posture. A robot with an environment model but no representation of its own action interface is like a chess engine that knows the rules but not which pieces it controls: simulation alone does not tell it which interventions are available.

This chapter is about the agent-shaped part of a world model. Previous chapters built up representations of the environment: sufficient state, latent variables, temporal memory, objects, and relations. Here we complete the picture by turning the modeling lens back onto the agent itself. We cover four connected ideas:

  • Agent-environment boundaries: the modeling choice of what counts as "me" versus "the world," and why the boundary is a design decision with real consequences.
  • Body schemas and kinematic state: the internal model of the agent's own geometry and motion, including proprioception and learned self-models.
  • Capabilities, constraints, and affordances: compact summaries of what is possible for this agent in this state, which connect prediction to decision-making.
  • Other agents and theory of mind: models of other intentional systems, whose latent mental states make the world nonstationary from a single-agent viewpoint.

These four ideas form a natural progression, and it is worth seeing the progression explicitly before we begin. First the agent must decide where it ends and the world begins, because every subsequent representation is relative to that choice. Then it must model the region it claimed as itself: its geometry, its motion, how commands become movements. Then it must compress that model into statements of possibility, because planners cannot afford to reason from raw kinematics at every step. Finally, it must extend the same machinery to minds, because other agents are the part of the environment whose behavior is best explained not by physics but by goals.

The through-line is a single question: what does a world model need to represent about the agent so that its predictions are useful for the agent's own decisions? Passive prediction quality alone is not enough. A model that predicts the next camera frame but cannot condition forecasts on candidate actions cannot plan with those forecasts. An explicit factorization of action-controllable latents is not logically required, but it can make planning more efficient and the model easier to diagnose. This is one instance of a distinction this book presses repeatedly: predictive fidelity, representation quality, uncertainty quality, and decision usefulness are separate achievements. Self-models make that distinction concrete, and affordances are a representation built explicitly for decision use at some cost to generality.

Where the Agent Ends and the World Begins

In the controlled dynamical systems we studied in Part II: Inference, Decisions, and Control, we wrote the world as a transition model zt+1=F(zt,at)+wtz_{t+1} = F(z_t, a_t) + w_t, where wtw_t is process noise, and treated ata_t as an input channel distinct from everything else. But which physical variables belong inside ztz_t, and which are left outside as "environment"? For a robot arm gripping a mug, the joint angles belong to the agent. The mug's pose belongs to the environment. What about the mug's pose relative to the gripper once contact is made? What about a tool the arm is holding? The placement of those variables is a modeling choice with downstream consequences.

It matters because the two sides of the boundary are usually treated differently downstream. Variables on the self side often have stronger action coupling and more direct proprioceptive readout, so the agent may have lower-latency, higher-confidence estimates of them. Variables on the environment side rely more heavily on prediction and inference, with greater uncertainty and delay. These are tendencies rather than definitions: internal actuator states can be hidden, while an external object can be observed precisely. If a variable that behaves like part of the body is filed under "environment," the agent may underuse reliable action and sensor structure. If a variable that behaves like the world is filed under "self," the agent may become overconfident about something it cannot command. The Kalman filters and controllers of Part II: Inference, Decisions, and Control assumed this partition was given to them; learning agents must discover or design it, and the choice shapes everything downstream, from which latent dimensions receive action inputs to which parts of the model transfer to a new task.

Agent-Environment Boundary

The agent-environment boundary is the partition of the full closed-loop system into the part the agent treats as itself (whose state is directly influenced by actions and partially readable through proprioception) and the part it treats as external world (predicted but not directly commanded). Formally, if ztz_t is a sufficient state of the closed loop, we choose a split zt=(ztself,ztenv)z_t = (z^{\text{self}}_t, z^{\text{env}}_t).

Three properties guide where to draw the line:

To make the criteria concrete, score a set of representative variables on the first two properties: how directly a command moves them, and how directly a sensor reads them. Variables near the top right are natural members of zselfz^{\text{self}}; variables near the bottom left belong to the environment; and the off-diagonal quadrants are exactly the ambiguous cases the text describes.

In[3]:
Code
import numpy as np

## Illustrative controllability and observability scores in the same order
boundary_names = [
    "joint angles",
    "joint torques",
    "fixed camera",
    "mug before contact",
    "gripper aperture",
    "held tool pose",
    "shelf layout",
]
boundary_vars = np.array(
    [
        [0.95, 0.90],  # joint angles
        [0.90, 0.15],  # joint torques: commanded, rarely sensed
        [0.10, 0.85],  # fixed camera view: sensed, never moved
        [0.05, 0.20],  # mug pose before contact
        [0.80, 0.80],  # gripper aperture
        [0.30, 0.60],  # held tool pose: partly commanded via arm
        [0.15, 0.30],  # shelf layout
    ]
)
Out[4]:
Visualization
Scatter of variables on controllability versus observability axes with a shaded self region.
Candidate state variables scored on direct controllability and direct observability; the top-right cluster is the natural self-side of the boundary.
  • Direct controllability: variables in zselfz^{\text{self}} respond to actions through short, reliable causal paths. Commands change joint torques within milliseconds; they change the mug's location only through contact dynamics.
  • Direct observability: dedicated sensors such as joint encoders, IMUs, muscle spindles, and battery monitors provide measurements closely tied to self-state, often with less scene interpretation than cameras or lidar. They can still require filtering and state estimation; an IMU, for example, does not directly report pose.
  • Transportability across tasks: the self-model is the part of the world model that persists when you move the robot to a new kitchen. The mug model does not. Factoring the self out of the environment model is therefore a powerful form of transfer: you can relearn the kitchen without relearning your arm.

Each of these criteria can fail independently. A variable can be controllable but hard to observe: joint torques respond to commands, but some robots lack direct joint-torque sensing and must estimate them. A variable can be observable but not controllable: a fixed camera sees the room but cannot move it. A variable can be both controllable and observable yet fail to transfer: a gripper's learned friction model depends on the objects it has gripped. Transportability is valuable because the self-model is meant to be reused, but whether a variable belongs there still depends on the downstream task.

This connects directly to the state-abstraction machinery from Sufficient State and State Abstraction in this part. There, we asked which observation features a policy needs. Here we ask a complementary question: which latents are action-controllable, and which are merely observable? In a learned latent dynamics model, some latent dimensions will move sharply and predictably under actions while others respond only weakly or not at all. Identifying a controllable subspace is one useful step toward discovering the body. In classical robotics the partition is handed to you: the manufacturer tells you which encoders are on the arm. In a learned world model trained purely on observation-action sequences, the model instead has to infer which dimensions its actions steer. Short response latency, action-conditioned mutual information, and persistence across scenes are useful heuristics for proposing controllable latents, but none uniquely identifies self-state. Recovering a defensible self/nonself split therefore requires intervention and transfer tests, not a single statistical signature.

The boundary is also not fixed. When a person uses a rake, their effective reaching range changes; neuropsychologists observe that peripersonal space (the region the brain treats as "within reach") expands to include the tool. A good computational analogue: after a few minutes of driving, a driver's self-model extends to the car's corners, and experienced drivers know "where the hood is" without seeing it. We will return to tool incorporation when we discuss learned body schemas. The plasticity of the boundary is not a biological curiosity; it is a design resource. A robot that can dynamically reclassify a grasped object as part of itself inherits a compact, already-calibrated kinematic model for it, rather than treating every object-hand interaction as a fresh contact-dynamics problem. The cost is symmetric: the boundary must also contract when the object is dropped, and a stale extension is worse than no extension, because the agent will confidently predict motion (its own, extended) that does not occur.

Finally, note a subtlety about actions themselves. In the POMDP formalism from Markov and Partially Observable Decision Processes, the action is an input, not part of the state. But real actuators have state: motor temperature, battery charge, worn gears, a gripper that is partially closed. A complete self-model includes these actuator states inside zselfz^{\text{self}}, because they shape how commands translate into forces. Ignoring them is a classic source of model error that worsens over a long episode. The failure pattern is characteristic and worth recognizing: the model is accurate early in the episode, when actuator states are near their nominal values, and drifts later as batteries deplete and motors heat. An agent that evaluates its model only on short rollouts will never see the problem; an agent that tracks its own actuator states can predict the onset of the discrepancy, which is exactly the kind of self-knowledge that separates a system that fails gracefully from one that fails inexplicably.

Body Schemas and Kinematic State

Why can a cat pounce onto a narrow ledge without measuring anything, and why can you touch your nose with your eyes closed? Both rely on an internal model of the body's geometry and its current configuration. The cat does not compute the ledge height in world coordinates and compare it against a table of jump distances; it consults an integrated sense of where its body is and what it can do from here. You do not locate your nose visually; you consult a body-centered map that has been maintained continuously since long before you could read. We use body schema for the functional, and typically learned, model of the agent's own body and its relation to actions.

Body Schema

In this chapter, a body schema means the agent's action-oriented model of its embodiment: its morphology, kinematics, relevant dynamics and limits, motor-command effects, sensory consequences, and geometry in space. This robotics-oriented convention is broader than some neuroscience uses of the term. In our notation, it is the agent's internal model of the self-slice ztselfz^{\text{self}}_t and its transition dynamics.

It is worth being precise about what "model" means here, because the body schema is not one function but a cluster of them, tied together by a shared subject. There is the command-to-configuration map (what does this motor command do to my joints?), the configuration-to-sensation map (what will I feel if my joints move like this?), and the configuration-to-geometry map (where is my hand relative to my shoulder?). Classical robotics often specifies these with separate analytic and calibrated models; a learned body schema may fit them jointly. What makes them a schema rather than a grab-bag of regressions is that they concern the same self-state and can be checked for cross-model consistency.

Kinematic state is part of the Markov state

Recall from our discussion of sufficient state in Part II: Inference, Decisions, and Control that a Markov state must contain everything relevant to future prediction. For an embodied agent, the body configuration qtq_t (joint angles, base pose, gripper aperture) is unambiguously part of that state. Omitting it has immediate consequences: two observationally identical camera views can correspond to completely different futures depending on arm posture, because one posture can reach the target and the other cannot. If your latent state does not encode posture, your model cannot predict which actions will work, and no amount of visual fidelity fixes it.

This can be a concrete instance of the partial-observability diagnosis from Markov and Partially Observable Decision Processes. If posture is hidden and the available camera history does not disambiguate action-relevant futures, a camera-only agent is partially observable rather than merely noisy. A vision-only latent model may still score well on passive frame prediction when the scene dominates the image and hidden posture has little visual effect. The deficiency appears under control, where posture changes which actions are viable. This is another reason passive prediction scores do not by themselves establish closed-loop competence.

This is why proprioception is not a nice-to-have sensor. Joint encoders and other proprioceptive sensors often provide high-rate, low-latency measurements of the agent's own state, although their reliability and calibration still depend on the hardware and estimator. In Part III: Representing Agents and Worlds's opening chapter on observations and sensors, we classified modalities by what they measure. Proprioception primarily measures the self; exteroception primarily measures the world. A world model for an embodied agent typically needs both, fused into a single latent state.

The minimal kinematic self-model has two parts:

  • Forward kinematics: the map ff from joint configuration to body geometry, for example the end-effector position x=f(q)x = f(q).
  • The Jacobian: the derivative J(q)=∂f/∂qJ(q) = \partial f / \partial q, which linearizes the map and tells you how end-effector motion responds to small joint motions. Resolved-rate controllers and many local inverse-kinematics methods consume J(q)J(q) directly; model-predictive controllers may instead use other derivatives or a full dynamics model.

Why does the Jacobian deserve attention alongside the map itself? Local inverse kinematics asks which small joint adjustment moves the hand toward a target. The Jacobian answers that differential question. For redundant or constrained arms, one practical iterative method repeatedly solves a linearized problem J(q) Δq=ΔxJ(q)\,\Delta q = \Delta x, takes a controlled step, and re-linearizes. Resolved-rate controllers and many local inverse-kinematics methods use some version of this loop, which is why the learned-schema experiment checks a derivative instead of reporting only point predictions.

The Jacobian's role in control can be seen directly by running the resolved-rate loop J(q) Δq=ΔxJ(q)\,\Delta q = \Delta x from a starting posture toward a target. The first few steps need not reduce the residual monotonically because each solve uses a local linearization. Once the arm enters the target's neighborhood, the damped updates produce near-geometric decay until floating-point precision becomes the limiting scale.

In[5]:
Code
## Two-link geometry and true forward kinematics, defined before first use
L1, L2 = 1.0, 0.8


def forward_kinematics(q1, q2):
    x = L1 * np.cos(q1) + L2 * np.cos(q1 + q2)
    y = L1 * np.sin(q1) + L2 * np.sin(q1 + q2)
    return np.stack([x, y], axis=-1)


def jacobian_analytic(q):
    a1, a2 = q
    return np.array(
        [
            [-L1 * np.sin(a1) - L2 * np.sin(a1 + a2), -L2 * np.sin(a1 + a2)],
            [L1 * np.cos(a1) + L2 * np.cos(a1 + a2), L2 * np.cos(a1 + a2)],
        ]
    )


def fk_vec(q):
    return forward_kinematics(q[0], q[1])


q_start = np.array([0.4, -1.1])
q_target_xy = np.array([0.8, 1.2])
q = q_start.copy()
residuals = []
for _ in range(25):
    residual = q_target_xy - fk_vec(q)
    residuals.append(np.linalg.norm(residual))
    dq = np.linalg.solve(jacobian_analytic(q), residual)
    q = q + 0.9 * dq

residuals = np.array(residuals)
iters = np.arange(1, len(residuals) + 1)
Out[6]:
Visualization
Log-scale line plot of residual norm decaying over control iterations.
End-effector residual norm under the resolved-rate loop. An early nonmonotone step reflects local linearization error; subsequent damped updates enter near-geometric decay.

Dynamics (masses, inertias, gravity, friction, and contact forces) sit on top of kinematics. A kinematic schema answers "where will my hand be if my joints move like this"; a dynamic schema answers "what torques achieve that motion, and how fast." Kinematics can be sufficient for geometric path generation in slow, position-controlled manipulation when a lower-level controller handles the dynamic effects. It is not a claim that those effects disappear. Heavy payloads, fast motions, and contact-rich tasks make dynamics important at the planning layer as well. The classical robotics literature on computed-torque control and operational-space formulations shows how the two layers compose; a learned agent faces the same layering choice, deciding which dynamic structure must be explicit for the task.

Learned versus analytic body schemas

Classical robotics writes f(q)f(q) in closed form from CAD models. This works when the robot matches its blueprint but requires recalibration when damage, deformation, wear, or an unmodeled payload changes the plant. Bongard, Zykov, and Lipson demonstrated an adaptive alternative in their 2006 Science paper on resilient machines: a four-legged robot used actuation-sensation data to select a self-model, detected disagreement after damage, and synthesized a compensating gait. The lesson generalizes beyond that platform: a self-model estimated from data can be revised when observations reveal mismatch.

The important distinction is not analytic versus learned, but monitored versus unmonitored and fixed versus updateable. Either an analytic or learned model can be checked through prediction residuals. A parameterized or learned model may be easier to revise when those residuals reveal damage or wear. The resilient robot follows that loop: disagreement grows, the agent detects it, and it searches for an updated self-model. This is closely related to the filtering logic from Part II: Inference, Decisions, and Control, where an unexpectedly large innovation can trigger diagnosis or re-estimation.

Learning a body schema gives the agent unusual influence over its calibration data: it can choose safe motor commands and observe their consequences. That does not mean full control of the distribution. Joint limits, contacts, safety constraints, actuator health, and sensor noise restrict which probes are possible and what they reveal. Even so, self-model data can often be gathered more actively than data about an uncontrolled environment. A well-designed embodied agent can exploit that advantage through periodic calibration actions and residual monitoring, while respecting the same coverage and safety constraints that govern any system-identification experiment.

Tool use as schema extension

The same machinery that models the arm can model a held tool. Kinematically, a gripper holding a rigid rod is a chain with an added geometry and attachment transform. The agent can learn an extended forward map ftool(q,θtoolkin)f_{\text{tool}}(q, \theta^{\text{kin}}_{\text{tool}}), where θtoolkin\theta^{\text{kin}}_{\text{tool}} contains quantities such as length, shape, and grasp transform. A dynamic extension would separately include mass, inertia, compliance, and friction. Grasping a tool can therefore involve estimating parameters and selecting the appropriate extension. Within a fixed parameterized tool family, a new tool may be handled as new parameter values rather than an entirely new model. We will see the same compositional idea again when we treat object-centric structure in Object-Centric and Relational Worlds and physical constraints in Part IV: Space, Physics, and Causality.

The parameter-estimation view also suggests a computational account of the brief calibration period when a person picks up a new tool. The agent can actively probe length, orientation, and response, then use the estimate θ^tool\hat{\theta}_{\text{tool}} in an extended schema. This account predicts characteristic errors, such as reaching short with an underestimated rake length, that should shrink as calibration samples accumulate. Human and primate studies do show task-dependent changes in body and peripersonal-space representations after tool use. Those observations are qualitatively consistent with calibration, but they do not establish that the nervous system performs the specific parameter-estimation procedure written here.

Capabilities, Constraints, and Affordances

Knowing your body configuration is not yet knowing what you can do. The next layer of the self-model summarizes possibility: which actions are feasible, which outcomes are reachable, and which interactions the environment currently supports. These summaries are where self-models first pay off in the decision loop, because they let a planner prune huge portions of the action space before any expensive rollout.

The need for this layer comes from a scaling problem that raw self-models cannot solve. A body schema plus a world model is, in principle, complete: for any candidate action sequence, the agent could roll the pair forward and find out what happens. But that completeness is combinatorially expensive, and most of the expense is wasted on actions that were never viable. A planner that rolls out a grasp attempt in a region the arm cannot physically reach has not learned anything useful; it has paid full model-evaluation cost to rediscover a geometric fact it could have known in advance. Capability summaries are the cache that prevents this waste. They answer the coarse question "is this even possible?" cheaply, so that the expensive question "what exactly happens if I try?" is reserved for candidates that survive the first filter.

Constraints define the feasible set

Let C⊆Rn\mathcal{C} \subseteq \mathbb{R}^n denote the set of body configurations the agent can occupy or command, where nn is the number of independent configuration variables (joint angles, base pose, gripper aperture). For a robot arm, C\mathcal{C} is carved out by several families of constraints:

  • Joint limits: each joint angle lies in an interval.
  • Actuation limits: torques and velocities stay within motor capabilities, which couple across joints.
  • Self-collision: the body must not intersect itself, a nonconvex geometric constraint.
  • Stability: legged and wheeled systems must keep their center of mass and contact forces within support regions.
  • Task constraints: keep the cup upright, keep the end effector out of the sterile field.

These constraint families have different mathematical forms. Joint limits are box constraints on individual variables. Self-collision is a nonlinear, nonconvex geometric predicate involving many variables at once. Stability constraints include dynamics and change with the contact state. Task constraints are imposed from outside the agent and may change with each job. A feasible set assembled from such pieces is often nonconvex and can be disconnected when obstacles, contacts, or task constraints separate regions of configuration space. Exact characterization can be expensive, so capability maps commonly approximate the forward-kinematic image of the feasible set by analysis, optimization, or sampling. Their reliability depends on the guarantee provided by the chosen method.

The part of the world that the agent's body can realize is then f(C)f(\mathcal{C}), the forward-kinematic image of the feasible set. For a two-link arm this image is an annulus: the end effector can reach anything between radius ∣L1−L2∣|L_1 - L_2| and radius L1+L2L_1 + L_2 from the shoulder, where L1L_1 and L2L_2 are the two link lengths, and nothing inside that inner hole. This geometric fact, derived entirely from the self-model with no reference to any object, is the prototype of a capability. The inner hole deserves a moment of reflection, because it is the most counterintuitive part of the result and the most decision-relevant. A planner without the capability map, shown a target near the shoulder, would try to plan a reach there, fail, retry with different parameters, and fail again; each failure costs a full planning episode. The map converts all of those episodes into a single lookup. And note that the knowledge is purely about the agent: the annulus exists whether or not there is a mug anywhere in the scene.

Capability

A capability is a coarse-grained statement about the feasible set of outcomes available to an agent in a state, abstracted away from specific actions. "This arm can reach anywhere in the annulus between 0.2 and 1.8 meters from its base" is a capability. Capabilities are agent properties mediated by state; they change as the agent's configuration, tooling, or actuator health changes.

The "mediated by state" clause is doing real work in that definition. Capabilities sound like fixed properties of an agent, the way a spec sheet lists a robot's payload and reach, but the useful notion is state-dependent: a folded arm cannot reach what an extended one can, a grasping gripper cannot pinch, a robot with a depleted battery has a smaller feasible torque set. Capabilities are therefore best understood as functions of the self-state, not constants, and the capability summaries that matter in practice are indexed by the same ztselfz^{\text{self}}_t that the body schema models.

Affordances: possibility relative to an agent

The ecological psychologist James J. Gibson introduced and developed the affordance concept in his 1966 work, then gave it its canonical mature treatment in The Ecological Approach to Visual Perception (1979). Standard physics vocabulary can describe a flat rigid surface at knee height, but it does not directly say whether a particular body can sit on it. Affordances express that relation between environment and agent. A bench's height in centimeters is an object property; "sit-on-able" is an action-relevant summary, and it depends on the sitter.

::: {.callout-note title="Affordance"} An affordance is a relation between an agent's capabilities and an environmental state that constrains which interactions are possible and what outcomes they may produce. In this chapter, we operationalize it as a skill-, outcome-, and evaluation-horizon-conditioned prediction. For an observation oto_t, a skill kk, an outcome class ee, and a horizon HH,

Φk,H(e∣ot,ztself)=Pr⁡(outcome e succeeds within H∣ot, ztself, execute skill k),\Phi_{k,H}(e \mid o_t, z^{\text{self}}_t) = \Pr(\text{outcome } e \text{ succeeds within } H \mid o_t,\ z^{\text{self}}_t,\ \text{execute skill } k),

where:

  • Φk,H\Phi_{k,H}: the affordance function for skill kk and evaluation horizon HH, returning the probability that executing kk from this situation yields outcome class ee within that horizon
  • ee: the outcome class whose success probability is being predicted
  • kk: the skill being executed
  • HH: the evaluation horizon within which success must occur
  • oto_t: the observation (or state) at time tt
  • ztselfz^{\text{self}}_t: the agent's self-state at time tt (its body configuration together with its actuator states)

An affordance holds when this probability exceeds a decision threshold.

The threshold clause is the hinge between graded prediction and discrete commitment. For a fixed skill and scene, the success probability varies with the self-state (here, reach extension); the planner's go/no-go boundary is where the curve crosses the threshold.

In[7]:
Code
reach_ext = np.linspace(0.0, 1.0, 200)  # normalized reach extension
## Logistic-shaped success probability for a grasp skill
phi = 1.0 / (1.0 + np.exp(-12.0 * (reach_ext - 0.55)))
threshold = 0.7
cross = reach_ext[np.argmax(phi >= threshold)]
Out[8]:
Visualization
Sigmoid curve of success probability crossing a horizontal decision threshold line.
Illustrative hand-chosen logistic success curve as a function of self-state, with a decision threshold converting the graded score into commitment.

:::

Several features of this definition deserve attention.

  • Affordances are conditioned on the self. The same visual scene affords different actions to a robot with a parallel-jaw gripper versus a suction gripper. This is exactly why affordances live in this chapter rather than in the environment-modeling chapters: the function Φk,H\Phi_{k,H} takes the self-state as an argument. Strip the ztselfz^{\text{self}}_t argument out and the function silently changes meaning, from "what can this agent do here?" to "what can some agent do here?", and the resulting quantity is much less useful for the agent's own planning.
  • Affordances are skill-relative. "Graspable" is not a property of the mug; it is a property of the mug under a particular grasp policy. If the policy improves, the affordance map changes. Sahin and colleagues formalized this agent-relativity in their 2007 treatment of affordances in robotics, and it remains the standard framing. This skill-relativity has a practical implication that is easy to miss: affordance estimates are only as good as the policies they were learned under, and reusing an affordance map after upgrading the skill is a form of stale-model error, exactly analogous to using a kinematic schema after the robot has been repaired.
  • Affordances are decision-useful summaries. Here we connect to a theme this book returns to repeatedly: the distinction between open-loop prediction quality and closed-loop usefulness. A full world model can answer "what happens if I execute the grasp skill here?" by rolling out predictions. An affordance map answers it in one lookup, at the cost of discarding information irrelevant to that action-outcome pair. Affordances are, in the language of Sufficient State and State Abstraction, an abstraction of the world model tuned to a decision problem. They trade generality for cheaper evaluation; any gain in robustness has to be demonstrated under the relevant shift.

That last point deserves a fuller statement, because it is the chapter's clearest example of the four-way split among notions of model quality introduced at the outset. An affordance map answers fewer questions than the world model it summarizes, and it answers them coarsely through the lossy bottleneck of a success probability. What it can buy in exchange is speed and task alignment: the map is cheaper to evaluate and can be learned directly from success labels. A task-aligned summary may transfer better when it discards nuisance variation while retaining the causal factors that determine success, but low dimensionality does not make stability under distribution shift automatic. Systems can therefore maintain both representations: a fuller model for novel situations and detailed planning, and an affordance layer for fast filtering when its calibration has been validated.

The reachability map of a robot arm is the cleanest example. Rather than asking, for every candidate goal, "can some sequence of joint motions bring the end effector here?", the agent precomputes or learns a map R:W→{0,1}\mathcal{R}: \mathcal{W} \to \{0,1\} over the workspace W\mathcal{W}. A planner may safely prune a goal only when the map supplies a conservative infeasibility certificate; an unsampled cell is not such a certificate. The same pattern scales up. Modern robotics includes visual affordance models for action categories such as grasp, lift, open, support, push, and pull. Some predict semantic action regions; others estimate robot-specific success from interaction data. In each case, the representation compresses a class of counterfactual rollouts into a per-location or per-action score whose meaning depends on the skill, embodiment, and evaluation horizon.

How affordances get learned

There are two common routes, and they are often combined:

  • Self-supervised exploration. The agent executes its skills across states and records successes and failures, then fits Φk,H\Phi_{k,H} from its own interaction log. This inherits the strengths of self-model learning: control over the sampled situations and continual recalibration. Its weakness is coverage: affordances for rare configurations are poorly estimated, and exploration in the real world is expensive.
  • Transfer from demonstration or priors. Affordance structure observed in human data, other robots, or simulation seeds Φ\Phi before the agent has explored. This is fast but imports someone else's embodiment, so the imported affordances must be re-grounded in the agent's actual capabilities, which is precisely what the self-model provides.

At foundation scale, observation-based pretraining can supply useful structure before a robot acts, but the imported predictions still need robot-specific grounding. Human video reflects human hands, reach, scale, and force. Applied directly to a different embodiment, its action predictions can be miscalibrated in systematic ways. Robot interaction data and the self-model supply the correction through the robot's reach envelope, gripper geometry, controller competence, and force limits. This is a useful division of labor, not a guaranteed mathematical factorization: prior data propose environment-conditioned action structure, while robot-specific trials determine whether that structure predicts success for this skill and body.

We will meet the exploration side again in the planning chapters of Part VII: Planning and Agency, where information gathering about affordances competes with task progress. Every probe is a step not spent directly on the task, while a task attempt becomes an affordance sample only if the agent records the outcome. Too much probing delays commitment; too little produces overconfident extrapolation from sparse evidence. The uncertainty-aware treatment of affordance estimates in Part IV: Space, Physics, and Causality begins to formalize that tradeoff.

Modeling Other Agents and Theory of Mind

So far, "the agent" has been singular. Real environments contain other agents: people in a kitchen, cars at an intersection, collaborative robots on a line. They are not passive matter. They may act toward goals and react to us, with beliefs or intentions that no sensor reads directly. When those hidden variables materially change behavior, representing them can improve prediction and planning. Simpler reactive motion models may still be adequate for short horizons or weakly coupled encounters; the need for mental-state structure depends on the interaction.

The error is structured rather than merely independent noise, but it does not have a universal sign. A constant-velocity pedestrian model is wrong when the pedestrian notices the robot and adjusts; whether it over- or under-predicts progress depends on whether the person slows, accelerates, or changes direction. A robot that assumes people will yield can also behave in ways that force them to yield, degrading safety and cooperation. In interactions where such responses matter, goal- or belief-conditioned variables offer information that a momentum-only model omits.

Theory of Mind

Theory of mind is the capacity to attribute unobservable mental states (goals, beliefs, intentions, preferences) to other agents and to use those attributions to predict and explain their behavior. Premack and Woodruff introduced the term in their 1978 question "Does the chimpanzee have a theory of mind?"; in computational form it becomes probabilistic inference over latent mental variables.

The phrase "theory of" in the name is apt: the observer holds an inferential model, not a direct record of another mind. Predictive performance is one important criterion for that model. Causal and representational validity matter as well when the goal is explanation, intervention, or transfer rather than trajectory forecasting alone. This is why the evaluation difficulties discussed in Limitations cannot be reduced to a single prediction score.

Other agents as latent structure in the world model

The modeling move is one you have already made twice in this book: treat another agent's mental state as a latent variable in a partially observable model, and infer it from behavior. This resembles inferring a hidden state in Bayesian Filtering and Belief States or a hidden physical parameter from motion. What changes is the interpretation and transition model: the latent may denote a goal or belief, and the observer adds a behavioral or policy model alongside the physical dynamics. That policy may be habitual, boundedly rational, or task-specific rather than perfectly rational. In the framework of Bayesian Filtering and Belief States, the observer's belief now factorizes as

bt(z1:t,g1:t)∝  p(o1:t∣z1:t,g1:t)  p(z1:t,g1:t),b_t(z_{1:t}, g_{1:t}) \propto \; p(o_{1:t} \mid z_{1:t}, g_{1:t})\; p(z_{1:t}, g_{1:t}),

where:

  • bt(z1:t,g1:t)b_t(z_{1:t}, g_{1:t}): the observer's belief, a posterior distribution over the closed-loop state trajectory z1:tz_{1:t} and the other agents' latent mental-state trajectory g1:tg_{1:t}
  • o1:to_{1:t}: the observations accumulated from time 11 through tt
  • z1:tz_{1:t}: the closed-loop state trajectory through time tt
  • g1:tg_{1:t}: the trajectory of the other agents' latent mental states (goals, beliefs, intentions); gtg_t collects their values at time tt
  • p(o1:t∣z1:t,g1:t)p(o_{1:t} \mid z_{1:t}, g_{1:t}): the likelihood of the observed history under a given state and mental-state trajectory
  • p(z1:t,g1:t)p(z_{1:t}, g_{1:t}): the joint prior over the closed-loop state trajectory and the mental-state trajectory, encoding the initial distribution and the transition dynamics

This is Bayes' rule over trajectories: the posterior weight on a hypothesis about the world and the other agents' minds is proportional to how well that hypothesis explains the observed history, scaled by its prior probability. Note what is being conditioned on and what is being inferred: the observer never sees gtg_t directly, only its behavioral shadows, the actions the other agent takes. The whole apparatus of theory of mind lives inside the likelihood term, which encodes the observer's model of how minds produce actions. If that model says agents act efficiently toward their goals, then observed efficient motion is evidence for the goal it serves; if the model says agents avoid what they believe to be dangerous, then observed avoidance is evidence about their beliefs. Change the behavioral model and you change which mental states the same behavior supports, which is why the behavioral model, not the Bayesian update, is where most of the modeling content resides.

The transition model must then close the loop: the other agent's actions are generated by their policy, which depends on their latent state, so the full transition becomes

atj∼πj(⋅∣btj,gt),zt+1=F(zt,atself,atj)+wt,\begin{aligned} a^j_t &\sim \pi^j(\cdot \mid b^j_t, g_t), \\ z_{t+1} &= F(z_t, a^{\text{self}}_t, a^j_t) + w_t, \end{aligned}

where:

  • atja^j_t: the other agent's action at time tt
  • πj(⋅∣btj,gt)\pi^j(\cdot \mid b^j_t, g_t): agent jj's policy, a distribution over actions conditioned on its belief btjb^j_t and its latent mental state gtg_t
  • btjb^j_t: agent jj's own belief at time tt, its posterior over the closed-loop state and the mental states it attributes to others
  • atselfa^{\text{self}}_t: the self-agent's own action at time tt
  • wtw_t: the process noise in the closed-loop dynamics

This is the formal heart of theory of mind in a world model: the environment's dynamics contain a term that is itself a policy conditioned on a hidden belief. Note the immediate consequence: from the self-agent's perspective, the environment is nonstationary. The other agent's policy changes as their beliefs change, often because of the self-agent's actions. This is the same nonstationarity that forced multi-agent frameworks like I-POMDPs (interactive POMDPs) to recursively nest belief representations.

It is worth tracing exactly how the self-agent's actions leak into the other agent's policy, because the pathway is indirect and easy to lose. The self-agent acts; the action changes the world; the other agent observes the changed world; the observation shifts their belief btjb^j_t; the shifted belief changes the distribution over their next action; the action enters the shared transition FF. The self-agent's influence on the other's mind therefore travels through the environment, with a lag, and the other agent's response travels back the same way. This two-hop causal path is what makes interaction qualitatively different from mere coexistence in a shared space:

The difference between a physics-only predictor and a response-aware predictor can be illustrated with a synthetic corridor simulation. The simulated pedestrian slows when the robot approaches. The constant-velocity baseline ignores that response, while the second predictor uses a deliberately slightly misspecified yielding rule based only on the robot-distance sequence available at prediction time.

In[9]:
Code
## Pedestrian at position 15 walking toward 0 (exit); slows while still far
## from the terminal boundary when the robot nears.
ped_pos = [15.0]
robot_dist = [8.0]
for t in range(20):
    d = robot_dist[-1]
    speed = 0.8 if d > 3 else 0.15  # pedestrian yields when robot close
    ped_pos.append(max(0.0, ped_pos[-1] - speed))
    robot_dist.append(max(0.0, d - 0.9))  # robot approaches steadily

ped_pos = np.array(ped_pos)
t_steps = np.arange(len(ped_pos))

## Physics-only prediction made at t=0: constant velocity from first steps
v0 = ped_pos[0] - ped_pos[1]
phys_pred = np.clip(ped_pos[0] - v0 * t_steps, 0.0, None)
## Response-aware prediction made at t=0 from an approximate yielding rule.
## Its threshold and speeds differ from the data generator, so it is not an oracle.
belief_pred = [ped_pos[0]]
for d in robot_dist[:-1]:
    modeled_speed = 0.75 if d > 3.2 else 0.20
    belief_pred.append(max(0.0, belief_pred[-1] - modeled_speed))
belief_pred = np.array(belief_pred)

phys_err = np.abs(phys_pred - ped_pos)
belief_err = np.abs(belief_pred - ped_pos)
Out[10]:
Visualization
Two lines comparing error growth for constant-velocity and response-aware pedestrian predictors.
Synthetic rollout error for a constant-velocity baseline versus a response-aware predictor with a slightly misspecified yielding rule.

In the chapter's hierarchy, two level-0 agents may react only after their motion models register a conflict, while level-1 agents can anticipate some responses from inferred goals. The resulting nonstationarity is not arbitrary drift: it comes from another decision process responding to observations. A model that tracks a useful hypothesis about that process can predict part of the change instead of treating it all as noise.

Levels of reasoning

For this chapter, it helps to use a local hierarchy for how deeply the model represents other minds. Other level-kk and cognitive-hierarchy conventions define the levels differently:

  • Level 0: model other agents as moving objects with dynamics. This can be adequate for short horizons and weak coupling, but it may fail when safe behavior depends on predicting how the other agent will respond.
  • Level 1: attribute goals and predict actions from goals, as in inverse planning: an agent's action is likely if it efficiently achieves some goal. Our worked example below is exactly level-1 goal inference.
  • Level 2 and beyond: attribute beliefs about beliefs. "The pedestrian thinks I see them, so they will cross, so I should slow down." Formally, the other agent's belief bjb^j includes a model of me, so my model of them must include their model of me. Recursive level-kk reasoning grounds game-theoretic solution concepts, and interactive POMDPs make the recursion explicit.

Each added level pays for representational depth with computation and new opportunities for error. The chapter's level 0 is weakest when behavior responds to the focal agent, while level 1 can represent goal-directed responses but not coordination driven by beliefs about what others know. Level 2 adds that higher-order structure and immediately raises the question of where to stop. Shallow recursive models are computationally practical and often explain behavior in experimental games, but useful depth is task-dependent; deeper reasoning is not confined to adversarial or high-stakes settings.

The recursion cannot go infinite, so practical agents truncate at some level and may combine shallow deliberate reasoning with fast reactive models. The reactive layer can handle routine, weakly coupled motion, while deeper modeling is reserved for interactions where another agent's response changes the decision. An autonomous-driving stack might therefore use constant-velocity prediction for distant cars, goal inference for cars at an intersection, and belief attribution for a pedestrian whose decision depends on whether they have been seen. This is an allocation decision whose adequacy must be tested against the scenarios the vehicle faces.

Why world models need other-agent models

Three concrete payoffs justify the complexity:

  • Prediction quality in interaction. In multi-agent scenes, the marginal distribution of others' motion depends on the self-agent's plan. A model that conditions others' behavior on the self-agent's intended actions makes fundamentally different (and better) predictions than one that does not.
  • Communication and cooperation. Handing someone a cup requires modeling what they know about the handover and when they will close their hand. That is a belief-tracking problem before it is a motor problem.
  • Safety. Many failures of deployed agents come from under-modeling people: treating a human as a static obstacle produces plans that are technically feasible and socially disastrous. Over-modeling has a mirror-image failure, which we return to in Limitations.

The first payoff deserves emphasis. When another agent materially responds to the focal agent, the environment's transition distribution depends on the focal agent's behavior. Omitting that dependence then structurally misspecifies the interaction model rather than merely adding observation noise. Weakly coupled scenes and short horizons may still admit a useful simpler approximation, so the modeling depth should follow the sensitivity of the decision to the other agent's response.

There is also an introspective payoff. A self-model that includes "what others can observe about me" supports epistemic behaviors like signaling, feinting, and privacy, and it is the seed of the social self. Notice that this closes a loop with the beginning of the chapter: the agent-environment boundary, introduced as a private modeling choice, has a public counterpart, since other agents maintain their own models of what lies inside ours. An agent that represents the fact that it is in someone else's environment model has crossed from modeling the world to modeling itself as part of the world. We will revisit agent models at foundation scale in Part IX: Foundation and World-Action Models. Some foundation models display theory-of-mind-like behavior on particular benchmarks, but performance is uneven, and neither the underlying mechanism nor the construct validity of those benchmarks is settled.

To make everything concrete, we will build a miniature of the full chapter in code. The body schema is a neural network fit to self-generated calibration data. The learned model itself consumes only sampled joint configurations and measured end-effector poses. Analytic kinematics, Jacobians, and workspace circles are retained separately as evaluator-only ground truth, which a real experiment would replace with calibration fixtures or held-out measurements. The Jacobian comparison tests one local derivative, the reachability raster estimates positional capability, and the corridor observer performs level-1 Bayesian goal inference on a behavioral stream.

The agent is a two-link planar arm with link lengths L1=1.0L_1 = 1.0 and L2=0.8L_2 = 0.8, shoulder at the origin, joint angles q=(q1,q2)q = (q_1, q_2), and end-effector position

x=L1cos⁡q1+L2cos⁡(q1+q2),y=L1sin⁡q1+L2sin⁡(q1+q2),\begin{aligned} x &= L_1 \cos q_1 + L_2 \cos(q_1 + q_2), \\ y &= L_1 \sin q_1 + L_2 \sin(q_1 + q_2), \end{aligned}

where:

  • x,yx, y: the Cartesian coordinates of the end-effector position in the plane
  • L1,L2L_1, L_2: the lengths of the first and second links
  • q1q_1: the shoulder angle, measured from the horizontal axis of the world frame
  • q2q_2: the elbow angle, measured relative to the first link

Each term projects one link onto the axis: the first link at angle q1q_1, the second at the accumulated angle q1+q2q_1 + q_2, because q2q_2 is measured relative to the first link rather than to the world.

The agent does not get this formula. It receives self-generated calibration pairs: joint configurations from proprioception and measured Cartesian end-effector poses from an external tracker, calibrated camera, or other pose sensor. Real robots do not generally obtain Cartesian end-effector position from proprioception alone. From these pairs we will:

  • Fit a neural forward-kinematics model: the learned body schema.
  • Extract a Jacobian from the learned model by finite differences and compare it with the analytic one at one posture, testing local derivative quality without claiming closed-loop control performance.
  • Compute a reachability map by sampling joint configurations and rasterizing end-effector positions: the positional affordance map, which should reveal the annulus with its inner hole.

Then, for theory of mind, we simulate a second agent in a one-dimensional corridor who walks toward one of two hidden goals, and build an observer that performs level-1 goal inference with Bayes' rule. The posterior should rise toward the selected goal; observing the agent stop at that goal makes the posterior exactly one because the alternative hypothesis assigns zero probability to that event. In this seeded run the posterior is already close to one before the stop, so the final update is mathematically decisive but visually small. The example is small enough to reason about exactly: its likelihood ratios, geometric bounds, and posterior values can be checked by hand.

Code Implementation

The first block defines the true (hidden from the agent) kinematics and the self-generated calibration-data loop. Everything here is small enough to run on a laptop CPU in seconds. The separation between the definition block and the agent's data matters conceptually: the function forward_kinematics plays the role of the unmodeled physical body, and every subsequent step treats it as a black box that maps joint configurations to measured end-effector positions.

In[11]:
Code
import numpy as np
from sklearn.neural_network import MLPRegressor

## True (agent-unknown) geometry
L1, L2 = 1.0, 0.8


def forward_kinematics(q1, q2):
    x = L1 * np.cos(q1) + L2 * np.cos(q1 + q2)
    y = L1 * np.sin(q1) + L2 * np.sin(q1 + q2)
    return np.stack([x, y], axis=-1)

Now the agent runs its self-identification experiment: random motor babbling over joint space, recording the resulting measured end-effector pose. This mirrors the coverage requirement from System Identification: the training inputs must visit the configurations on which the learned schema will be used. Uniform independent sampling over the full joint range provides broad static coverage in expectation, but a finite draw does not by itself certify persistent excitation for a nonlinear model. A real agent with limited energy or safety constraints might choose samples more deliberately; in every case, evaluation should use configurations withheld from fitting.

In[12]:
Code
rng = np.random.default_rng(7)
n_train, n_test = 2000, 500

Q_train = rng.uniform(-np.pi, np.pi, size=(n_train, 2))
Q_test = rng.uniform(-np.pi, np.pi, size=(n_test, 2))
X_train = forward_kinematics(Q_train[:, 0], Q_train[:, 1])
X_test = forward_kinematics(Q_test[:, 0], Q_test[:, 1])
Out[13]:
Console
Training pairs: 2000, held-out pairs: 500

With 2,000 training pairs drawn uniformly over joint space and 500 held-out pairs, the experiment measures interpolation to configurations not used for fitting. A finite uniform sample still leaves uneven local coverage, especially near domain boundaries where neighborhoods are one-sided. The held-out set is therefore necessary but not a certificate of worst-case behavior: a safety-critical evaluation would stratify error by configuration region and deliberately probe joint limits and singular postures.

Fit the body schema. A small multilayer perceptron suffices because the map is smooth and two-dimensional. Notice that the agent never sees L1L_1 or L2L_2; the link lengths are implicit in the learned weights. In a richer problem the network would also have to discover the structure of the map, its periodicity, its symmetry under exchanging certain configurations, but here the smooth two-dimensional regression already carries the essential lesson: the geometry of the body can live entirely in fitted parameters.

In[14]:
Code
schema = MLPRegressor(
    hidden_layer_sizes=(64, 64), max_iter=4000, random_state=0
)
schema.fit(Q_train, X_train)

pred_test = schema.predict(Q_test)
err = np.linalg.norm(pred_test - X_test, axis=1)
Out[15]:
Console
Mean end-effector error: 0.0529
95th-percentile error:   0.1962

The held-out mean error is about 0.0530.053 length units and the 95th-percentile error is about 0.1960.196, for an arm whose maximum reach is 1.81.8 units. The schema captures the overall map, but its tail error is large enough to matter near tight clearances. More important than the point prediction is the derivative, because planners consume Jacobians. We extract it from the learned model by central finite differences and compare with the analytic Jacobian the agent does not know. This step is where a merely predictive model would stop and a control-supporting model continues: the finite-difference probe asks the learned model a question it was never directly trained on, namely how its output responds to infinitesimal input changes, and the answer is only useful if the learned function is smooth in the right way.

In[16]:
Code
def learned_jacobian(q, eps=1e-4):
    J = np.zeros((2, 2))
    for i in range(2):
        qp, qm = q.copy(), q.copy()
        qp[i] += eps
        qm[i] -= eps
        J[:, i] = (
            schema.predict(qp[None]) - schema.predict(qm[None])
        ).ravel() / (2 * eps)
    return J


q0 = np.array([0.4, -1.1])
a1, a2 = q0
J_analytic = np.array(
    [
        [-L1 * np.sin(a1) - L2 * np.sin(a1 + a2), -L2 * np.sin(a1 + a2)],
        [L1 * np.cos(a1) + L2 * np.cos(a1 + a2), L2 * np.cos(a1 + a2)],
    ]
)
J_learned = learned_jacobian(q0)
Out[17]:
Console
Max entrywise Jacobian error: 0.0551

At this configuration, the maximum entrywise difference between the learned and analytic Jacobians is about 0.0550.055. The estimate recovers the local direction only approximately, and this one-posture comparison does not establish suitability for resolved-rate control across the workspace. That requires closed-loop tests, representative postures, feedback, and conditioning checks. Here Δx\Delta x is the desired end-effector displacement and Δq\Delta q is the joint displacement that produces it. Near configurations where the analytic Jacobian loses rank, the linear solve becomes ill-conditioned and small end-effector motions may demand very large joint motions. A learned schema inherits this geometric pathology, so a controller should monitor singular values or use a damped pseudoinverse. The probe exposes the gap between point-prediction accuracy, local derivative agreement, and control-grade validation.

Next, the positional affordance map. The agent samples many joint configurations, records end-effector positions, and rasterizes them into a workspace grid. Cells containing at least one reachable end-effector position are marked reachable. Conceptually, this is the simplest possible estimator for R\mathcal{R}: a Monte Carlo estimate of the forward-kinematic image of the joint space, binned at grid resolution. Its statistical properties follow directly from that description, as we will see in the output.

In[18]:
Code
## Affordance map: rasterize sampled end-effector positions
Q_all = rng.uniform(-np.pi, np.pi, size=(40000, 2))
P_all = forward_kinematics(Q_all[:, 0], Q_all[:, 1])

lim = 2.0
grid_res = 0.05
n_bins = int(2 * lim / grid_res)
ix = np.clip(((P_all[:, 0] + lim) / grid_res).astype(int), 0, n_bins - 1)
iy = np.clip(((P_all[:, 1] + lim) / grid_res).astype(int), 0, n_bins - 1)
reach = np.zeros((n_bins, n_bins), dtype=bool)
reach[iy, ix] = True

## Sanity check against the known annulus geometry
r = np.linalg.norm(P_all, axis=1)
Out[19]:
Console
Min sampled radius: 0.200 (theory |L1-L2| = 0.200)
Max sampled radius: 1.800 (theory L1+L2   = 1.800)
Reachable cells: 4160 of 6400

The sampled radii hug the analytic bounds: with 40,000 configurations the samples densely cover the annular workspace and leave the disc of radius ∣L1−L2∣=0.2|L_1 - L_2| = 0.2 around the shoulder empty. The agent has recovered the workspace pattern through motor babbling, but the raster alone does not prove that every empty cell is unreachable. A hit is constructive positive evidence: at least one sampled configuration reached that cell. A miss is ambiguous, because a reachable cell may remain empty under finite sampling. The analytic kinematics establish the true inner and outer bounds in this toy example; without them, cells near either boundary should be treated as a band of uncertainty rather than a sharp curve.

Now the theory-of-mind experiment. A second agent walks a one-dimensional corridor of positions 00 to 1010 toward one of two hidden goals, g=1g = 1 or g=9g = 9, stepping toward its goal with probability 0.80.8 and away with probability 0.20.2. The observer sees only the position trajectory and knows the behavioral model, and performs exact Bayesian posterior updates over the two goal hypotheses. The setup is intentionally minimal: two hypotheses, a known stochastic behavioral model, and a one-dimensional state. Stripped of all incidental complexity, the experiment isolates the one thing theory of mind requires at level 1, a likelihood that connects behavior to hidden intention.

In[20]:
Code
def step_prob(x, g):
    """Other agent's step distribution from position x toward goal g."""
    if x == g:
        return {0: 1.0}
    toward = 1 if g > x else -1
    return {toward: 0.8, -toward: 0.2}


## Simulate the other agent with hidden goal 9
true_goal = 9
x_traj = [4]
deltas = []
for _ in range(20):
    probs = step_prob(x_traj[-1], true_goal)
    moves = list(probs)
    d = rng.choice(moves, p=np.array([probs[m] for m in moves]))
    deltas.append(d)
    x_traj.append(x_traj[-1] + d)

## Level-1 goal inference: exact Bayes over the two goal hypotheses
goals = [1, 9]
belief = {1: 0.5, 9: 0.5}
beliefs_goal9 = [0.5]
for t in range(len(deltas)):
    x_now, d = x_traj[t], deltas[t]
    post = {
        g: prior * step_prob(x_now, g).get(d, 0.0)
        for g, prior in belief.items()
    }
    total = sum(post.values())
    if total == 0:
        raise ValueError(
            "Observation has zero likelihood under every goal hypothesis"
        )
    belief = {g: p / total for g, p in post.items()}
    beliefs_goal9.append(belief[9])

t_arr = np.arange(len(x_traj))
x_arr = np.array(x_traj, dtype=float)
post_arr = np.array(beliefs_goal9)
Out[21]:
Console
Other agent's final position: 9
Observer's final P(goal = 9): 1.0000

For this seeded trajectory, the observer's final posterior is effectively 1.0 and the other agent finishes at the hidden goal. The inference has moved from a 0.5 prior to near certainty using the observed steps and the assumed behavioral model. The toy update also assumes every realized observation has positive marginal likelihood under at least one hypothesis. A robust implementation would include observation noise or a fallback for out-of-model events instead of allowing a zero normalizer. In richer settings the goal set, behavioral model, and observation model all require justification; the reusable core is likelihood-weighted belief revision over hidden intentions.

All quantities are now precomputed. We visualize the two results: the reachability affordance map with the learned-kinematics error distribution, and the observer's belief trajectory next to the other agent's actual motion.

Out[22]:
Visualization
Scatter of end-effector positions forming an annulus with radius between 0.2 and 1.8.
Empirical affordance map from 40,000 sampled joint configurations. End-effector positions fill an annulus, leaving an unreachable hole around the shoulder.
Out[23]:
Visualization
Histogram of prediction errors concentrated near zero with a short tail.
Distribution of the learned body schema's end-effector prediction error on held-out configurations. Errors concentrate near zero with a short tail, showing the schema generalizes to postures it never visited.

The first figure shows the discovered capability: every sampled end-effector position lies between the two analytic circles, and the interior hole is empty without the agent ever being told about it. The second figure shows the schema's held-out accuracy.

Out[24]:
Visualization
Line chart of corridor position rising from 4 to 9 then flattening.
Observed position of the other agent over time, moving toward the hidden goal at position 9 and stopping on arrival.
Line chart of posterior probability climbing from 0.5 toward 1.0 and ending at exact certainty.
Observer's posterior probability that the goal is 9, updated by exact Bayes after each observed step and reaching exact certainty when the agent stops.

Read the two behaviors together. Before either goal is reached, a step toward position 9 multiplies the posterior odds for goal 9 by four, while a step away divides them by four. The net evidence in this seeded run favors goal 9. When the agent stops at 9, the goal-1 hypothesis assigns zero likelihood to that event and the posterior becomes exactly one. It moves only from about 0.9990.999 to 1.01.0, so "exact" matters more than "dramatic." This is the core level-1 inference loop, but its conclusion is only as sound as the behavioral model. An obstacle, hesitation, or feint can make observed motion depart from the assumed policy and drive the same Bayesian update toward the wrong goal.

Key Parameters

The key parameters for the self-model implementation are:

  • hidden_layer_sizes: Widths of the multilayer perceptron's hidden layers. Two layers of 64 units give enough capacity for the smooth two-dimensional kinematic map without overfitting the 2,000 babbling samples. The sizing logic is worth internalizing: capacity should scale with the complexity of the map being learned and the amount of excitation data available, and both are modest here, so a modest network is correct.
  • max_iter: Maximum optimization iterations for the schema fit. A large budget lets the optimizer converge on this small dataset. On larger problems, more optimization time may improve the schema but delays its use, so the budget should follow the deployment constraint.
  • random_state: Seed for the network's weight initialization, which keeps the learned schema reproducible across runs. Reproducibility matters pedagogically here because we quote specific error figures; in a deployed system the equivalent concern is variance across training runs, since a self-model that varies run to run is a self-model the agent cannot fully trust.
  • n_train: Number of random motor-babbling configurations used to fit the schema. Coverage of the joint space, not the count alone, determines where the schema can be trusted. A larger sample drawn only from one region of joint space would yield a locally excellent, globally unreliable schema, which is the excitation lesson from System Identification restated in self-model terms.
  • eps: Step size for the central finite differences that extract the Jacobian from the learned model. Larger steps increase truncation error, while very small steps amplify floating-point and evaluation noise. The useful range depends on local smoothness, arithmetic precision, and any stochasticity in model evaluation. In this example, model approximation error dominates across a broad epsilon range, so the chosen value should be read as an empirical error-budget choice rather than a universal optimum.
  • grid_res: Workspace cell size for the reachability raster. Finer grids resolve the annulus boundary more sharply but require denser sampling for coverage. This parameter couples directly to the affordance map's reliability: at fixed sample count, refining the grid converts boundary cells from "probably reachable" to "unresolved," which is honest but less useful, and the choice is ultimately a decision-theoretic one about how much boundary detail the planner needs.

Limitations and Impact

Self-models are especially amenable to validation because the agent can choose some calibration actions and compare predictions with dedicated sensors. That advantage is bounded by safety, coverage, and sensor quality. Each layer still has characteristic failure modes.

The boundary choice is invisible when it is right and expensive when it is wrong. Place too little inside the self, for example by excluding a held tool, and the environment model must repeatedly infer action-coupled contact behavior. Place too much inside, such as the entire scene relative to the gripper, and the "self-model" stops transferring across tasks. In learned systems the boundary is implicit in which latents receive direct action inputs. A model that leaks policy information into environment latents may simulate its training distribution well and fail under interventions. Testing on shifted or off-policy action sequences is therefore a useful stress test for boundary choices. The symptom is not specific to boundary misallocation, however: poor coverage, optimization error, and other misspecification can cause the same failure, so follow-up interventions are needed to identify the cause.

Body schemas learned from data inherit the coverage of the agent's self-exploration. A schema trained near a nominal posture can be confidently wrong at extreme configurations. Calibration drift is the chronic version: gears wear, payloads change, temperatures shift, and a schema that was accurate at deployment can silently stop being so. The resilient-robotics result works because disagreement between prediction and sensing triggers a new identification cycle; long-lived embodied agents need an equivalent monitoring policy, and knowing when to distrust the self-model is as important as the model itself. Finite-sample affordance maps have a different evidential asymmetry. An observed success is a positive witness for that state-skill pair, whereas an unobserved success is not proof of impossibility. Negative conclusions require assumptions about exploration coverage and policy competence; dense sampling helps but does not supply those guarantees by itself. A planner that treats every empty cell as unreachable will forgo options, while one that ignores certified constraints will waste effort on hopeless actions. The corridor experiment gives a toy version of the same caution: its posterior reached certainty because the behavioral model was exactly right, while the same update under a wrong model could produce confident error.

Other-agent models carry the deepest limitations. Level-1 goal inference, like our corridor example, assumes the behavioral model is right; a real person sometimes moves away from their goal to avoid something, and the Bayesian update then confidently attributes the wrong goal. Nested reasoning compounds model error: to run level-2 inference, the agent must have a model of the other agent's model of itself, and errors multiply through the recursion. There are symmetric social failure modes: under-modeling people as physics produces safe-looking plans that are unusable around humans, while over-attributing intention (a learned model that sees goals in sliding doors and wind-blown bags) wastes computation and can produce bizarre avoidant behavior. Finally, theory-of-mind competence is hard to evaluate, because both the latent mental states and the ground truth for "understanding" are constructs; we will return to this in Part XI: Evaluation and Understanding. The evaluation problem is worth a closing note here, because it interacts with the four-way quality split from the opening: a model can pass behavioral theory-of-mind benchmarks, predictive fidelity on human trajectories, while its internal latent states bear no interpretable relationship to goals or beliefs, raising representation-quality questions the benchmarks never touch. Deciding how much that matters depends, once again, on whether the downstream use is prediction or explanation, and the field has not settled the answer.

The practical payoffs of these ideas are concrete. Model-based robot controllers rely on kinematic or dynamic models of the controlled system; these overlap with this chapter's broad body-schema concept, whether they are analytic, learned, or distributed across components. Learned and monitored schemas can turn some forms of damage into a re-estimation problem. Affordance models can make manipulation more tractable by pruning implausible actions and proposing useful contacts or skills, alongside geometric planning, optimization, feedback control, and learned policies. Models of other agents' trajectories, goals, or beliefs can improve crowd navigation and cooperation when interaction makes simpler reactive methods inadequate.

Summary

This chapter developed four layers of agent-relative representation, each building on the last.

  • The agent-environment boundary is a modeling decision, guided by direct controllability, direct observability, and transfer across tasks. In latent world models, action coupling is useful evidence about which variables belong to the body, but it does not determine the boundary by itself. Good training-policy performance followed by failure under shifted actions can be one symptom of a poor split; off-policy testing is a useful but nonspecific stress test that requires follow-up diagnosis.
  • Body schemas are action-oriented models of the agent's embodiment. They can be learned from self-generated data, checked against proprioception, and extended to tools through estimated tool parameters. Point predictions alone are insufficient when a controller consumes derivatives, and a pointwise Jacobian check is not a substitute for closed-loop validation.
  • Capabilities describe feasible outcomes; in this chapter, affordances are agent-, skill-, outcome-, and horizon-relative success predictions. They trade generality for cheaper evaluation and can prune actions when their calibration and negative-evidence assumptions are explicit.
  • Responsive agents can motivate latent goal or belief variables in the environment dynamics. Theory-of-mind-style inference updates those hypotheses from behavior, but its conclusion depends on the behavioral likelihood and the chosen recursion depth.
  • Self-models can be checked directly through action-sensor residuals, but their validity still depends on exploration coverage and can drift with wear; recursive other-agent models add their own compounding errors.

The body schema tells the agent where it is; the next question is where everything else is. The following chapter, Geometry, Mapping, and 3D/4D State, extends the self-centered reachability map into full spatial representations of the environment: geometric state, maps built and maintained over time, and the 3D and 4D (space-time) representations that modern world models increasingly adopt.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about self-models, body schemas, affordances, and theory of mind.

Self-Models, Body Schemas, and Affordances

Question 1 of 80 of 8 completed
Which property is NOT one of the three criteria proposed for drawing the agent-environment boundary?

Comments

No comments yet. Be the first to share your thoughts!

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2026selfmodels, author = {Michael Brenndoerfer}, title = {Self-Models, Body Schemas, and Affordances}, year = {2026}, url = {https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-10-15} }
APAAcademic
Michael Brenndoerfer (2026). Self-Models, Body Schemas, and Affordances. Retrieved from https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances
MLAAcademic
Michael Brenndoerfer. "Self-Models, Body Schemas, and Affordances." 2026. Web. October 15, 2026. <https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances>.
CHICAGOAcademic
Michael Brenndoerfer. "Self-Models, Body Schemas, and Affordances." Accessed October 15, 2026. https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances.
HARVARDAcademic
Michael Brenndoerfer (2026) 'Self-Models, Body Schemas, and Affordances'. Available at: https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances (Accessed: October 15, 2026).
SimpleBasic
Michael Brenndoerfer (2026). Self-Models, Body Schemas, and Affordances. https://mbrenndoerfer.com/writing/self-models-body-schemas-and-affordances

About the author

Continue with the full handbook

This chapter is part of World Models Handbook. Use the handbook page to browse the complete table of contents and continue reading in sequence.

Explore World Models Handbook
Newsletter

Stay up to date

Get articles, book updates, and news delivered to your inbox.

No spam, unsubscribe anytime.

or

Join the community

Sign in to remove popups, track your reading progress, and join the discussion.