Manuscript Offprint

arXiv:2610.31651

BrickWright: Agentic Creation of Physically Feasible Brick Builds

Ava Pun, Kevin Dai, Sally Chen, Maxwell Jones, Ruixuan Liu, Kangle Deng, Changliu Liu, Maneesh Agrawala, Deva Ramanan, Jun-Yan Zhu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ava Pun 1^{1} Kevin Dai 1^{1} Sally Chen 1^{1} Maxwell Jones 1^{1} Ruixuan Liu 1^{1}

Kangle Deng 2^{2} Changliu Liu 1^{1} Maneesh Agrawala 3^{3} Deva Ramanan 1^{1} Jun-Yan Zhu 1^{1}

1^{1}Carnegie Mellon University 2^{2}Independent Researcher 3^{3}Stanford University

(a) Physically feasible brick build creation

User

"A lighthouse besieged by a sea serpent."

BrickWright

</> Write generation code

import bricklayer

def create_build(): ...

def run_tests(): ...

Checks

fail

Inspect results & revise

Figure

Image conditions

Articulated builds

"A poseable crab..."

Scenes and large-scale builds

"Hong Kong's Victoria Harbour..."

15,067 parts

(b) Improving builds created by off-the-shelf agents

"...white and black LEGO spaceship with a blue tinted canopy..."

Codex/Claude Code

GPT-6

Astra

BrickWright

GPT-6.1

Sol

Figure

Colliding

GPT-6

Luna

Claude

Haiku

5.5

Valid

Valid

Colliding

Valid

Valid

Valid

Figure 1. BrickWright overview. BrickWright instructs pre-trained LLM agents to generate physically feasible brick builds by writing code using a Python SDK, BrickLayer, in a plan-execute-validate loop utilizing BrickLayer's physical validation tools (a). BrickWright accepts text or image inputs and can produce articulated and large-scale builds, all physically valid. Agents equipped with BrickWright produce higher-quality builds with fewer physical violations (b). Red outlines in insets indicate mesh intersections.

Abstract

Frontier coding agents are becoming increasingly adept at 3D modeling. Yet, they still face challenges when building objects meant to be assembled in the physical world, often creating invalid assemblies with floating, colliding, or disconnected parts. We argue that providing agents with tools for assembling builds and verifying their physical feasibility is sufficient for them to produce physically valid assemblies that still adhere to input prompts. Focusing on the domain of LEGO ®^{\circledR} brick builds, we present BrickWright, a framework for generating physically feasible brick builds from text or image prompts using pre-trained agents, where a build is physically feasible if it uses only real parts, has no colliding or floating parts, and forms a connected structure if possible. BrickWright guides agents to create builds by writing code with BrickLayer, a Python toolkit with two main components: an ergonomic brick assembly API that halves inference cost compared to working in raw LDraw, and a validator that provides feedback on physical feasibility. Whereas baseline agents achieve physical validity rates ranging from only 9% (GPT-6 Luna) to 69% (GPT-6 Astra), BrickWright-guided agents achieve 100% validity on a sample of 512 prompts, while improving prompt adherence for lightweight agents and maintaining it for stronger agents. Additionally, they outperform specialized models on the text-to-brick task. Code is available on our project page: avalovelacel.github.io/brickwright.

1. Introduction

Large language model (LLM) agents are becoming increasingly adept at 3D modeling. Without additional fine-tuning, commercially available agents can successfully produce articulated objects [45, 59], scenes [52], and constructive solid geometry models [27]. However, they still face challenges

Figure

Figure 2. Physical violations in builds by Codex (GPT-6 Astra, high reasoning). Red outlines in insets show mesh intersections.

when building objects for the physical world. We focus on the task of creating multi-part assemblies: real-world objects made from a set of prefabricated parts joined by fixed connectors, such as LEGO ®^{\circledR} builds. Multi-part assemblies must obey multiple constraints: all parts must be drawn from a preset library, parts must not collide or float, and the joined parts typically form a single connected component.

We argue that designing a toolkit for multi-part assembly creation is sufficient to enable agents to create physically valid builds. This toolkit should include (1) an assembly API, which provides an ergonomic programmatic interface for 3D creation; and (2) a validator, which provides feedback on a finished build's physical validity. The need for a toolkit is independent of how powerful a coding agent is. We observe that GPT-6 Astra with Codex, when asked to make brick builds, already writes scripts to generate and validate its output more than 80% of the time (Sec. D). For complex physical domains, this self-validation is often not enough, resulting in builds that do not satisfy physical constraints, containing colliding, floating, or disconnected parts (Fig. 2). Even if an agent is powerful enough to write a perfect toolkit, separately developing a toolkit remains important to reduce token usage and avoid repeated work. Existing toolkits for agentic 3D generation [45, 59] are usually intended for digital asset creation; as they do not consider physical constraints, they cannot be repurposed as-is to create real-world objects.

We focus on the domain of LEGO ®^{\circledR} generation as it is a commonly available yet complex system, consisting of thousands of parts that connect in dozens of ways. Our key insight is to merge agentic code-as-3D-models with the regularity of brick parts. Parts can be modeled as geometries with localized connectors that have programmatic rules for assembly (e.g., studs interlock with antistuds). From this perspective, we leverage the physical production rules for snap-fit brick builds [6] to create an ergonomic assembly API. Then, given an image or text prompt, our task is to generate a program using this API that, when compiled, produces a LEGO ®^{\circledR} brick build in the standard LDraw format [21]. This build should include a list of library part placements, and it must be physically feasible, having no intersecting or floating parts and forming a connected structure if possible. While there are several specialized brick generation methods [10, 11, 19, 36, 37, 48, 50, 53], some of which consider physical constraints, they generally exhibit worse generalization and lower fidelity than commercial LLM agents on the same task. Hence, we wish to achieve this task agentically.

Toward this goal, we introduce BrickLayer, a Python package for assembling and validating brick builds, alongside BrickWright, a framework that guides LLM agents through creating validated brick builds with BrickLayer. Agents equipped with BrickWright create higher-quality builds with fewer physical violations; on a test set of 512 prompts, all agents—including lightweight models like GPT-6 Luna and Claude Haiku 5.5—achieve a 100% validity score without a significant cost increase or drop in fidelity. BrickWright is especially useful for lightweight models: it improves Luna's performance from 9% to 100% valid builds and boosts its prompt adherence at 2% the price of frontier models. BrickWright additionally outperforms specialized brick generation models on validity and fidelity. Code is available on our project page: avalovelace1.github.io/brickwright.

References (56)