Skip to content

ameenh1/VT_Hacks_25

Repository files navigation

Real Estate Investment AI Platform

A sophisticated 3-agent AI architecture for real estate investment analysis using Google's Gemini models and ATTOM Data API.

πŸ—οΈ Architecture Overview

Agent 1: Customer-Facing Agent (Gemini 2.5 Flash) ⭐ IMPLEMENTED

  • File: agents/customer_agent.py
  • Handles user interactions and conversations
  • Explains complex analysis in simple terms
  • Provides friendly, accessible responses
  • Fast response times for real-time chat
  • Answers follow-up questions and provides guidance

Agent 2: Analysis Engine (Gemini 2.5 Pro) ⭐ IMPLEMENTED

  • File: agents/analysis_engine.py
  • Performs complex property valuations and ARV calculations
  • Conducts comprehensive market analysis
  • Assesses investment risks and opportunities
  • Generates deal scores and investment recommendations
  • Finds and analyzes comparable properties

Agent 3: Deal Finder (Background Service) ⭐ IMPLEMENTED

  • File: agents/deal_finder.py
  • Continuously monitors new property listings
  • Flags undervalued properties automatically
  • Generates investment opportunity alerts
  • Background service with configurable search criteria
  • User-specific deal notifications

Multi-Agent Coordinator ⭐ IMPLEMENTED

  • File: agents/coordinator.py
  • Manages communication between all agents
  • Priority-based message queuing and routing
  • Load balancing and error recovery
  • Performance monitoring and metrics

πŸš€ Features

  • Quick Property Analysis: Get instant property evaluations with deal scores
  • Comprehensive Market Analysis: Deep market insights using AI-powered analysis
  • Investment Strategy Recommendations: AI suggests optimal investment approaches
  • Risk Assessment: Detailed risk evaluation across multiple categories
  • Multi-Agent Coordination: Sophisticated inter-agent communication system
  • ATTOM Data Integration: Real property data and market analytics (when configured)

πŸ“‹ Setup Instructions

1. Install Dependencies

pip install -r requirements.txt

2. Configure API Keys

  1. Copy .env.example to .env
  2. Add your API keys:
    GEMINI_API_KEY=your_gemini_api_key_here
    ATTOM_API_KEY=your_attom_api_key_here  # Optional - will use mock data if not provided
    

3. Get Your API Keys

Google Gemini API Key

  1. Go to Google AI Studio
  2. Create a new API key
  3. Copy the key to your .env file

ATTOM Data API Key (Optional)

  1. Sign up at ATTOM Data
  2. Get your API key from the dashboard
  3. Add to .env file (platform works with mock data if not provided)

4. Run the Application

Option 1: Using the run script (Windows)

.\run.ps1

or

run.bat

Option 2: Manual start

python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload

5. Test the Platform

  1. Open your browser and go to: http://localhost:8000
  2. Try the chatbot interface or use the API endpoints directly

πŸ› οΈ API Endpoints

General

  • GET / - Main chat interface (HTML)
  • POST /chat - Chat with Customer Agent
  • GET /health - System health check

Property Analysis

  • POST /api/analyze/quick - Quick property analysis
  • POST /api/analyze/comprehensive - Comprehensive analysis
  • GET /api/analyze/status/{analysis_id} - Check analysis status

Deal Finding (Agent 3)

  • POST /api/deals/search - Search for investment deals
  • POST /api/deals/monitor - Add property to monitoring
  • GET /api/deals/alerts/{user_id} - Get user's deal alerts
  • POST /api/deals/criteria/{user_id} - Set search criteria
  • GET /api/deals/status - Deal Finder monitoring status

Customer Chat (Agent 1)

  • POST /api/chat/explain - Explain analysis results
  • POST /api/chat/followup - Answer follow-up questions
  • POST /api/chat/next-steps - Get recommended next steps

System Monitoring

  • GET /api/agent/coordinator/metrics - Agent coordination metrics
  • GET /api/agent/status/{agent_type} - Individual agent status

Property Data (when ATTOM configured)

  • GET /api/property/details/{address} - Detailed property information
  • GET /api/market/data - Market analytics by area

Demo

  • GET /api/demo/sample-analysis - Sample analysis results
  • GET /api/demo/sample-deals - Sample deals from Deal Finder
  • GET /api/demo/all-agents - See all three agents working together

πŸ“Š Example Usage

Quick Property Analysis

curl -X POST "http://localhost:8000/api/analyze/quick" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "123 Main St, Blacksburg, VA 24060",
    "listing_price": 275000
  }'

Search for Deals

curl -X POST "http://localhost:8000/api/deals/search" \
  -H "Content-Type: application/json" \
  -d '{
    "max_price": 300000,
    "min_deal_score": 70,
    "target_locations": ["Blacksburg", "VA"],
    "max_results": 10
  }'

Get AI Explanation of Analysis

curl -X POST "http://localhost:8000/api/chat/explain" \
  -H "Content-Type: application/json" \
  -d '{
    "analysis_data": {
      "deal_score": 78.5,
      "investment_potential": "Good",
      "arv_estimate": 285000,
      "monthly_cash_flow": 450
    }
  }'

Demo All Three Agents

curl "http://localhost:8000/api/demo/all-agents"

Sample Response

{
  "address": "123 Main St, Blacksburg, VA 24060",
  "deal_score": 78.5,
  "investment_potential": "Good",
  "arv_estimate": 285000,
  "recommended_strategy": "buy_and_hold",
  "monthly_cash_flow": 450.0,
  "key_insight": "Property shows strong cash flow potential with moderate appreciation",
  "confidence_score": 0.85
}

πŸ—οΈ Project Structure

VT_Hacks_25/
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ customer_agent.py        # Agent 1: Customer-facing conversational agent
β”‚   β”œβ”€β”€ analysis_engine.py       # Agent 2: Property analysis engine  
β”‚   β”œβ”€β”€ deal_finder.py          # Agent 3: Background deal monitoring service
β”‚   β”œβ”€β”€ coordinator.py          # Multi-agent coordination system
β”‚   └── __init__.py
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ data_models.py          # Pydantic models for all data structures
β”‚   └── __init__.py
β”œβ”€β”€ integrations/
β”‚   β”œβ”€β”€ attom_api.py           # ATTOM Data API integration
β”‚   └── __init__.py
β”œβ”€β”€ static/
β”‚   └── index.html             # Frontend chat interface
β”œβ”€β”€ main.py                    # FastAPI application with all endpoints
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ .env.example              # Configuration template
└── README.md                 # This file

🧠 Analysis Engine Capabilities

The Analysis Engine (Agent 2) provides comprehensive real estate investment analysis:

Property Valuation

  • ARV (After Repair Value) Calculations: AI-powered property value estimates
  • Comparable Property Analysis: Finds and analyzes similar properties
  • Market Price Evaluation: Current market value assessments

Investment Analysis

  • Deal Scoring: 0-100 scale rating system for investment opportunities
  • Cash Flow Projections: Monthly and annual cash flow estimates
  • ROI Calculations: Return on investment and cash-on-cash returns
  • Strategy Recommendations: Optimal investment approach (Buy & Hold, Flip, BRRRR, Wholesale)

Risk Assessment

  • Market Risk Analysis: Local market volatility and trends
  • Property-Specific Risks: Condition, location, and tenant factors
  • Financial Risk Evaluation: Interest rate sensitivity and financing risks
  • Regulatory Risk Assessment: Zoning and regulatory considerations

Market Intelligence

  • Local Market Trends: Price movements and inventory analysis
  • Neighborhood Dynamics: Gentrification and development patterns
  • Economic Indicators: Employment and population growth factors
  • Investment Climate: Cap rates and rental yield analysis

πŸ”§ Technical Details

Multi-Agent Architecture

  • Agent Coordinator: Manages communication between all agents
  • Message Queuing: Priority-based request handling
  • Load Balancing: Distributes workload across agents
  • Error Handling: Robust error recovery and retry mechanisms

AI Models Used

  • Gemini 1.5 Pro: Complex analysis and reasoning tasks
  • Gemini 2.5 Flash: Fast conversational responses

Data Sources

  • ATTOM Data API: Property details, market data, comparable sales
  • AI Analysis: Gemini-powered insights and recommendations
  • Mock Data: Fallback when APIs are unavailable

πŸ“ˆ Coming Soon

  • Agent 3: Deal Finder - Automated property discovery and monitoring
  • Advanced ATTOM Integration - Full property search and filtering
  • User Authentication - Personalized analysis and saved properties
  • Email Alerts - Automated deal notifications
  • Portfolio Tracking - Investment performance monitoring
  • Mobile App - iOS and Android companion apps

πŸ›‘οΈ Error Handling

The platform includes comprehensive error handling:

  • API timeouts and retries
  • Graceful degradation when services are unavailable
  • Fallback calculations when AI analysis fails
  • Detailed logging for troubleshooting

πŸ“ Logging

All components include detailed logging:

  • Request/response tracking
  • Performance metrics
  • Error diagnostics
  • Agent coordination events

Project Structure

β”œβ”€β”€ main.py              # FastAPI backend
β”œβ”€β”€ static/
β”‚   └── index.html       # Chat interface
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ .env                 # Environment variables (your API keys)
β”œβ”€β”€ .env.example         # Environment template
β”œβ”€β”€ run.ps1             # PowerShell run script
β”œβ”€β”€ run.bat             # Batch run script
└── README.md           # This file

Features

  • βœ… Clean, responsive chat interface
  • βœ… Real-time messaging with Gemini AI
  • βœ… Health check endpoint
  • βœ… Error handling and connection status
  • βœ… Typing indicators
  • βœ… Mobile-friendly design

Troubleshooting

  1. "Import google.generativeai could not be resolved"

    • Make sure you've installed dependencies: pip install -r requirements.txt
  2. "GEMINI_API_KEY not found"

    • Create a .env file with your API key
    • Make sure the key is valid and active
  3. "No response generated from Gemini"

    • Check your API key is correct
    • Verify your Google Cloud project has the Gemini API enabled
    • Check the /health endpoint for connection status

About

VT hacks 2025 project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors