Skip to content
BrickWright logo BrickWright
Help me build…

1 / 13

“A lighthouse besieged by a sea serpent.”

Loading model…

Physically feasible Real LEGO® partsNo collisions or floatersFully connected
Download LDraw
Preprint 2026

BrickWright logo BrickWright

Agentic Creation of Physically Feasible Brick Builds

Ava Pun 1Kevin Dai 1Sally Chen 1Maxwell Jones 1Ruixuan Liu 1Kangle Deng 2Changliu Liu 1Maneesh Agrawala 3Deva Ramanan 1Jun‑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

Loading model…

Download LDraw

BrickWright

Loading model…

Download LDraw

GPT-6.1 Sol

Codex

Loading model…

Download LDraw

BrickWright

Loading model…

Download LDraw

GPT-6 Luna

Codex

Loading model…

Download LDraw

BrickWright

Loading model…

Download LDraw

Claude Haiku 5.5

Claude Code

Loading model…

Download LDraw

BrickWright

Loading model…

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

Loading model…

Download LDraw

BrickNet

Loading model…

Download LDraw

Agentic methods

Codex (GPT-6 Astra)

Loading model…

Download LDraw

Codex (GPT-6.1 Sol)

Loading model…

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/11Build request

Scroll to view diagram →

  1. Input

    UserText and/or image prompt

    SystemBrickLayer 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)

Loading model…

Download LDraw

BrickWright (GPT-6 Luna)

Loading model…

Download LDraw

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

1 / 16

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.