Part 06›
✎

02. Embodied Agents and Robotics#

Level: Practitioner · Reading time: 10 min · Exercise: 45 min

In one sentence: After this chapter you can name the three ingredients behind robot agents that reached expert level, explain where language models fit into that recipe, and apply the same reward-design discipline to a software agent.

Why this matters#

A web agent that clicks the wrong button retries. A warehouse robot that grips the wrong way drops the crate, and the only feedback arrives when someone cleans the floor. Peter Stone's group and Jim Fan's team both hit that wall: real-world experience is scarce. Fan puts a number on it: real robot data is capped at 24 hours per robot per day (10:00). The question this chapter answers: how do you train an agent when experience is that expensive, and what does the answer have to do with agents that only touch software?

The core idea#

An embodied agent acts through a body, physical or simulated. Stone defines an agent as "an intelligent system that interacts with the environment through sensors and effectors" (2:00). Effectors are the parts that act: motors in a robot. Between raw sensors and motors he places three modules: perception (build a model of the situation), cognition (decide what to do), and action (turn the decision into commands) (4:00).

Reinforcement learning (RL) is trial-and-error learning. The agent acts, receives a reward, a number that scores how well it is doing, and changes its behavior to earn more. A policy is the function from what the agent senses to the action it takes. A simulator is a program that imitates an environment so that trials are cheap.

The analogy is a CI loop with a coverage score: run, measure, adjust, repeat. It breaks twice: a robot trial costs time and hardware, and a reward, unlike coverage, must be designed. Stone's racing agent shows both failure directions: without penalties it pushed rival cars off the track, and with too heavy a penalty it braked and let a human pass (56:00).

How it works, step by step#

Fan's lecture (November 2024) reads as a recipe for one robot skill.

  1. Describe the skill in words. His running example is spinning a pen with a robotic hand.
  2. Let a language model write candidate reward functions. In Eureka (Ma et al., ICLR 2024) each candidate is tested by training agents against it in simulation: 10,000 copies on a single GPU, a loop of about 15 minutes. The results go back to the model, which reflects, debugs and rewrites (44:00). Fan describes two loops: an outer one in which a large model reasons and an inner one that trains a small network for motor control (50:00).
  3. Scale trial and error in simulation. Fan's bet is that "it's easier to simulate a problem than to solve it" (16:00): the whole game of Go can be simulated in perhaps 500 lines of Python (18:00). RoboCasa has models generate the objects, textures, layouts and task code of kitchen scenes, a hundred thousand of them (30:00); MimicGen then replays one human demonstration, which takes a person minutes to give, across those scenes (26:00, 28:00, 38:00). A trajectory is one full record of what the robot sensed and did.
  4. Randomize the physics. Domain randomization varies gravity, friction, weight and size across simulated worlds, trading compute for physical accuracy, so the policy cannot depend on one world (46:00). DrEureka has the same language model write those ranges, and the resulting policies moved to real hardware with no fine-tuning: a walking robot dog, a hand turning a cube, and a dog on a yoga ball (48:00).
  5. Aim at one model for many bodies. In Fan's blueprint the model takes a description of the body plus a natural-language instruction and returns actions (52:00).

Figure 1. Eureka's two loops: the outer loop reasons, the inner loop trains.

flowchart LR
    S["Skill described in words"] --> L["Language model writes candidate rewards"]
    L --> T["Agents trained with each reward in simulation"]
    T --> R["Training results go back to the model"]
    R --> L
    R --> B["Reward with the best trained agents is kept"]

The model never runs the simulation itself; it sees only the training results of the rewards it wrote, and rewrites them.

Voyager-style open-ended agents. Voyager (Wang et al., 2023), which Fan co-authored, plays Minecraft with no fixed goal: the model proposes the next task, saves each learned behavior as executable code in a skill library, and feeds errors back into the next prompt. Fan's example of a world that is simple to simulate and hard to master is Minecraft itself, a few hundred megabytes of program in which players have built a castle and a working CPU. From there he asks how to generate data in such a world (18:00).

What the practitioners say#

Peter Stone (December 2025): agents are older than the buzzword#

Jim Fan (November 2024): data is the bottleneck#

Pitfalls#

  1. A reward with no guardrails. Fix: penalize the behavior you do not want, as Stone's team did for at-fault collisions.
  2. Guardrails that are too strong. Fix: test both directions on purpose, aggression and timidity.
  3. One fixed simulator. Fix: randomize what you cannot model exactly.
  4. Collecting every example by hand. Fix: take a few good demonstrations and generate variations.
  5. Trusting a model-written reward because the code reads well. Fix: keep the candidate whose trained agent performs best.

Try it#

Run a miniature Eureka: let a model write reward functions, and judge them by measurement.

# Illustrative, standard library only: score one candidate reward by rollouts.
import random

def rollout(reward, steps=50):
    x, total = 0, 0.0                     # robot starts at position 0
    for _ in range(steps):
        action = random.choice([-1, 1])   # fixed policy: random walk
        nxt = max(-5, min(5, x + action)) # walls at -5 and +5
        total += reward(x, action, nxt)
        x = nxt
    return total

def reward_a(state, action, next_state):  # candidate a model wrote for you
    return 1.0 if next_state == 5 else -0.01

Key takeaways#

What this means for someone building agents#

  1. Treat every metric as a reward. Agents exploit it, so test both failure directions; see LLM-as-a-judge and rubrics.
  2. When feedback is slow, build a fast stand-in with the same check: a test suite for a software agent, a simulator for a robot. See agent infrastructure.
  3. Let the model propose and let a measurement decide, as Eureka does with rewards; see planning, search and decision making.

Self-check#

  1. In Eureka, what decides which candidate reward function is kept? A. A roboticist reads each function and picks one B. Agents are trained with each, and training results decide C. The language model ranks its own candidates D. The function with the fewest lines is kept
  2. What is domain randomization, and which problem does it address?
  3. GT Sophy was first too aggressive, then too timid. What changed in between?
  4. What did the two kittens in Held and Hein's experiment share, and what differed?
  5. What does Voyager store in its skill library?
Show answers 1. B. Each candidate is scored by training an agent against it. 2. Varying physical parameters such as gravity and friction across simulated worlds, so a policy does not depend on one imperfect simulation and still works in reality. 3. The reward signals: penalties for avoidable and at-fault collisions were added, then balanced. 4. The same visual experience. Only the active kitten controlled its own motion. 5. Each learned behavior as executable code, retrieved by a description of what it does.

Sources#

Next#

→ 03. Agents for Scientific Discovery, where the environment is a laboratory and the verifier is a human reading the references.