AgentBrick is an open-source framework designed to bridge the gap between natural language and the LDraw standard. By leveraging LangChain agents and LangGraph workflows, AgentBrick transforms user prompts into valid, structured LDraw models, allowing for iterative refinement through conversational AI.
from agentbrick.workflows import main_workflow
main_workflow.invoke({
"prompt": "House", # Initial model description
"size_x": 5, # Size of the target voxel grid in x direction
"size_y": 5, # Size of the target voxel grid in y direction
"size_z": 5 # Size of the target voxel grid in z direction
})Based on the initial user input (including the size of the discrete voxel grid), the agent derives a detailed description of the target model.
flowchart LR
Promt["Prompt"] --> LLM
Size["Grid size (x, y, z)"] --> LLM
LLM --> Description["Detailed model description"]
LLM@{ shape: cloud }
Then, the agent extracts a list of logical components (i.e. groups of connected voxels) and their interfaces with other components (i.e. voxels).
Step 2.1: Extract components
flowchart LR
Promt["Prompt"] --> LLM
Size["Grid size (x, y, z)"] --> LLM
Description[Detailed model description] --> LLM
LLM --> Components[List of components]
LLM@{ shape: cloud }
Step 2.2: Extract interfaces
flowchart LR
Promt["Prompt"] --> LLM
Size["Grid size (x, y, z)"] --> LLM
Description[Detailed model description] --> LLM
Components[List of components] --> LLM
LLM --> Interfaces[List of interfaces]
LLM@{ shape: cloud }
Step 2.3: Visualize components and interfaces
Finally, the agent iterates over the individual voxels of the voxel grid and determines the contents of each voxel (i.e. empty or assigned to component).
Step 3.1: Define voxel model
flowchart LR
subgraph X["Define voxel content"]
direction LR
Promt["Prompt"] --> LLM
Size["Grid size (x, y, z)"] --> LLM
Description[Detailed model description] --> LLM
Components[List of components] --> LLM
Interfaces[List of interfaces] --> LLM
Grid[Current voxel model] --> LLM
Cell["Next voxel coordinate (x, y, z)"] --> LLM
LLM --> Content["Voxel content (empty | component)"]
end
X --repeat--> X
LLM@{ shape: cloud }
style Cell white-space:nowrap;
style Content white-space:nowrap;
Step 3.2: Visualize voxel model
- assets/ - Project assets (icon, logo, social preview image, ...)
- sources/ - Source code
- agentbrick/ - AgentBrick library
- agents/ - Agent package
- middlewares.py - Middleware definitions (e.g.
log_model_call) - responses.py - Response definitions (i.e. pydantic schema classes)
- tools.py - Tool definitions (e.g.
calculate_sum) - __init__.py - Agent definitions (e.g.
generate_description_agent)
- middlewares.py - Middleware definitions (e.g.
- workflows/ - Workflow package
- states.py - State definitions
- __init__.py - Workflow definitions
- models.py - Model definitions (e.g. llama 3.2)
- agents/ - Agent package
- main.py - Main program
- agentbrick/ - AgentBrick library
- requirements.txt - Project dependencies
Install dependencies
pip install -r requirements.txtLinting
black .Static type checking
pyright

