Build LEGO models with an AI agent, ordinary JSON plans and LDraw parts. The tools find parts and reference constructions, generate editable MPDs, check geometry, render previews and compare parts lists. Python generators support larger procedural designs.
Watch the demonstration · Project background
You need Python 3.12+, an installed LDraw parts library, Poppler (pdftotext) and LeoCAD on PATH. The repository includes the reference data and connector metadata used by the tools.
export LDRAW_DIR=/path/to/ldraw
./setup.sh
./ldraw-agent review examples/bridge.plan.json --outdir output/bridge-reviewOpen the PNGs in output/bridge-review/previews/. The same folder contains the model, validation report, Python BOM, LeoCAD BOM comparison and a manifest tying artifacts to the model revision. review --no-render runs intermediate Python checks when previews are not needed. ./ldraw-agent doctor reports local dependencies.
Give an agent your model idea and instructions.md. The working loop is:
- Choose a design and inspect the parts or example constructions it needs.
- Write a JSON plan; use Python when calculations or loops help.
- Run
review, open the previews, repair the source and repeat. - Deliver the editable MPD, source, checks and reviewed images.
./ldraw-agent build output/my-model.plan.json
./ldraw-agent review output/my-model.mpdbuild infers output/my-model.mpd and writes only after source/geometry checks pass. You can also run review output/my-model.plan.json to build and review in one command. Use --force for a deliberate rebuild or replacement of a generated review. Keep editable source and visual-review notes outside the generated review directory.
Existing JSON plans, build --output, individual check/render commands and shell wrappers remain supported. Successful checks provide evidence, not proof of physical buildability; warnings, skipped checks and required visual inspection stay explicit.
| Need | Read |
|---|---|
| Agent workflow and subject-specific guides | Instructions |
| Plan format, placements and Python API | Plan guide |
| Commands, review options and artifacts | Tool reference |
| Geometry checks and limitations | Validation |
| Studs Not On Top (SNOT) construction | SNOT guide, parrot core, cat details and joints, Halcyon original interceptor |
| Spaceships: SNOT by default | Halcyon default model, spaceship guide |
| Reusable constructions and model examples | Reference atlas, ./ldraw-agent examples --help |
Semantic reference search uses jev-rerank and a TypeSafe API key. It is optional: offline catalogs, examples and discover search ... --engine fts remain available. Follow the availability check before using the service.
The web app and Docker configuration live in the sibling ldraw-nova-docker repository. Install Git and Docker, then clone matching release tags side by side:
git clone --branch v0.6.0 https://github.com/anteloc/ldraw-nova.git
git clone --branch v0.6.0 https://github.com/anteloc/ldraw-nova-docker.git
cd ldraw-nova-docker
docker compose build
docker compose up -dThe first build needs about 5 GB of disk space. Open http://localhost:8765, or https://localhost:8443 for VR on Meta Quest 3 (accept the self-signed certificate). Devices on your network can use the host computer's IP address. The app has no login; run it on a trusted network. Set TYPESAFE_API_KEY in the app's Settings for semantic search. Stop it with docker compose down.
The web app provides interactive 3D/VR views and conversation history. The local CLI also supports semantic GLB export for Blender through ./prepare-glb.sh --file MODEL.mpd MODEL.glb, using the installed mpd2glb.sh converter. The editable MPD remains the authoritative model.
uv sync --locked --extra test
.venv/bin/python -m pytest -qTests use a miniature library plus the configured official library for integration cases. Integration tests skip explicitly when the official library is unavailable. Current checks do not certify material collision freedom, strength, motion or real part/colour availability. See the verification records for tested coverage and historical results.
Further work includes model quality across more families, generation cost and speed, instruction-manual reconstruction, and VR handling/performance.
I'd like to thank the following:
- The LDraw Community
- LDView's Travis Cobbs (@tcobbs), and contributors.
- LeoCAD's Leonardo Zide (@leozide), and contributors.
- LDCad and Shadow Library, Roland Melkert.
- ldraw.rs's Park Joon-Kyu (@segfault87), and contributors.
- pyldraw3's Harold Martin (@hbmartin), and contributors.
... and thanks to all of the many other LDraw creators!
NOTE: For this work, I've used many LDraw models, libraries, tools, docs... from many sources.
There is a lot amazing people that generously contributed to this, even for decades, by generously donating their finest work to the public domain and open source community.
If you think you should be included on this section, please drop me an email!
LEGO(R) is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this software.