Skip to content

bricky

A compiler for LEGO® models, built for AI agents.

An agent writes a model as a Python build script. Each build places every part in exact geometry, reports each error with the script line behind it, and renders the model in four views.

Get started Gallery in 3D

The Japanese garden example: a pagoda, a torii and cherry trees in bloom around a koi pond

How it works

Each build saves the model the script describes, checks it and renders it. The agent reads the report and the images, edits the script and builds again. The loop ends when the report says 0 errors and the images show the intended model.

flowchart LR
    write("Write the<br/>build script") --> build("Run<br/>bricky build")
    build --> read("Read the report<br/>and the images")
    read -->|until 0 errors| write

Install

A uv project holds your build scripts, and uv installs Python if needed. The project pins Python 3.14, the version bricky recommends: on 3.15, installing compiles the solver HiGHS, which needs a C++ compiler.

uv init --bare --pin-python --python 3.14 my-models  # a project for your build scripts
cd my-models
uv add bricky                                        # bricky and every dependency, from PyPI
uv run playwright install chromium                   # the browser bricky renders in, once per machine

The Get started page also covers pip, a tool install and a clone of the repository. To try an example, download it into the project and build it:

curl -O https://raw.githubusercontent.com/maxencefaldor/bricky/main/examples/japanese_garden.py
uv run bricky build japanese_garden.py