Skip to content

AspA-AI/realestate_mit_ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Real Estate AI Automation Platform

A comprehensive, multi-agent AI platform designed to significantly enhance the productivity of real estate brokers. The platform automates administrative tasks, manages leads intelligently, discovers new prospects through AI-powered search, facilitates broker collaboration, and provides AI-powered tools for both brokers and property buyers/sellers.

🎯 Overview

This platform combines multiple AI agents to create an intelligent ecosystem for real estate professionals. It centralizes lead management, automates qualification processes, learns broker communication styles, discovers prospects, and facilitates collaboration between brokers.

✨ Key Features

πŸ€– AI Broker Productivity Suite

  • AI Inbox + Lead Assistant: Centralizes and processes leads from multiple channels (WhatsApp, Email, Forms)

    • Automatic message classification (buyer, seller, investor, inquiry, spam)
    • Priority and urgency detection
    • Context-aware draft reply generation
    • Conversation history tracking
    • Multi-channel support (WhatsApp via Twilio, Email, Forms)
  • AI Lead Qualification: Automatically qualifies buyers and sellers through structured Q&A

    • Multi-turn qualification flow
    • Answer suggestions from conversation history
    • Qualification scoring (0-100)
    • Property matching based on qualification brief
    • Automatic lead status updates
  • AI Personal Digital Twin (Persona Agent): Learns broker's communication style and operates autonomously

    • Questionnaire-based persona creation (tone, formality, style, etc.)
    • Sample-based learning from communication examples
    • Hybrid approach (questionnaire + samples)
    • Persona integration across all AI agents
    • Automatic style matching in all communications
  • AI CRM Automation: Streamlines routine CRM tasks

    • Pipeline management
    • Activity tracking
    • Task automation
    • Lead status updates
  • Document Assist: Generates marketing materials and contract drafts

    • Marketing material generation
    • Social media content (posts, reels, scripts)
    • Document templates

πŸ” AI Hunt Agent - Prospect Discovery

  • Personalized Prospect Map: Learns from broker's proven strategies

    • Strategy-based prospect discovery
    • Custom search parameters
    • Location-based targeting
  • External Search: Discovers prospects across multiple channels

    • Web search for events and communities (via Tavily API)
    • Event discovery (real estate events, networking events)
    • Community discovery (local groups, associations)
    • Actionable recommendations
  • Feedback Loop: Continuously improves suggestions based on outcomes

    • Feedback collection
    • Strategy refinement

πŸ‘₯ Broker Collaboration

  • Collaboration Matchmaker: Suggests optimal collaboration opportunities

    • Activity-based matching (listings, deals, specializations)
    • Public profile visibility
    • Sharing level controls
    • Rich signal analysis
  • Private Broker Chat: Secure, GDPR-compliant communication

    • Broker-to-broker messaging
    • Click-to-message interface
    • Message history
  • Cooperation Preferences: Configurable data-sharing rules

    • Sharing level settings (public, limited, no_share)
    • Listing visibility controls
    • Profile information management

🏠 User-Facing AI

  • Property Advisor Chat: Intelligent chatbot for buyers/sellers

    • Natural language property queries
    • Lifestyle-based recommendations
    • Property comparison
  • Smart Search: Lifestyle-based property search

    • Multi-criteria filtering
    • Price range, bedrooms, bathrooms, location
    • Invalid property filtering (maintains data quality)
  • Property Comparison: Data-driven property analysis

    • Side-by-side comparisons
    • Feature analysis

πŸ“‹ Listing Intelligence

  • AI Listing Enhancer: Optimizes listing content

    • Listing description generation
    • SEO optimization
    • Feature highlighting
  • Pricing Intelligence: Data-backed pricing recommendations

    • Market analysis
    • Comparative pricing
  • Agency Dashboard: Performance insights and analytics

    • Broker activity tracking
    • Lead statistics
    • Performance metrics

πŸ“± Advertising Automation

  • Marketing Material Generator: Creates multi-platform marketing assets

    • Social media posts
    • Reel scripts
    • Multi-format content
  • Social Media Content: Generates posts, reels, and scripts

    • Platform-specific formatting
    • Hashtag suggestions
    • Engagement optimization

πŸ—οΈ Architecture

Tech Stack

Backend:

  • Framework: FastAPI (Python 3.13+)
  • Database: PostgreSQL (via Supabase)
  • ORM: SQLAlchemy 2.0
  • AI/ML: LangChain, OpenAI (GPT-4 Turbo)
  • Caching: Redis
  • Task Queue: Celery
  • API Integration: Twilio (WhatsApp), Tavily (Web Search)

Frontend:

  • Framework: React 18 + TypeScript
  • Build Tool: Vite
  • Styling: Tailwind CSS
  • State Management: React Query (TanStack Query)
  • Routing: React Router
  • UI Components: Radix UI, Lucide Icons

Project Structure

real_estate/
β”œβ”€β”€ api/                          # Backend FastAPI application
β”‚   β”œβ”€β”€ agents/                   # AI agents
β”‚   β”‚   β”œβ”€β”€ inbox_agent.py        # Message classification & draft generation
β”‚   β”‚   β”œβ”€β”€ qualification_agent.py # Lead qualification
β”‚   β”‚   β”œβ”€β”€ persona_agent.py     # Digital twin / persona learning
β”‚   β”‚   β”œβ”€β”€ hunt_agent.py         # Prospect discovery
β”‚   β”‚   β”œβ”€β”€ marketing_agent.py   # Marketing content generation
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ models/                   # SQLAlchemy database models
β”‚   β”œβ”€β”€ routes/                   # API endpoints
β”‚   β”œβ”€β”€ services/                 # Business logic services
β”‚   β”œβ”€β”€ schemas/                  # Pydantic schemas
β”‚   β”œβ”€β”€ config/                   # Configuration
β”‚   └── app.py                    # FastAPI application entry point
β”‚
β”œβ”€β”€ client/                       # Frontend React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/               # Page components
β”‚   β”‚   β”œβ”€β”€ components/          # Reusable components
β”‚   β”‚   β”œβ”€β”€ lib/                 # Utilities & API client
β”‚   β”‚   └── hooks/               # Custom React hooks
β”‚   └── package.json
β”‚
└── specs/                        # Documentation & specifications

πŸš€ Getting Started

Prerequisites

  • Python 3.13+
  • Node.js 18+
  • PostgreSQL database (or Supabase)
  • Redis (optional, for caching)
  • OpenAI API key
  • Twilio account (for WhatsApp integration, optional)
  • Tavily API key (for prospect hunt web search, optional)

Installation

Backend Setup

cd api

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Create .env file (copy from .env.example if available)
cp .env.example .env
# Edit .env with your configuration

# Run database migrations (if using Alembic)
alembic upgrade head

# Start development server
make dev
# Or manually:
uvicorn app:app --host 0.0.0.0 --port 8000 --reload

Frontend Setup

cd client

# Install dependencies
npm install

# Create .env file
cp .env.example .env
# Edit .env with your API URL

# Start development server
npm run dev

Environment Variables

Create a .env file in the api/ directory with the following variables:

# Database
SUPABASE_DB_URL=postgresql://user:password@host:port/database

# OpenAI
OPENAI_API_KEY=your_openai_api_key

# Twilio (WhatsApp)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token

# Tavily (Web Search)
TAVILY_API_KEY=your_tavily_api_key

# JWT (optional, has defaults)
SECRET_KEY=your_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

# CORS
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173

# Redis (optional)
REDIS_URL=redis://localhost:6379/0

πŸ“– Usage

For Brokers

  1. Setup Persona (Digital Twin)

    • Navigate to Persona page
    • Fill out questionnaire (tone, formality, style, etc.)
    • Optionally provide communication samples
    • Create/update your persona
  2. Connect WhatsApp

    • Go to Inbox page
    • Enter your Twilio WhatsApp number
    • Connect to enable WhatsApp message processing
  3. Process Incoming Messages

    • Messages are automatically classified and processed
    • Review AI-generated draft replies
    • Edit and send replies directly from the inbox
  4. Qualify Leads

    • Start a qualification session for a lead
    • Answer questions (or use AI-suggested answers)
    • Review qualification score and brief
    • Get property suggestions based on qualification
  5. Discover Prospects

    • Use Hunt Agent to discover new prospects
    • Provide your search strategies
    • Review AI-suggested events, communities, and opportunities
  6. Collaborate with Other Brokers

    • View collaboration suggestions
    • Click on a broker's name to send a message
    • Configure your sharing preferences

API Endpoints

The API is documented at http://localhost:8000/docs when running the backend.

Key endpoints:

  • /api/v1/inbox/* - Inbox and message management
  • /api/v1/leads/* - Lead management
  • /api/v1/qualification/* - Lead qualification
  • /api/v1/persona/* - Persona (Digital Twin) management
  • /api/v1/hunt/* - Prospect discovery
  • /api/v1/collaboration/* - Broker collaboration
  • /api/v1/properties/* - Property management
  • /api/v1/marketing/* - Marketing content generation

πŸ”§ Development

Running Tests

cd api
pytest

Code Formatting

cd api
black .
flake8 .

Database Migrations

cd api
alembic revision --autogenerate -m "description"
alembic upgrade head

πŸ“ Key Concepts

Conversation Context

The platform maintains conversation history for each client:

  • Last 10 messages are tracked
  • Conversation threads are identified by gaps > 24 hours
  • Context is used by all AI agents for better understanding
  • Prevents mixing old conversations with new ones

Lead Management

  • New Opportunities: When a client contacts about a new property/need, a new lead is created (even if previous lead was closed)
  • Lead Status: Tracks pipeline stages (NEW β†’ CONTACTED β†’ QUALIFIED β†’ NEGOTIATION β†’ WON/LOST)
  • Automatic Linking: Messages from the same client are automatically linked to their lead

Persona Integration

  • Persona characteristics are injected into all AI agent prompts
  • Ensures consistent communication style across:
    • Inbox draft replies
    • Marketing content
    • Qualification suggestions
    • All broker-facing communications

Property Suggestions

  • Properties are matched based on qualification brief
  • Bedroom requirements inferred from conversation (e.g., "5 kids" β†’ 5+ bedrooms)
  • Best available matches are shown even if not perfect
  • Informative messages explain match quality
  • Studios (0 bedrooms) are included unless client needs bedrooms

πŸ› Troubleshooting

Common Issues

  1. Database Connection Errors

    • Verify SUPABASE_DB_URL in .env
    • Check database is accessible
    • Ensure migrations have run
  2. OpenAI API Errors

    • Verify OPENAI_API_KEY is set
    • Check API key is valid and has credits
    • Review rate limits
  3. WhatsApp Not Receiving Messages

    • Verify Twilio credentials
    • Check webhook URL is configured in Twilio
    • Ensure broker has connected WhatsApp number
    • Check backend logs for webhook errors
  4. No Properties Found

    • Check property data exists in database
    • Verify search criteria aren't too restrictive
    • Review qualification brief extraction

πŸ“š Documentation

🀝 Contributing

  1. Create a feature branch
  2. Make your changes
  3. Ensure tests pass
  4. Submit a pull request

πŸ“„ License

[Add your license here]

πŸ™ Acknowledgments

Built with:

  • FastAPI
  • LangChain
  • OpenAI
  • React
  • Tailwind CSS
  • And many other open-source libraries

About

A comprehensive, multi-agent AI platform designed to significantly enhance the productivity of real estate brokers. The platform automates administrative tasks, manages leads intelligently, discovers new prospects through AI-powered search, facilitates broker collaboration, and provides AI-powered tools for both brokers and property buyers/sellers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors