Automated construction quantity surveying from PDF plans using AI. Processes construction drawings, extracts quantities/materials, analyzes competitor solutions via Firecrawl, calculates costs, and generates Excel-based takeoff reports for stakeholder collaboration.
Agentic AI system for automated construction quantity surveying from PDF construction plans.
The Construction Takeoff Agent is a specialized LangGraph orchestration that processes PDF construction plans (site plans, floor plans, elevations, details) to extract quantities, materials, and measurements. It integrates competitive intelligence via Firecrawl API and generates comprehensive Excel workbooks suitable for stakeholder collaboration.
insights tablespd_construction_takeoff1. PDF Processing → Analyze construction plans with Claude Vision
2. Quantity Extraction → Structure quantities using AI
3. Competitor Analysis → Scrape competitors via Firecrawl
4. Cost Calculation → Apply unit costs and labor rates
5. Report Generation → Create Excel workbook
6. Supabase Logging → Store results for tracking
Trigger the workflow from GitHub Actions UI or API:
curl -X POST \
-H "Authorization: token YOUR_GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/breverdbidder/spd-site-plan-dev/actions/workflows/construction_takeoff_workflow.yml/dispatches \
-d '{
"ref": "main",
"inputs": {
"pdf_url": "https://example.com/construction_plan.pdf",
"project_name": "Bliss Palm Bay Phase 2",
"project_id": "SPD-2025-003"
}
}'
from construction_takeoff_agent import run_construction_takeoff
result = run_construction_takeoff(
pdf_path="/path/to/construction_plan.pdf",
project_name="Bliss Palm Bay Phase 2",
project_id="SPD-2025-003"
)
print(f"Total Cost: ${result['total_estimated_cost']:,.2f}")
print(f"Excel Report: {result['excel_path']}")
python construction_takeoff_agent.py \
/path/to/construction_plan.pdf \
"Bliss Palm Bay Phase 2" \
"SPD-2025-003"
Required:
ANTHROPIC_API_KEY - Claude API for PDF analysis and quantity extractionSUPABASE_SERVICE_ROLE_KEY - Database loggingOptional:
FIRECRAWL_API_KEY - Competitor analysis (skipped if not provided)The agent includes Florida construction market unit costs (2025). Modify UNIT_COSTS dictionary in the agent file to update:
UNIT_COSTS = {
"excavation": {"unit": "CY", "cost": 12.50, "labor_hours": 0.05},
"concrete_slab": {"unit": "CY", "cost": 150.00, "labor_hours": 0.75},
# ... add more items
}
Configure competitor sites to analyze in COMPETITOR_TARGETS:
COMPETITOR_TARGETS = [
{
"name": "PlanSwift",
"url": "https://www.planswift.com",
"focus": "Digital takeoff and estimating software"
},
# ... add more competitors
]
Sheet 1: Project Summary
Sheet 2: Detailed Takeoff
| Item | Quantity | Unit | Unit Cost | Total Cost | Labor Hours | Category |
|---|---|---|---|---|---|---|
| Excavation | 250 | CY | $12.50 | $3,125.00 | 12.5 | earthwork |
| Concrete Slab | 50 | CY | $150.00 | $7,500.00 | 37.5 | concrete |
Sheet 3: Materials List
| Material | Quantity | Unit | Category | Specification |
|---|---|---|---|---|
| 3000 PSI Concrete | 50 | CY | concrete | Ready-mix |
Sheet 4: Competitor Insights
The agent references the API mega library located at:
breverdbidder/life-osdocs/API_MEGA_LIBRARY.mdThe agent can be extended with additional APIs from the mega library:
Based on Firecrawl analysis, the agent incorporates:
Total per takeoff: ~$0.20-0.50
Traditional manual takeoff: 4-8 hours @ $75/hour = $300-600 Automated takeoff: 5 minutes + $0.50 = ~$10-20 equivalent
Time savings: 95-98% Cost savings: 95-97%
spd-site-plan-dev/
├── agents/
│ └── orchestrator/
│ └── construction_takeoff_agent.py # Main agent
├── .github/
│ └── workflows/
│ └── construction_takeoff_workflow.yml # GitHub Actions
├── skills/
│ └── construction-takeoff/
│ └── SKILL.md # This file
├── reports/
│ └── takeoff_reports/ # Generated Excel reports
└── docs/
└── CONSTRUCTION_TAKEOFF.md # Extended documentation
The agent logs to the insights table:
{
"category": "spd_construction_takeoff",
"insight_type": "takeoff_report",
"insight_data": {
"project_id": "SPD-2025-003",
"project_name": "Bliss Palm Bay Phase 2",
"drawing_type": "site_plan",
"total_quantities": 45,
"total_materials": 32,
"total_cost": 125000.00,
"labor_hours": 520.5,
"competitors_analyzed": ["PlanSwift", "Bluebeam Revu"],
"excel_report": "/tmp/spd_takeoff_reports/takeoff_SPD-2025-003_20251219_143022.xlsx",
"status": "completed",
"timestamp": "2025-12-19T14:30:22Z"
}
}
Issue: PDF processing fails with "invalid format" Solution: Ensure PDF is not password-protected or corrupted
Issue: Firecrawl returns 401 Unauthorized
Solution: Verify FIRECRAWL_API_KEY environment variable is set
Issue: Unit costs seem inaccurate
Solution: Update UNIT_COSTS dictionary with current market rates
Issue: Excel report missing competitor insights Solution: Verify Firecrawl API key and check rate limits
Enable verbose logging:
import logging
logging.basicConfig(level=logging.DEBUG)
result = run_construction_takeoff(pdf_path, project_name)
Maintained by: Claude Sonnet 4.5 (AI Architect) Repository: github.com/breverdbidder/spd-site-plan-dev Stack: LangGraph + Anthropic Claude + Firecrawl + OpenPyXL + Supabase