A sophisticated AI-powered multi-agent system for automated analysis and quality assurance of M&E (Mechanical & Electrical) CAD/BIM projects, specifically designed for Singaporeβs construction standards and practices.
This system leverages LangGraph and OpenAIβs GPT models to create a collaborative multi-agent workflow that analyzes CAD/BIM projects across multiple dimensions:
The system employs a sequential workflow where specialized AI agents collaborate to analyze different aspects of M&E projects:
Project Data β Design Analyzer β Clash Detector β Compliance Checker
β Energy Analyzer β QA Reviewer β Final Report
Each agent is powered by an LLM (GPT-4) with specialized system prompts and domain expertise.
src/agents/)agent_base.py - Base class providing common
functionalitydesign_analyzer.py - Senior M&E Design Engineer
agentclash_detector.py - BIM Coordination Specialist
agentcompliance_checker.py - Singapore M&E Compliance
Expert agentenergy_analyzer.py - Energy Efficiency Specialist
agentqa_reviewer.py - Quality Assurance Lead agentsrc/workflows/)multi_agent_workflow.py - LangGraph orchestration
enginestate_schema.py - State management and TypedDict
schemassrc/data/)generators.py - Realistic CAD/BIM project data
generatorsrc/utils/)config.py - Configuration managementlogger.py - Logging utilitiescd F:\AI_Coding\wahloon-multi-agent-cad
python -m venv .myenv
.myenv\Scripts\activate # Windows
# source .myenv/bin/activate # Linux/Mac
pip install -r requirements.txt
Create a .env file in the project root:
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4
OPENAI_TEMPERATURE=0.1
LOG_LEVEL=INFO
python main.py --mode single --project-id WL-2024-001 --design-intent "Sustainable M&E design for commercial tower"
python main.py --mode batch --project-count 5
import asyncio
from src.workflows.multi_agent_workflow import EnhancedMEAgentWorkflow
from src.data.generators import WahLoonDataGenerator
from langchain_openai import ChatOpenAI
async def analyze_project():
# Initialize LLM
llm = ChatOpenAI(model="gpt-4", temperature=0.1)
# Generate project data
generator = WahLoonDataGenerator()
project_data = generator.generate_cad_project("WL-2024-TEST-001")
# Run workflow
workflow = EnhancedMEAgentWorkflow(llm)
results = await workflow.run_workflow(project_data)
return results
# Execute
results = asyncio.run(analyze_project())
wahloon-multi-agent-cad/
βββ src/
β βββ agents/ # Specialized AI agents
β β βββ agent_base.py # Base agent class
β β βββ design_analyzer.py
β β βββ clash_detector.py
β β βββ compliance_checker.py
β β βββ energy_analyzer.py
β β βββ qa_reviewer.py
β βββ workflows/ # LangGraph workflows
β β βββ multi_agent_workflow.py
β β βββ state_schema.py
β βββ data/ # Data generation
β β βββ generators.py
β βββ utils/ # Utilities
β βββ config.py
β βββ logger.py
βββ examples/
β βββ basic_usage.py # Usage examples
βββ tests/ # Unit tests
β βββ test_agents.py
β βββ test_workflows.py
βββ output/ # Analysis results
βββ main.py # CLI entry point
βββ requirements.txt # Dependencies
βββ .env # Environment variables (create this)
βββ README.md # This file
Role: Senior M&E Design Engineer
Responsibilities: - Assess design completeness (scoring
0-100) - Identify missing systems and documentation gaps - Evaluate
technical risks with severity levels - Analyze system integration
(electrical-mechanical, mechanical-plumbing) - Review constructability
and installation sequences - Provide prioritized recommendations
Key Outputs:
{
"completeness_assessment": {
"score": 85,
"missing_systems": ["Fire alarm integration"],
"documentation_gaps": ["Cable schedules incomplete"]
},
"technical_risks": [
{
"risk": "Inadequate cooling capacity",
"severity": "HIGH",
"impact": "schedule",
"recommendation": "Increase chiller capacity by 15%"
}
]
}
Role: BIM Coordination Specialist
Responsibilities: - Detect spatial conflicts between
M&E systems - Identify coordination issues - Analyze construction
sequence problems - Estimate cost and schedule impacts - Propose
resolution strategies
Key Outputs:
{
"spatial_clashes": [
{
"clash_id": "C001",
"elements": ["Electrical Conduit", "HVAC Duct"],
"location": "Level 5 Ceiling Void",
"severity": "HIGH",
"clearance_violation_mm": 150,
"estimated_cost_impact_sgd": 5000
}
],
"summary_metrics": {
"total_clashes": 8,
"critical_clashes": 2
}
}
Role: Singapore M&E Compliance Expert
Responsibilities: - Verify compliance with Singapore
standards: - BCA Green Mark 2021 - SS530 (Energy Efficiency) - CP5
(Electrical Installations) - SS564 (Plumbing Standards) - Assess
certification feasibility - Identify regulatory risks - Provide
rectification requirements
Key Outputs:
{
"standards_compliance": [
{
"standard": "SS530",
"requirement": "Motor efficiency IE3+",
"status": "NON_COMPLIANT",
"severity": "HIGH",
"rectification_required": "Replace motors with IE3 rated units"
}
],
"certification_impact": {
"green_mark_achievable": "Gold",
"missing_requirements": ["Energy monitoring points"]
}
}
Role: Energy Efficiency Specialist
Responsibilities: - Calculate energy performance
metrics - Identify efficiency opportunities - Assess sustainability
potential - Perform cost-benefit analysis - Recommend equipment
upgrades
Key Outputs:
{
"efficiency_opportunities": [
{
"measure": "VSD installation for AHUs",
"savings_percent": 25,
"cost_savings_sgd_year": 45000,
"payback_period_years": 2.5,
"green_mark_points": 3
}
],
"cost_benefit_analysis": {
"total_annual_savings_sgd": 120000,
"simple_payback_years": 3.2
}
}
Role: Quality Assurance Lead
Responsibilities: - Synthesize all agent findings -
Provide comprehensive quality scoring - Assess overall project risks -
Generate executive summary - Make GO/NO-GO recommendation
Key Outputs:
{
"quality_assessment": {
"overall_score": 78,
"design_quality_score": 82,
"compliance_quality_score": 75
},
"recommendations": {
"project_status": "GO_WITH_ISSUES",
"key_decisions": ["Resolve critical clashes before construction"],
"priority_actions": [...]
}
}
The system generates comprehensive JSON reports containing:
{
"project_id": "WL-2024-001",
"project_name": "Commercial Tower Project",
"design_analysis": { ... },
"clash_analysis": { ... },
"compliance_check": { ... },
"energy_analysis": { ... },
"qa_report": { ... },
"final_report": {
"executive_summary": "...",
"quality_scores": { ... },
"final_recommendation": "GO_WITH_ISSUES"
},
"processing_times": {
"total": 45.2
}
}
Run the test suite:
# All tests
pytest tests/
# Specific test file
pytest tests/test_agents.py
# With coverage
pytest tests/ --cov=src --cov-report=html
.env file.env to version control| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
OpenAI API key | Required |
OPENAI_MODEL |
Model to use | gpt-4 |
OPENAI_TEMPERATURE |
Model temperature | 0.1 |
LOG_LEVEL |
Logging level | INFO |
MAX_CONCURRENT_AGENTS |
Max parallel agents | 5 |
TIMEOUT_SECONDS |
Agent timeout | 300 |
python main.py --help
Options:
--mode {single,batch} Run mode
--project-id ID Project identifier
--project-count N Number of projects (batch mode)
--design-intent TEXT Design intent description
--output-dir PATH Output directory
This is a specialized internal tool for Wah Loon Engineering. For enhancements or bug reports, please contact the development team.
Core frameworks and libraries:
See requirements.txt for complete dependency list.
graph TD
A[Start] --> B[Initialize LLM & Agents]
B --> C[Generate/Load Project Data]
C --> D[Design Analyzer]
D --> E[Clash Detector]
E --> F[Compliance Checker]
F --> G[Energy Analyzer]
G --> H[QA Reviewer]
H --> I[Finalize Report]
I --> J[Save Results]
J --> K[End]
D -.Context.-> E
E -.Context.-> F
F -.Context.-> G
G -.Context.-> H
import asyncio
from src.workflows.multi_agent_workflow import EnhancedMEAgentWorkflow
from langchain_openai import ChatOpenAI
async def analyze_hospital():
llm = ChatOpenAI(model="gpt-4", temperature=0.1)
workflow = EnhancedMEAgentWorkflow(llm)
hospital_data = {
"project_id": "WL-2024-HOSPITAL-001",
"project_name": "New Hospital Wing",
"total_area_sqm": 35000,
"green_mark_target": "Platinum",
# ... additional specs
}
design_intent = """
Critical healthcare facility requiring:
- 100% backup power for critical loads
- Medical gas systems integration
- Infection control HVAC design
- BCA Green Mark Platinum certification
"""
results = await workflow.run_workflow(hospital_data, design_intent)
return results
asyncio.run(analyze_hospital())
# Process multiple projects in sequence
python main.py --mode batch --project-count 10 --output-dir batch_results
Typical performance for a standard commercial project:
For technical support or questions: - Review the documentation in
Wah Loon Multi-Agent CADBIM Automation System.pdf - Check
the examples/ directory for usage patterns - Consult the
development team
Proprietary software for Wah Loon Engineering Pte Ltd.
Built for Wah Loon Engineering Pte Ltd
Advancing M&E Excellence through AI Innovation