cd /news/robotics/how-to-let-claude-code-codex-or-curs… · home › topics › robotics › article
[ARTICLE · art-173130] src=dev.to ↗ pub= topic=robotics verified=true sentiment=↑ positive

How to let Claude Code, Codex or Cursor build a robot simulation

A developer walkthrough shows how to wire the open-source Alloy physics engine into coding agents like Claude Code, Codex and Cursor so they can build and run robot simulations autonomously. Alloy ships agent-oriented docs and an MCP server exposing scene, build, run, state, check and render operations, and every error carries a message plus a fix so agents can self-correct. The author recommends calling sim.check()["ok"] after each run, since a frozen or broken world can still look calm in a render.

recommendation

Give coding agents tool-level simulation operations and errors with an explicit fix field, then verify each run with sim.check()["ok"] before trusting the result.

more in playbook: Designing agent systems
by read2 min views4 publishedNov 20, 2026

Coding agents are good at writing Python, but robot simulation is a hard place for them: scenes fail in confusing ways, the first run compiles for minutes, and a simulation that quietly blew up can look like a success. This walkthrough sets up Alloy, an open-source physics engine for robot learning, so an agent like Claude Code, Codex or Cursor can build and run simulations on its own, either through plain Python or through an MCP server.

pip install alloy-engine

The package ships its docs, examples and a quick start written for agents. An agent can find them itself:

python -m alloy.docs          # prints three paths: the docs, the examples and AGENTS.md
python -m alloy.docs agents   # prints AGENTS.md, a quick start for agents

A good first prompt is simply: "Install alloy-engine, run python -m alloy.docs agents, and build me a scene where a robot arm pours water into a cup."

Alloy includes an MCP server, so the agent gets operations such as scene, build, run, state, check and render as tools instead of writing code. For Claude Code:

claude mcp add alloy -- alloy mcp

Other MCP clients (Cursor, Codex and so on) take the same command, alloy mcp, as a local stdio server.

Two habits make agent-built simulations reliable: read the error's fix, and check the world after every run.

import alloy

scene = alloy.Scene(dt=0.01)
scene.add_ground()
scene.add_box("block", size=(0.05, 0.05, 0.05), pos=(0, 0, 0.1))
try:
    scene.add_box("thin", size=(0.05, 0.05))          # a typical agent mistake
except alloy.AlloyAPIError as e:
    print(e.message)
    print(e.fix)
sim = alloy.build(scene, device="cpu")
sim.run(0.5)
print(sim.check()["ok"], round(float(sim.state(world=0)["block.pos"][2]), 3))
size needs 3 finite numbers, got (0.05, 0.05)
pass size=(..., ..., ...) in m
True 0.025

Every error carries a message and a fix that names what to pass, so the agent can correct itself without guessing. After the run the block rests on the ground with its centre at 0.025 m, and sim.check()["ok"] is True.

sim.check()["ok"] after every run: a frozen, broken world looks calm in a render.

── more in #robotics 4 stories · sorted by recency
── more on @alloy 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-let-claude-co…] indexed:0 read:2min 2026-11-20 · —