Skip to main content

bricky

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

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

An AI agent writes a LEGO® model as a Python build script, and bricky builds it the way a compiler builds code. Each build places every part in exact geometry, reports each mistake with the script line behind it, and renders four views with rulers.

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

With pip on Python 3.12 to 3.14, run pip install bricky and then playwright install chromium. On Linux, playwright install --with-deps chromium also installs the browser's system libraries. To install bricky as a tool, run uv tool install --python 3.14 bricky --with-executables-from playwright, then playwright install chromium. The command is then bricky, without uv run.

Build a model

A build script defines build(), which places parts by their BrickLink id, in studs and plates. Save this tower as tower.py:

from bricky import ModelBuilder


def build() -> ModelBuilder:
    builder = ModelBuilder("tower")
    for level in range(6):
        z = 3 * level  # a brick is three plates tall
        if level % 2 == 0:
            builder.place("3001", at=(0, 0, z), color="Red")  # Brick 2 x 4
            builder.place("3001", at=(2, 0, z), color="Red")
        else:  # rotated 90 degrees, each brick bridges the two below
            builder.place("3001", at=(0, 0, z), rotation="R90", color="White")
            builder.place("3001", at=(0, 2, z), rotation="R90", color="White")
    return builder

The build saves the model as tower.bricky.json, prints the report and renders the sheet tower.png:

uv run bricky build tower.py

Learn more

  • Get started: a tutorial that builds a wall, reads its report and fixes it.
  • Connect an agent: the command line, the MCP server (bricky-mcp) and the skill.
  • Gallery: larger models in 3D viewers, each with its build script.
  • Source: the repository, with every example and the benchmark.

Disclaimer

LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize or endorse this project.

Metadata

Release files for bricky 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bricky 0.1.0
File Size Uploaded Provenance Actions
bricky-0.1.0.tar.gz 640.9 kB Without provenance Details for bricky-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bricky 0.1.0
File Interpreter ABI Platform Actions
bricky-0.1.0-py3-none-any.whl Python 3 none any Details for bricky-0.1.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / bricky-0.1.0.tar.gz

Download URL bricky-0.1.0.tar.gz
Size 640.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c98cc639224e083298d53375159d04ba037549cb2ab3691ee2dfc8935ec78dd6
BLAKE2b-256 checksum
How to use checksums
3e72740e746f94d17b20ab4ff3bda385fffe15fce2f5fab0e3d3f1fbc9983719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bricky-0.1.0-py3-none-any.whl

Download URL bricky-0.1.0-py3-none-any.whl
Size 679.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3373b9e2fd2ba70e90b362c6904cf31c0eb9619cb14f4da0746f33e24288d36a
BLAKE2b-256 checksum
How to use checksums
8e7ecd77a241c1f5ce8e1a402a573d7a626b0bdf48004404d99be5de70d05c6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bricky 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page