Skip to content
BrickWright logo BrickWright
Theme
Help me design…

“A lighthouse besieged by a sea serpent.”

Physically feasible Real LEGO® parts · No intersecting or floating parts · One connected component
Download LDraw
Preprint 2026

BrickWright logo BrickWright

Agentic Creation of Physically Feasible Brick Builds

Ava Pun 1  ▪  Kevin Dai 1  ▪  Sally Chen 1  ▪  Maxwell Jones 1  ▪  Ruixuan Liu 1  ▪  Kangle Deng 2  ▪  Changliu Liu 1  ▪  Maneesh Agrawala 3  ▪  Deva Ramanan 1  ▪  Jun‑Yan Zhu 1

1 Carnegie Mellon University  ▪  2 Independent researcher  ▪  3 Stanford University

Better builds with BrickWright

Prompt: “This is a white and black LEGO spaceship with a blue tinted canopy, featuring a blue-suited minifigure pilot, rear thrusters, and side-mounted weapons.”

GPT-6 Astra

Codex

Download LDraw

BrickWright

Download LDraw

GPT-6.1 Sol

Codex

Download LDraw

BrickWright

Download LDraw

GPT-6 Luna

Codex

Download LDraw

BrickWright

Download LDraw

Claude Haiku 5.5

Claude Code

Download LDraw

BrickWright

Download LDraw
Given the same prompt, BrickWright-equipped agents produce higher-quality builds with fewer physical violations than agents using general tools. The improvement is especially striking for lightweight agents Luna and Haiku. All BrickWright builds use real LEGO® parts, with no colliding (intersecting) or floating parts and one connected component. Red lines indicate brick intersections. Drag a model to rotate it.

Existing methods

Prompt: “This is a blue and gray LEGO flatbed truck featuring a detailed cab, four wheels with fenders, and a large gray cylindrical object mounted on its black studded cargo bed.”

Specialized text-to-brick models

BrickGPT

Download LDraw

BrickNet

Download LDraw

Agentic methods

Codex (GPT-6 Astra)

Download LDraw

Codex (GPT-6.1 Sol)

Download LDraw
Agentic methods better capture the request, but still produce physically infeasible builds. Both Codex outputs contain colliding bricks. Red lines indicate brick intersections. Drag a model to rotate it.

Discover parts

Search the part catalog by keyword. Keywords may target specified metadata fields, such as category and dimensions. You may also filter by specifying a field’s exact value.

search_parts(keywords, fields, filters)

Assemble geometry

Compose parts and sub-builds. Components may be placed with an exact pose or by automatically aligning typed connectors.

b = LegoBuild()
p = Element(ldraw_id, color)
b.add(p, position, rotation, relative_to, name, …)
b.connect(p1, p1.find_connector(…), p2.find_connector(…))

Check physical feasibility

Find collisions, floating parts, and connected components.

b.colliding_placements()
b.floating_placements()
b.connected_components()

BrickWright build creation loop

  1. System (paraphrased)

    Write a Python file, build.py, that uses BrickLayer to create a LEGO® build. This file should contain two functions: create_build(), which returns a LegoBuild, and run_tests(), which runs a set of tests against the build.

    You are given the tools explore, validate, render, and finalize, alongside build-file editing tools. Calling validate runs both your custom tests and a fixed set of feasibility checks. Edit build.py until all tests pass and you are happy with the render, then call finalize. You may run explore at any time to investigate the BrickLayer API.

    Here is the complete BrickLayer and tool documentation: […]

  2. User

    Build a red house with a blue roof and a brown front door, using 20 parts.

Step 1/11 Build request

Scroll to view diagram →

  1. Input

    User ▪ Text and/or image prompt System ▪ BrickLayer documentation; create-execute-validate instructions

    Current step
  2. Write build.py
    import bricklayer
    def create_build(): …
    def run_tests(): …
  3. validate()

    Compiles, no collisions or floaters, expected number of components, passes custom tests?

  4. render()

    Multi-view or custom view

  5. finalize()

    Completed brick build

  6. explore(snippet)

    Optionally run a Python snippet to investigate BrickLayer

Inspect results & revise

Illustrative demo of brick build generation with BrickWright. This is a scripted conversation with real brick builds, renders, and validation results.

Qualitative comparison

Agent model

Prompt: “This is a LEGO build of a blue, grey, and black all-terrain vehicle (ATV) or quad bike, featuring large treaded wheels, a roll cage, and translucent yellow headlights.”

Codex (GPT-6 Luna)

Download LDraw

BrickWright (GPT-6 Luna)

Download LDraw

Swipe the prompt or use the arrows to browse. Red lines show mesh intersections. Drag a build to rotate it.

1 / 8

Quantitative results

We report the proportion of prompts yielding valid builds (no collisions or floaters), collision-free builds, and floater-free builds. Components, Parts, and Unique parts are the mean connected-component, part, and distinct part-ID counts. Checks is the mean number of validate calls. ↑ means higher is better; ↓ means lower is better. Bold and underline mark the best and second-best results within each agent. Time and cost are averages per prompt; costs use October 2026 token pricing, including cache savings.