brickwright 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. brickwright-0.1.0/LICENSE +21 -0
  2. brickwright-0.1.0/PKG-INFO +89 -0
  3. brickwright-0.1.0/README.md +59 -0
  4. brickwright-0.1.0/pyproject.toml +91 -0
  5. brickwright-0.1.0/pyproject.toml.orig +86 -0
  6. brickwright-0.1.0/src/brickwright/__init__.py +5 -0
  7. brickwright-0.1.0/src/brickwright/__main__.py +6 -0
  8. brickwright-0.1.0/src/brickwright/_build_template.py +25 -0
  9. brickwright-0.1.0/src/brickwright/cli.py +446 -0
  10. brickwright-0.1.0/src/brickwright/config.py +104 -0
  11. brickwright-0.1.0/src/brickwright/driver/__init__.py +7 -0
  12. brickwright-0.1.0/src/brickwright/driver/completion.py +89 -0
  13. brickwright-0.1.0/src/brickwright/driver/critique.py +133 -0
  14. brickwright-0.1.0/src/brickwright/driver/external_critique.py +114 -0
  15. brickwright-0.1.0/src/brickwright/driver/gallery.py +289 -0
  16. brickwright-0.1.0/src/brickwright/driver/loop.py +377 -0
  17. brickwright-0.1.0/src/brickwright/driver/messages.py +168 -0
  18. brickwright-0.1.0/src/brickwright/driver/narration.py +320 -0
  19. brickwright-0.1.0/src/brickwright/driver/report.py +52 -0
  20. brickwright-0.1.0/src/brickwright/driver/tracking.py +217 -0
  21. brickwright-0.1.0/src/brickwright/driver/transcript.py +99 -0
  22. brickwright-0.1.0/src/brickwright/driver/viewpoint.py +242 -0
  23. brickwright-0.1.0/src/brickwright/prompts/__init__.py +3 -0
  24. brickwright-0.1.0/src/brickwright/prompts/compilation.py +110 -0
  25. brickwright-0.1.0/src/brickwright/prompts/dispatch_guidance.md +6 -0
  26. brickwright-0.1.0/src/brickwright/prompts/general_instructions.md +68 -0
  27. brickwright-0.1.0/src/brickwright/prompts/internal_agent_instructions.md +29 -0
  28. brickwright-0.1.0/src/brickwright/prompts/internal_subagent_instructions.md +8 -0
  29. brickwright-0.1.0/src/brickwright/prompts/render_guidance.md +4 -0
  30. brickwright-0.1.0/src/brickwright/py.typed +0 -0
  31. brickwright-0.1.0/src/brickwright/record.py +620 -0
  32. brickwright-0.1.0/src/brickwright/tools/__init__.py +69 -0
  33. brickwright-0.1.0/src/brickwright/tools/build_execution.py +113 -0
  34. brickwright-0.1.0/src/brickwright/tools/connectivity_diagnostics.py +118 -0
  35. brickwright-0.1.0/src/brickwright/tools/editing.py +314 -0
  36. brickwright-0.1.0/src/brickwright/tools/exploration.py +85 -0
  37. brickwright-0.1.0/src/brickwright/tools/finalization.py +74 -0
  38. brickwright-0.1.0/src/brickwright/tools/registry.py +241 -0
  39. brickwright-0.1.0/src/brickwright/tools/rendering.py +249 -0
  40. brickwright-0.1.0/src/brickwright/tools/schemas.py +203 -0
  41. brickwright-0.1.0/src/brickwright/tools/software_rendering.py +780 -0
  42. brickwright-0.1.0/src/brickwright/tools/subagents.py +109 -0
  43. brickwright-0.1.0/src/brickwright/tools/testing.py +128 -0
  44. brickwright-0.1.0/src/brickwright/tools/validation.py +172 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BrickWright Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: brickwright
3
+ Version: 0.1.0
4
+ Summary: Agentic LEGO® build generation.
5
+ Keywords: lego,ldraw,agents,llm
6
+ Author: BrickWright Authors
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Typing :: Typed
15
+ Requires-Dist: bricklayer-sdk
16
+ Requires-Dist: gltflib
17
+ Requires-Dist: ldraw2mesh
18
+ Requires-Dist: litellm
19
+ Requires-Dist: numpy
20
+ Requires-Dist: pillow
21
+ Requires-Dist: pydantic
22
+ Requires-Dist: pygfx
23
+ Requires-Dist: rendercanvas
24
+ Requires-Dist: rich
25
+ Requires-Dist: typer
26
+ Requires-Python: >=3.11
27
+ Project-URL: Homepage, https://avalovelace1.github.io/brickwright/
28
+ Project-URL: Repository, https://github.com/AvaLovelace1/brickwright
29
+ Description-Content-Type: text/markdown
30
+
31
+ # BrickWright
32
+
33
+ **BrickWright** is an agentic framework for creating LEGO® builds with
34
+ [BrickLayer](https://github.com/AvaLovelace1/brickwright/tree/main/packages/bricklayer). Using BrickWright,
35
+ you can direct your favorite AI agents (GPT, Claude, Gemini, etc.) to automatically create brick builds from text or
36
+ image prompts and export them to [LDraw](https://www.ldraw.org/).
37
+
38
+ ## Usage
39
+
40
+ ### 1. Install prerequisites
41
+
42
+ Install the BrickWright CLI. We recommend using [uv](https://docs.astral.sh/uv/):
43
+
44
+ ```sh
45
+ uv tool install brickwright
46
+ ```
47
+
48
+ #### LDraw parts library (optional but recommended)
49
+
50
+ BrickWright can render a build to a preview image, letting the agent visually check a build. To enable rendering,
51
+ you must download the [LDraw parts library](https://library.ldraw.org/updates?latest) and set the environment
52
+ variable `$LDRAW_LIBRARY_PATH` to its path. Without a library, the rendering tool is disabled.
53
+
54
+ ### 2. Start creating!
55
+
56
+ #### Option 1: External Agent (e.g. Codex, Claude Code)
57
+
58
+ Simply prompt your favorite agent to create a brick build following the instructions
59
+ in [EXTERNAL_AGENT_INSTRUCTIONS.md](https://github.com/AvaLovelace1/brickwright/blob/main/packages/brickwright/EXTERNAL_AGENT_INSTRUCTIONS.md).
60
+
61
+ #### Option 2: API key (e.g. OpenAI Platform, Claude Console)
62
+
63
+ Ensure that the key for your favorite AI provider is set as an environment
64
+ variable (e.g., `$ANTHROPIC_API_KEY`, `$OPENAI_API_KEY`).
65
+
66
+ ```
67
+ export OPENAI_API_KEY="sk-XXX"
68
+ # OR
69
+ export ANTHROPIC_API_KEY="XXX"
70
+ ```
71
+
72
+ Then, run `brickwright generate`:
73
+
74
+ ```zsh
75
+ brickwright generate "a detailed cruise ship" [--image ref.png] [--model M] [--effort E]
76
+ ```
77
+
78
+ Specify the generation model (e.g. `claude-opus-4-8`, `gpt-5`) with `--model` or by setting the environment variable
79
+ `$BRICKWRIGHT_GENERATION_MODEL`.
80
+ You can run `litellm.get_valid_models()` for a list of available models based on your environment's set API keys.
81
+
82
+ Results are saved to `--records-dir` (default `./records`, or `$BRICKWRIGHT_RECORDS_DIR`
83
+ if set).
84
+
85
+ Run `brickwright generate --help` for more options.
86
+
87
+ ---
88
+
89
+ *LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize, or endorse this project.*
@@ -0,0 +1,59 @@
1
+ # BrickWright
2
+
3
+ **BrickWright** is an agentic framework for creating LEGO® builds with
4
+ [BrickLayer](https://github.com/AvaLovelace1/brickwright/tree/main/packages/bricklayer). Using BrickWright,
5
+ you can direct your favorite AI agents (GPT, Claude, Gemini, etc.) to automatically create brick builds from text or
6
+ image prompts and export them to [LDraw](https://www.ldraw.org/).
7
+
8
+ ## Usage
9
+
10
+ ### 1. Install prerequisites
11
+
12
+ Install the BrickWright CLI. We recommend using [uv](https://docs.astral.sh/uv/):
13
+
14
+ ```sh
15
+ uv tool install brickwright
16
+ ```
17
+
18
+ #### LDraw parts library (optional but recommended)
19
+
20
+ BrickWright can render a build to a preview image, letting the agent visually check a build. To enable rendering,
21
+ you must download the [LDraw parts library](https://library.ldraw.org/updates?latest) and set the environment
22
+ variable `$LDRAW_LIBRARY_PATH` to its path. Without a library, the rendering tool is disabled.
23
+
24
+ ### 2. Start creating!
25
+
26
+ #### Option 1: External Agent (e.g. Codex, Claude Code)
27
+
28
+ Simply prompt your favorite agent to create a brick build following the instructions
29
+ in [EXTERNAL_AGENT_INSTRUCTIONS.md](https://github.com/AvaLovelace1/brickwright/blob/main/packages/brickwright/EXTERNAL_AGENT_INSTRUCTIONS.md).
30
+
31
+ #### Option 2: API key (e.g. OpenAI Platform, Claude Console)
32
+
33
+ Ensure that the key for your favorite AI provider is set as an environment
34
+ variable (e.g., `$ANTHROPIC_API_KEY`, `$OPENAI_API_KEY`).
35
+
36
+ ```
37
+ export OPENAI_API_KEY="sk-XXX"
38
+ # OR
39
+ export ANTHROPIC_API_KEY="XXX"
40
+ ```
41
+
42
+ Then, run `brickwright generate`:
43
+
44
+ ```zsh
45
+ brickwright generate "a detailed cruise ship" [--image ref.png] [--model M] [--effort E]
46
+ ```
47
+
48
+ Specify the generation model (e.g. `claude-opus-4-8`, `gpt-5`) with `--model` or by setting the environment variable
49
+ `$BRICKWRIGHT_GENERATION_MODEL`.
50
+ You can run `litellm.get_valid_models()` for a list of available models based on your environment's set API keys.
51
+
52
+ Results are saved to `--records-dir` (default `./records`, or `$BRICKWRIGHT_RECORDS_DIR`
53
+ if set).
54
+
55
+ Run `brickwright generate --help` for more options.
56
+
57
+ ---
58
+
59
+ *LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize, or endorse this project.*
@@ -0,0 +1,91 @@
1
+ [project]
2
+ name = "brickwright"
3
+ version = "0.1.0"
4
+ description = "Agentic LEGO® build generation."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ keywords = [
9
+ "lego",
10
+ "ldraw",
11
+ "agents",
12
+ "llm",
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: Science/Research",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
+ "Typing :: Typed",
21
+ ]
22
+ requires-python = ">=3.11"
23
+ dependencies = [
24
+ "bricklayer-sdk",
25
+ "gltflib",
26
+ "ldraw2mesh",
27
+ "litellm",
28
+ "numpy",
29
+ "pillow",
30
+ "pydantic",
31
+ "pygfx",
32
+ "rendercanvas",
33
+ "rich",
34
+ "typer",
35
+ ]
36
+
37
+ [[project.authors]]
38
+ name = "BrickWright Authors"
39
+
40
+ [project.urls]
41
+ Homepage = "https://avalovelace1.github.io/brickwright/"
42
+ Repository = "https://github.com/AvaLovelace1/brickwright"
43
+
44
+ [project.scripts]
45
+ brickwright = "brickwright.cli:main"
46
+
47
+ [tool.uv.sources.bricklayer-sdk]
48
+ workspace = true
49
+
50
+ [tool.mutmut]
51
+ source_paths = ["src/"]
52
+ do_not_mutate = ["*/_build_template.py"]
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests/"]
56
+ addopts = "--import-mode=importlib --strict-markers"
57
+ markers = [
58
+ "integration: drives the full agent loop (run_agent), the CLI, or a real subprocess",
59
+ "real_agent: runs a real AI agent with an API key",
60
+ ]
61
+ filterwarnings = ["ignore::DeprecationWarning:pygfx"]
62
+
63
+ [tool.ruff]
64
+ extend-exclude = ["tests/assets"]
65
+
66
+ [tool.ruff.lint]
67
+ extend-select = ["I"]
68
+
69
+ [tool.ruff.lint.per-file-ignores]
70
+ "src/brickwright/tools/*.py" = [
71
+ "BLE001",
72
+ "S102",
73
+ ]
74
+ "tests/**" = ["S102"]
75
+
76
+ [tool.ty.environment]
77
+ python = "../../.venv"
78
+
79
+ [build-system]
80
+ requires = ["uv_build>=0.11.2,<0.12.0"]
81
+ build-backend = "uv_build"
82
+
83
+ [dependency-groups]
84
+ dev = [
85
+ "mutmut",
86
+ "pytest",
87
+ "pytest-cov",
88
+ "pytest-regressions",
89
+ "ruff",
90
+ "ty",
91
+ ]
@@ -0,0 +1,86 @@
1
+ [project]
2
+ name = "brickwright"
3
+ version = "0.1.0"
4
+ description = "Agentic LEGO® build generation."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "BrickWright Authors" }]
9
+ keywords = ["lego", "ldraw", "agents", "llm"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Intended Audience :: Developers",
13
+ "Intended Audience :: Science/Research",
14
+ "Programming Language :: Python :: 3",
15
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
16
+ "Typing :: Typed",
17
+ ]
18
+ requires-python = ">=3.11"
19
+ dependencies = [
20
+ "bricklayer-sdk",
21
+ "gltflib",
22
+ "ldraw2mesh",
23
+ "litellm",
24
+ "numpy",
25
+ "pillow",
26
+ "pydantic",
27
+ "pygfx",
28
+ "rendercanvas",
29
+ "rich",
30
+ "typer",
31
+ ]
32
+
33
+ [tool.uv.sources]
34
+ bricklayer-sdk = { workspace = true }
35
+
36
+ [project.urls]
37
+ Homepage = "https://avalovelace1.github.io/brickwright/"
38
+ Repository = "https://github.com/AvaLovelace1/brickwright"
39
+
40
+ [project.scripts]
41
+ brickwright = "brickwright.cli:main"
42
+
43
+ [build-system]
44
+ requires = ["uv_build>=0.11.2,<0.12.0"]
45
+ build-backend = "uv_build"
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "mutmut",
50
+ "pytest",
51
+ "pytest-cov",
52
+ "pytest-regressions",
53
+ "ruff",
54
+ "ty",
55
+ ]
56
+
57
+ [tool.mutmut]
58
+ source_paths = ["src/"]
59
+ do_not_mutate = ["*/_build_template.py"]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests/"]
63
+ addopts = "--import-mode=importlib --strict-markers"
64
+ markers = [
65
+ "integration: drives the full agent loop (run_agent), the CLI, or a real subprocess",
66
+ "real_agent: runs a real AI agent with an API key",
67
+ ]
68
+ filterwarnings = [
69
+ "ignore::DeprecationWarning:pygfx",
70
+ ]
71
+
72
+ [tool.ruff]
73
+ # Test assets are captured, generated build.py files (fixtures) -- not project code.
74
+ extend-exclude = ["tests/assets"]
75
+
76
+ [tool.ruff.lint]
77
+ extend-select = ["I"]
78
+
79
+ [tool.ruff.lint.per-file-ignores]
80
+ # tools must never propagate errors, hence general exception catch (BLE001).
81
+ # `exec` is how tools run agent snippets (S102).
82
+ "src/brickwright/tools/*.py" = ["BLE001", "S102"]
83
+ "tests/**" = ["S102"] # tests exec the generated model template
84
+
85
+ [tool.ty.environment]
86
+ python = "../../.venv" # point ty to the shared venv
@@ -0,0 +1,5 @@
1
+ """BrickWright: an agent harness for building LEGO models with BrickLayer."""
2
+
3
+ from .tools.testing import TestContext
4
+
5
+ __all__ = ["TestContext"]
@@ -0,0 +1,6 @@
1
+ """Enable ``python -m brickwright`` as an alias for the CLI."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,25 @@
1
+ import bricklayer as bl
2
+
3
+ from brickwright import TestContext
4
+
5
+
6
+ def create_build():
7
+ """Return the finished :class:`bricklayer.LegoBuild`."""
8
+ build = bl.LegoBuild()
9
+ # TODO: assemble the requested build
10
+ build.add(
11
+ bl.brick(2, 2, color=bl.Color.RED), bl.Position(0, 0, 0), bl.Rotation.FRONT
12
+ )
13
+ return build
14
+
15
+
16
+ def run_tests():
17
+ """Create the build and return a report of which checks passed."""
18
+ build = create_build()
19
+ tests = TestContext(build)
20
+ tests.check_no_floating()
21
+ tests.check_no_collisions()
22
+ tests.check_connected(expected_components=1)
23
+ # Add a custom check for any measurable requirement, e.g.:
24
+ # tests.check("over 100 bricks", build.brick_count > 100)
25
+ return tests.report()