Skip to main content
Glama

Alloy physics engine

Open source under Apache-2.0: https://github.com/argonrobotics-ai/alloy

A cloth sheet draped over a stand, simulated in Alloy

arXiv

Install: pip install alloy-engine, inside a Python 3.11 or 3.12 virtual environment (Linux x86_64, or macOS on Apple silicon), then the quick start below. On an older Python (a stock Ubuntu 22.04 has 3.10) pip answers "from versions: none": uv venv -p 3.12 --seed && source .venv/bin/activate makes a 3.12 environment with pip in it.

Alloy is a physics engine for robot learning, built on Newton, MuJoCo Warp and Warp: rigid bodies and robots step in MuJoCo Warp (MuJoCo C on the CPU), cloth and soft bodies in Newton's VBD, sand and pastes in Newton's MPM, liquids in Alloy's own DFSPH. One scene can hold rigid robots (sub-millimetre contact for declared precision fits such as pegs and threads), cloth and soft bodies, liquids, granular material, cables and objects that cut or tear, stepped together in parallel worlds on one NVIDIA GPU: thousands for free rigid bodies, 512 to 4,096 for a robot arm (on one L4, a Franka Panda with a table and a cube ran best at 2,048), tens to hundreds with cloth or liquid. Without a GPU everything runs on the CPU, slowly.

Keep in mind: the engine's known limits, each with its size and workaround, are on one page, https://alloy.argonrobotics.ai/docs/keep-in-mind/ (installed as public/keep-in-mind.md in the docs folder, with a page per limit in known_gaps/).

Objects are described once as cards (YAML: shape plus material values with their sources); a router picks the solver for each (MuJoCo Warp for rigid bodies, VBD for cloth and soft bodies, DFSPH for liquids, ...), and one Simulation loop steps them together.

What it is for:

  • A robot arm pouring liquid: build the cup into the robot's hand in its MJCF and the robot pours from it into a second container (docs/guide/robots.md, Grasping). For liquid pouring reinforcement learning, the ready-made Pour-v0 env streams water from a spout; the agent moves a bowl under the stream and is rewarded for catching it.

  • Cloth and towel folding for imitation learning: ClothFold-v0 (experimental) is a task that folds a towel along its diagonal with a gripper; a scripted fold ships as examples/envs/09_cloth_fold.py (expect partial folds), and alloy.il records the env's episodes as demonstrations (HDF5, robomimic layout). The recording holds observations and actions, not the towel's vertices, and a recording with cloth cannot be replayed.

  • An MJCF robot with sand and water: one scene holds a robot from an MJCF file, sand (MPM) and water (DFSPH), stepped together. The sand is a solid wall to the water, which does not soak in (docs/known_gaps/sph-mpm-mixing.md). It is slow on a CPU.

  • Cable and wire manipulation: scene.add_rod makes a cable or wire that bends, twists and stretches as its material says, and a robot can grip and twist it; a copper wire keeps a bend past yield (docs/guide/rods.md).

  • An MCP server physics simulator for robotics: alloy mcp gives an AI agent the engine as MCP tools (build a scene, step it, read its state and health, render it); see MCP server below.

Status: early public release (0.x). APIs may change between minor versions.

Install

Linux x86_64 (CPU or NVIDIA GPU) or macOS on Apple silicon (CPU). Linux aarch64 installs the same way but is not tested yet. Newton and MuJoCo Warp come inside Alloy; Warp, MuJoCo and the rest come from PyPI.

Inside a Python 3.11 or 3.12 virtual environment (python3 -m venv .venv && source .venv/bin/activate; a stock Ubuntu 24.04 refuses pip outside one (PEP 668, "externally-managed-environment"), and its python3 -m venv needs sudo apt install python3-venv first):

pip install alloy-engine                       # the import name is alloy
python -c "import alloy; print(alloy.__version__)"
pip install "alloy-engine[import,mesh]"        # optional extras (below)

Extras, each added the same way: import (the object library below, mesh import, collision="decompose"), mesh (soft bodies from meshes), envs (PyTorch, huggingface_hub and Gymnasium, for the Gym envs and torch camera images; about 3 GB), il (HDF5 demonstration files), lerobot (LeRobot datasets; Python 3.12), usd (reading USD files), viewer (the live viewer) and barcode. The docs, the runnable examples and AGENTS.md install with the package: python -m alloy.docs prints where.

NVIDIA GPU: the pinned Warp (warp-lang 1.18.0) needs an R580-series or newer NVIDIA driver and a Turing (sm_75: T4, RTX 20 series) or newer GPU (Warp's install notes). Stock cloud images often ship without a driver: install one first (nvidia-smi then lists the GPU). Without a GPU it can use, Alloy runs on the CPU (alloy.build(scene) picks cuda:0 when there is one). On a fresh Ubuntu machine with an NVIDIA GPU:

sudo ubuntu-drivers install && sudo reboot     # the NVIDIA driver (or start from a CUDA image instead)
nvidia-smi                                     # after the reboot: lists the GPU
pip install "alloy-engine[envs]"               # in your virtual environment: Alloy plus PyTorch for the GPU

A C compiler lets CPU robot scenes use MuJoCo's C step (gcc on Linux; on a Mac, Apple's command line tools: xcode-select --install); without one they run on a slower fallback, and Alloy says so.

The first run of a new kind of scene compiles kernels once: about 45 s on a CPU (41 s on an 8-vCPU Linux machine, 44 s on an Apple-silicon Mac) and 3 to 4 minutes on an NVIDIA GPU (190 to 240 s on L4s). The result is cached, so later runs start in seconds.

AI agents: start with AGENTS.md, the whole quick start in one file: python -m alloy.docs agents prints it. Every page is also on the docs site, https://alloy.argonrobotics.ai/docs/, and its index for language models is https://alloy.argonrobotics.ai/llms.txt.

Related MCP server: MuJoCo MCP Server

Quick start

Open in Colab In a browser: the quick start notebook installs Alloy on Colab's free CPU runtime, drops a box, drapes a cloth and shows one rendered frame, in a few minutes.

Drop a box onto a table and save its trajectory (size is full edge lengths in metres; under a minute on a CPU once kernels are cached):

import alloy

scene = alloy.Scene(dt=0.005)                       # control period: 5 ms per step
scene.add_ground()
scene.add_box("table", size=(0.8, 0.8, 0.70), pos=(0, 0, 0.35), static=True)   # top at z = 0.70 m
scene.add_box("box", size=(0.08, 0.08, 0.08), pos=(0, 0, 0.90), mass=0.5)     # kg
sim = alloy.build(scene)                            # GPU if there is one, else CPU
traj = sim.run(1.5, record=["box"])                 # traj["box.pos"]: (frames, worlds, 3)
traj.world(0).save("drop.npz")                      # t, box.pos, box.quat_wxyz, ...
z = float(traj.world(0)["box.pos"][-1, 2])
print(f"box rests at z = {z:.3f} m, health ok: {sim.check()['ok']}")   # 0.740: table top + half the box
assert abs(z - 0.74) < 0.005

More: the examples' api/ scripts (a gripper lift, many parallel worlds, cloth, liquid) and AGENTS.md.

Object library

The starter library (materials, contact pairs, 118 objects, demo scenes, robot models) installs with Alloy. About 5,400 more object cards, with collision hulls and estimated mass and friction, are a public Hugging Face dataset, argonrobotics-ai/alloy-library, kept outside the package: 1,111 YCB and Google Scanned Objects scans; 1,989 Objaverse objects; 1,900 kitchen objects and fixtures made by Lightwheel (NVIDIA's PhysicalAI-Robotics-Manipulation-Objects-Kitchen-MJCF dataset, CC BY 4.0, as packaged by RoboCasa, with our collision hulls, estimated masses and materials; no RoboCasa kitchens or tasks); and 393 cards from Gym-Anything, one per rigid part of its articulated objects. 263 of the kitchen cards carry a flag for a failed mass, size or physics check. The cards record where each mass comes from: measured or from a catalogue for 64 of the YCB and Google Scanned objects, an estimate from the object's category or mesh volume for more than 9 in 10 (the note says ESTIMATE); friction is that of the library material the card names, not measured per object. Each one has its card, meshes, convex hulls, textures and a thumbnail. Alloy downloads only the objects you ask for, into ~/.cache/alloy/imports/<library>/; no account or login is needed. Fetching needs the import extra (it brings huggingface_hub): pip install "alloy-engine[import]". With the extra, a build also fetches a Hub object you name that is not on disk yet; without it, add_object raises SceneError for any object not on disk, its fix naming the extra and alloy fetch <name>. To fetch ahead of time:

alloy fetch --list --library ycb_gso                 # what there is; nothing is downloaded
alloy fetch ycb_025_mug ycb_024_bowl                 # objects by name; files you already have are not downloaded again
alloy fetch --library robocasa --category blenders   # one category; --library alone fetches a whole library (GBs)

Then use them by card name: scene.add_object("mug", "ycb_025_mug", pos=(0, 0, 0.1)), or alloy compose "a mug and a bowl on a table". ALLOY_CACHE moves the download folder. Each object's card records the licence its source declares (CC BY 4.0, MIT, CC0 1.0 or Apache-2.0) and, in the comment at its top, the credit to give (the dataset's ATTRIBUTION.md collects them); check both before you share an object or an image of it, or use it commercially.

MCP server

alloy mcp serves the engine as Model Context Protocol (MCP) tools over stdio, with nothing beyond pip install alloy-engine: list, scene, build, step, run, state, targets, reset, drive, pose, wrench, settle, heater, controls, close, check, render, estimate, import, export, vary, compose, create, audit and fetch, the operations of the alloy command line with the same JSON. To add it to Claude Code:

claude mcp add alloy -- alloy mcp

fetch, create and compose's objects from the Hub library need the import extra (pip install "alloy-engine[import]"). The server code is alloy/mcp/.

What is in the box

What pip install alloy-engine puts in site-packages (python -m alloy.docs prints the docs, examples and AGENTS.md paths):

Path

What

alloy/

the engine package: cards, scene assembly, solvers, contact, coupling, precision, parallel worlds

alloy/_data/library/

the starter card library: materials (with sources), contact pairs, objects, scenes, robots

alloy/_data/docs/

the docs: public/ (from index.md), known_gaps/ (a page per limit), guide/ (reference)

alloy/_data/examples/

runnable scripts (index: README.md there)

alloy/_data/AGENTS.md

the quick start for AI agents

Built on

Alloy's physics core is built on Newton and MuJoCo Warp (both Apache-2.0), on Warp. Rigid bodies and robots step in MuJoCo Warp through Newton's SolverMuJoCo (in MuJoCo C on the CPU), cloth and soft bodies in Newton's SolverVBD, sand and pastes in Newton's implicit MPM solver, and liquids in Alloy's own DFSPH solver. Newton and MuJoCo Warp ship inside Alloy as alloy/_vendor/newton (with our fixes) and alloy/_vendor/mujoco_warp (files unchanged), with their own names, licences and copyright headers; alloy/_vendor/VENDORED.md (in the package) lists the upstream commit each starts from and every change we made. By default Alloy replaces some of MuJoCo Warp's solver and collision steps at run time (listed in the same file).

Installing Alloy does not install or replace a newton or mujoco-warp package of your own, but it pins mujoco==3.17.0 and warp-lang==1.18.0 (from PyPI) and replaces other versions of those two in the environment. A newton or mujoco-warp of your own can share the environment only if it accepts exactly those versions; otherwise keep it in its own virtual environment.

Citation

The paper on Alloy is on arXiv: https://arxiv.org/abs/2611.16312. To cite Alloy, cite from the arXiv page.

Licence

Apache-2.0 (see LICENSE). Third-party code, robot models and data keep their own licences; see NOTICE. Issues and questions: https://github.com/argonrobotics-ai/alloy/issues. Contributing: https://github.com/argonrobotics-ai/alloy/blob/main/CONTRIBUTING.md. Pull requests run the quick CPU tests: about 45-60 minutes with a warm kernel cache; a run with no cache first warms it for about 45-55 minutes. Security reports: privately, through https://github.com/argonrobotics-ai/alloy/security (see SECURITY.md), not in public issues.

Available Tools

25 tools
auditStress-test a scene: alloy.check over several seeds plus the bully agent's random legal episodesA
Read-onlyIdempotent

Audit a scene the way a reviewer would, but automatically and with numbers: alloy.check over rounds seeds (each finding with the share of rounds it showed in and the command that replays it) and the bully agent over episodes random legal episodes (class, first tick, body, replay handle). Findings come sorted by severity, each with a suggested fix; ok is false when any finding is an error. A scene given as a recipe, Scene JSON, a .json file or a robot file is first written as cards to a folder that stays (cards in the reply), so the replays keep working after the call. Example arguments: {"scene": "demo_peg_d12", "rounds": 2, "episodes": 8}

Inputs: scene (required), seed, bully, cards, +6 more.

buildBuild a scene into a simulation and keep it openA

Build a scene (first build of a new scene compiles kernels: about a minute). Later calls pass the returned id as sim. Names list every body, joint and particle object. Example arguments: {"scene": "demo_peg_d12", "worlds": 4}

Inputs: scene (required), id, seed, device, +5 more.

checkPhysics check of a scene (cards, overlaps, a short run) or of an open simulation nowA
Read-onlyIdempotent

Check a scene: card validation, overlap at load, rest drift, penetration, health events and energy drift, each finding with what to change. With sim (or after build) it checks the open simulation now. Example arguments: {"scene": "demo_peg_d12", "quick": true}

Inputs: sim, seed, quick, scene, +9 more.

closeClose an open simulationC

Close an open simulation. Example arguments: {"sim": "sim1"}

Inputs: sim.

composeBuild physics-checked scenes from a sentence or a JSON spec: objects, liquids, grains, cloth, cablesA

Pick objects from the card library (Alloy's, alloy-assets, every imported library and your own folders), place them with support, clearance and clutter rules, run alloy.check after every placement and a full check at the end, and fix what the checks flag. Liquids and grains fill containers by volume or mass ('a mug with 200 ml of water'), pour as a stream, or pile at their angle of repose; cloth lies flat, drapes or hangs over the table edge; cables have a length, a gauge and ends plugged into objects. Returns every scene with its objects, soft items (amounts, routes, estimates), check report and metrics. Example arguments: {"sentence": "a mug and two cubes on a table", "variations": 1, "out": "my_scenes"}

Inputs: out, area, seed, spec, +8 more.

controlsSet raw actuator inputs by actuator name (Sim.set_controls)A

Set raw actuator inputs by actuator name (Sim.set_controls); targets is the usual way. Example arguments: {"sim": "sim1", "controls": {"arm/actuator1": 0.5}}

Inputs: controls (required), sim, seed, scene, +6 more.

createMake a validated object card from your mesh, a photo or a text descriptionA

Turn a mesh file, a photo or a text into an object card with a repaired watertight mesh, convex hulls, a visual GLB, and mass, friction and restitution with their sources (USER, CITED, LIBRARY or ESTIMATE with a range). Nothing is refused for a missing citation: estimates are labelled and listed under 'verify'. The card is drop-tested with alloy.check and written to out (use it with alloy.compose or Scene.add_object). Example arguments: {"mesh": "part.stl", "units": "mm", "material": "steel", "out": "my_objects"}

Inputs: up, out, mass, mesh, +10 more.

driveMove a kinematic object at a constant velocity from now (Sim.drive)A

Move a kinematic object at a constant velocity from now (Sim.drive); stop=true ends all drives. Example arguments: {"sim": "sim1", "name": "belt", "velocity": [0.25, 0, 0], "duration": 2.0}

Inputs: sim, name, seed, stop, +11 more.

estimateEstimate memory, step time and wall time of a run before running itB
Read-onlyIdempotent

Estimate memory, step time and wall time of a run before running it. Example arguments: {"scene": "demo_peg_d12", "worlds": 1024, "seconds": 2.0}

Inputs: scene (required), device, worlds, library, +3 more.

exportExport a scene or a library object to MJCF, URDF and USD (each checked by loading it)A

Export a scene or a library object to MJCF, URDF and USD (each checked by loading it). Example arguments: {"scene": "demo_peg_d12", "out": "out/peg", "formats": ["mjcf", "usd"]}

Inputs: out (required), scene, object, formats, +1 more.

fetchDownload objects of Alloy's object library (cards, meshes, textures, thumbnails) from the Hugging Face Hub into the local cacheA

Files go to $ALLOY_CACHE/imports// (default ~/.cache/alloy/imports//), where scenes, compose and the API find them; files already there with the right sha256 are not downloaded again. An object whose model uses another object's files (a composed cabinet's door panel and handle) brings that object too (required). Several fetches can fill one cache at the same time. The library is a public Hugging Face dataset: no login is needed (hf auth login or HF_TOKEN raises the Hub's rate limit). Example arguments: {"library": "ycb_gso", "category": "ycb"}

Inputs: list, repo, names, library, +2 more.

heaterChange a heater's temperature (K) or power (W) while running (Sim.set_heater)B

Change a heater's temperature (K) or power (W) while running (Sim.set_heater). Example arguments: {"sim": "sim1", "name": "burner", "temperature": 370.0}

Inputs: name (required), sim, seed, power, +8 more.

importImport an MJCF, URDF or USD file into object, material and scene cardsB

Import an MJCF, URDF or USD file into object, material and scene cards. Example arguments: {"file": "robot.urdf", "out": "my_library"}

Inputs: out (required), file (required), name.

listList library scenes, objects, materials or robots, recipe add kinds, or these operationsB
Read-onlyIdempotent

List library scenes, objects, materials or robots, recipe add kinds, or these operations. Example arguments: {"kind": "objects", "match": "peg"}

Inputs: kind, limit, match, library.

poseTeleport a free or kinematic body now, at rest (Sim.set_pose)B

Teleport a free or kinematic body now, at rest (Sim.set_pose). Example arguments: {"sim": "sim1", "name": "cube", "pos": [0, 0, 0.5]}

Inputs: name (required), pos, sim, seed, +9 more.

renderRender a PNG of one world (auto-framed unless look_at is given)B

Render a PNG of one world (auto-framed unless look_at is given). Example arguments: {"scene": "demo_peg_d12", "out": "peg.png", "width": 320, "height": 240}

Inputs: fov, out, sim, spp, +13 more.

resetPut every world of a simulation back to its start stateC

Put every world of a simulation back to its start state. Example arguments: {"sim": "sim1"}

Inputs: sim, seed, scene, device, +5 more.

runRun some simulated seconds, recording framesB

Run some simulated seconds, recording frames; saves them to an .npz and samples a few. Example arguments: {"scene": "demo_peg_d12", "seconds": 1.0, "names": ["peg_d12"], "out": "traj.npz"}

Inputs: seconds (required), out, sim, seed, +13 more.

sceneCheck a scene description without building it (fast)A
Read-onlyIdempotent

Check a scene description without building it (fast); optionally save it as JSON or cards. Example arguments: {"scene": {"objects": [{"add": "ground"}, {"add": "sphere", "name": "ball", "radius": 0.05, "pos": [0, 0, 0.3]}]}}

Inputs: scene (required), save, cards, worlds, +1 more.

settleRun some seconds with no new commandsA

Run some seconds with no new commands; the settled state becomes the one reset returns to. Example arguments: {"sim": "sim1", "seconds": 0.5}

Inputs: seconds (required), sim, seed, scene, +6 more.

stateRead the current state of bodies, joints and particle objectsC

Read the current state of bodies, joints and particle objects. Example arguments: {"sim": "sim1", "names": ["cube"], "world": 0}

Inputs: sim, seed, names, scene, +8 more.

stepAdvance a simulation some control periodsB

Advance a simulation some control periods; returns state and health. Example arguments: {"sim": "sim1", "steps": 50, "names": ["cube"]}

Inputs: sim, kind, seed, names, +11 more.

targetsSet joint position or velocity targets (kept until changed)B

Set joint position or velocity targets (kept until changed). Example arguments: {"sim": "sim1", "targets": {"arm/lift": 0.1}}

Inputs: targets (required), sim, kind, seed, +7 more.

varyMake n variants of a scene (free objects moved, textures swapped) as Scene JSON filesA

Make n edited copies of one scene for visual and placement diversity, the same for the same seed: each free object (not robots, static, kinematic or held ones) moves within +-pos in x, y and +-yaw degrees, objects that touch move together, and a draw that overlaps or loses its support is redrawn; each look takes another texture of its family plus a small tint. Writes variant_000.json ... (pass one as scene to build, run or render) and variants.json (moves and textures); sheet adds contact_sheet.png. Example arguments: {"scene": "demo_peg_d12", "n": 4, "pos": 0.01, "yaw": 10, "seed": 3, "out": "variants", "sheet": true}

Inputs: scene (required), n, out, pos, +9 more.

wrenchHold a force and torque on a body until changedA

Hold a force and torque on a body until changed; zeros remove it (Sim.apply_wrench). Example arguments: {"sim": "sim1", "name": "cube", "force": [0, 0, 5]}

Inputs: name (required), at, sim, seed, +9 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 25 tools

    Disambiguation3/5

    Several clusters overlap in purpose: check vs. scene vs. audit all validate scenes (differing only in depth/timing), step vs. run vs. settle all advance time, and targets vs. controls both set actuator inputs. The long descriptions do draw the lines, but an agent must read carefully to pick correctly, and terse names like pose/wrench/drive give little help on their own.

    Naming Consistency3/5

    All names are single lowercase words, which is stylistically uniform, but there is no verb_noun pattern and the set mixes verbs (build, step, render, fetch) with bare nouns (scene, state, targets, heater, controls). Names are readable in context yet cryptic out of it.

    Tool Count3/5

    25 tools sits at the heavy end for what is essentially a physics-simulation workbench spanning authoring, asset import, runtime control and validation. Each tool maps to a real operation, but the surface is broad enough that discovery is a burden and consolidation (e.g. check/scene/audit, step/run) would help.

    Completeness4/5

    Coverage is strong: scene authoring (scene, build, compose, create, import, fetch, list, vary, export), runtime control (pose, wrench, drive, targets, controls, heater, step, run, settle, reset, state, close), validation (check, audit, estimate) and rendering. Gaps are minor — no explicit removal of bodies/objects mid-simulation and no sensor/camera readout beyond state.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server enabling AI agents to author Unreal Engine 5 scenes directly, with tools for spawning actors, building PCG graphs, validating physics, generating terrain, and more through a single MCP connection.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Exposes MuJoCo physics simulation to AI assistants via 65 MCP tools, enabling natural language control of robotics simulation, trajectory optimization, contact analysis, and video export.
      12
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Advanced robotics simulation platform enabling AI assistants to control complex physics simulations via natural language, built on MuJoCo and MCP.
      10
      MIT