An autonomous, multi-agent 3D engineering system powered by LangGraph, Gradio, and the Blender Python (BPY) API. This agent doesn't just generate models; it performs reverse-engineering, validates code execution, and runs advanced mesh quality assurance.
- Decision-Making Supervisor: Intelligently routes requests between specialized agents based on user intent (e.g., Designing vs. Scripting).
- Chain-of-Thought (CoT): The Analyst Agent generates natural language reasoning traces before creating blueprints, ensuring logical structural decomposition.
- Analyst-Architect Flow: The standard path for complex designs.
Analystbreaks down 2D concepts into JSON blueprints, andArchitectsynthesizes precise BPY code. - Direct Coder Path: A specialized
Coder Agentfor "procedural" or "scripting" requests that bypasses blueprinting for direct, low-level Blender control.
- Code Validation: Real-time execution of BPY scripts in a headless Blender environment to ensure zero syntax errors.
- Mesh Integrity Testing: A new
Tester Agentuses thebmeshengine to detect 3D-printing issues:- Non-manifold edges (watertightness check)
- Degenerate geometry (zero-area faces)
- Self-intersections
- Self-Correction Loop: If validation or testing fails, the system automatically feeds the errors/logs back to the agent for recursive fixes (up to 3 retries).
- Split-Pane Inspector: View the Blueprint (JSON), Generated Code, and Technical Quality Report side-by-side with the results.
- 3D Preview: Interactive WebGL rendering of generated STL models.
- Rich Logging: Colorful, detailed terminal logs with full stack trace capture for easy debugging.
The system utilizes a complex LangGraph workflow to manage state and coordination across multiple specialized agents.
graph TD
User([User]) <--> UI[Gradio Interface]
UI <--> App[App Logic]
subgraph "LangGraph Agent Cluster"
App --> Graph[StateGraph]
Graph --> Sup[Supervisor Agent]
Sup -->|Route| Ana[Analyst Agent]
Sup -->|Route| Cod[Coder Agent]
Ana --> Sup
Sup -->|Route| Arch[Architect Agent]
Arch --> Val[Validator Agent]
Cod --> Val
Val -->|Errors| Sup
Val -->|Pass| Test[Tester Agent]
Test -->|Quality Issues| Sup
Test -->|Pass| Final([Final STL])
end
subgraph "Execution Layer"
Arch & Cod -.-> BPY[Blender / BMesh API]
Val & Test -.-> BPY
BPY --> STL[STL Output]
end
Final -.-> UI
- Python 3.11+
- Blender: The agent requires a Blender environment. Install the high-performance
bpymodule:pip install bpy
Create a .env file in the root directory:
LITELLM_MODEL=openai/gpt-4o # Or your preferred model
LITELLM_API_KEY=your_key
LITELLM_BASE_URL=your_proxy_urlRun the automated bootstrapper:
./run.batThe interface will be available at http://127.0.0.1:7860.
src/agents/: LLM logic for Analyst, Architect, Coder, Supervisor, and Tester.src/utils/blender_ops.py: The bridge between Python and Blender's internal modeling engine.src/graph.py: The state machine logic and routing rules.src/config/logger.py: Custom colorful logging system with traceback integration.
- Added Tester Agent with BMesh integrity checks.
- Added Coder Agent for direct scripting.
- Implemented Chain-of-Thought reasoning in the Specialist layer.
- Overhauled UI with Quality Report and Enhanced Logging.
