Vanessa AI Agent is an intelligent real estate acquisition platform that automates the process of identifying and qualifying potential property sellers through AI-powered voice calls. The system combines automated calling, machine learning lead scoring, and comprehensive analytics to optimize real estate acquisition efforts.
- Automated outbound calling with Twilio integration
- Interactive voice response system with TwiML
- Intelligent call flow management
- Real-time call status tracking
- Lead Scoring Algorithm (0-100 scale) based on:
- Seller intent confirmation (40 points max)
- Price range preferences (15-30 points)
- Timing urgency (10-25 points)
- Call engagement metrics (10-20 points)
- Property condition (10-15 points)
- Optimal calling time (5-10 points)
- Conversion Probability Prediction with 15% base rate
- Optimal Calling Time Analysis using historical data
- Market Insights and trend analysis
- Real-time analytics and statistics
- Interactive charts and visualizations
- ML-powered insights and recommendations
- Auto-refresh every 30 seconds
- Professional UI/UX with Tailwind CSS
- Comprehensive lead tracking and management
- Status updates and progress tracking
- Lead analytics and distribution charts
- Real-time lead statistics
- FastAPI (0.104.1) - Modern Python web framework
- SQLAlchemy (2.0.23) - Database ORM
- SQLite - Database (development)
- Pydantic (2.5.0) - Data validation
- Uvicorn (0.24.0) - ASGI server
- Twilio (8.10.0) - Voice calling platform
- TwiML - Call flow control
- HTML5/CSS3 - Structure and styling
- Tailwind CSS - Utility-first CSS framework
- Alpine.js - Reactive JavaScript framework
- Chart.js - Data visualization
- Font Awesome - Icon library
- Pandas (2.1.3) - Data analysis
- NumPy (1.25.2) - Numerical computing
- Custom ML Service - Lead scoring algorithms
- Pytest (7.4.3) - Testing framework
- HTTPX (0.25.2) - HTTP client for testing
- Python-dotenv (1.0.0) - Environment variables
vanessa-ai-agent/
├── app/ # Main application package
│ ├── main.py # FastAPI application entry point
│ ├── api/ # API endpoints
│ │ ├── calls.py # Call management API
│ │ ├── leads.py # Lead management API
│ │ └── twilio_webhooks.py # Twilio webhook handlers
│ ├── models/ # Data models
│ │ ├── database.py # SQLAlchemy models
│ │ └── schemas.py # Pydantic schemas
│ └── services/ # Business logic services
│ ├── twilio_service.py # Twilio integration
│ ├── voice_ai.py # AI voice service (Vapi.ai integration)
│ └── ml_service.py # Machine learning service
├── templates/ # HTML templates
│ ├── dashboard.html # Main analytics dashboard
│ └── leads.html # Leads management page
├── tests/ # Test suite
├── requirements.txt # Python dependencies
├── run.py # Application runner
└── vanessa.db # SQLite database
- Python 3.10 or higher
- Twilio account with phone number
- ngrok account (for webhook development)
- Optional: Vapi.ai account (for advanced AI voice features)
# Clone the repository
git clone https://github.com/Candice0313/vanessa-ai-agent
cd vanessa-ai-agent
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your Twilio credentials-
Twilio Setup:
- Get Account SID and Auth Token from Twilio Console
- Purchase a phone number
- Update
.envfile with credentials
-
ngrok Setup (for webhooks):
- Sign up at https://ngrok.com
- Install authtoken:
ngrok authtoken <your-token> - Start tunnel:
ngrok http 8000 - Update
BASE_URLin.envwith ngrok URL
-
Vapi.ai Setup (optional, for advanced AI features):
- Sign up at https://vapi.ai
- Create an assistant and get API credentials
- Update Vapi configuration in
.envfile
# Development mode
python run.py
# Or using uvicorn directly
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- Analytics Dashboard: http://localhost:8000/
- Leads Management: http://localhost:8000/leads
- API Documentation: http://localhost:8000/docs
- Seller Intent: 40 points (confirmed) / 0 points (denied) / 10 points (unknown)
- Price Range: 15-30 points based on property value
- Timing: 10-25 points (3 months = highest urgency)
- Call Duration: 10-20 points (longer calls = more engagement)
- Property Condition: 10-15 points
- Optimal Timing: 5-10 points for calls during best hours
- Base Rate: 15%
- Adjustments: Lead score multiplier × timing urgency multiplier
- Range: 1% - 95%
- High Priority: >70 points
- Medium Priority: 40-70 points
- Low Priority: <40 points
GET /api/calls/- List callsPOST /api/calls/- Create callGET /api/calls/stats/summary- Call statisticsGET /api/calls/analytics/advanced- Advanced analytics
GET /api/leads/- List leadsPUT /api/leads/{id}- Update leadGET /api/leads/stats/summary- Lead statistics
GET /api/calls/ml/lead-score/{id}- Get lead scoreGET /api/calls/ml/optimal-timing- Optimal timesGET /api/calls/ml/market-insights- Market insights
POST /api/twilio/voice- Call initiationPOST /api/twilio/response- User responsesPOST /api/twilio/status- Call status updatesPOST /api/twilio/vapi-webhook- Vapi.ai webhook (optional)
- Automated lead generation
- Qualification of potential sellers
- Market analysis and insights
- Performance tracking and optimization
- Systematic property acquisition
- Lead scoring and prioritization
- Market trend analysis
- ROI optimization
- Automated outbound calling
- Lead qualification workflows
- Performance analytics
- Agent productivity tools
# Run all tests
pytest
# Run with coverage
pytest --cov=app
# Run specific test file
pytest tests/test_api.py- Unit Tests: Individual function testing
- Integration Tests: API endpoint testing
- End-to-End Tests: Complete workflow testing
Create a .env file with the following variables:
# Database
DATABASE_URL=sqlite:///./vanessa.db
# Twilio Configuration (get these from Twilio Console)
TWILIO_ACCOUNT_SID=your_twilio_account_sid_here
TWILIO_AUTH_TOKEN=your_twilio_auth_token_here
TWILIO_PHONE_NUMBER=+1234567890
TWILIO_STUDIO_FLOW_SID=your_studio_flow_sid_here
# Optional: Vapi.ai Configuration (for advanced AI voice features)
VAPI_API_KEY=your_vapi_api_key_here
VAPI_ASSISTANT_ID=your_vapi_assistant_id_here
VAPI_PHONE_NUMBER_ID=your_vapi_phone_number_id_here
# Application
BASE_URL=https://yourdomain.com
DEBUG=False
LOG_LEVEL=INFO- Environment variable protection
- Input validation with Pydantic
- SQL injection prevention with SQLAlchemy
- Secure webhook handling
- Rate limiting (production ready)
app/main.py: FastAPI application entry point and configurationrun.py: Application runner scriptrequirements.txt: Python package dependencies
app/api/calls.py: Call management API endpointsapp/api/leads.py: Lead management API endpointsapp/api/twilio_webhooks.py: Twilio webhook handlers
app/models/database.py: SQLAlchemy database modelsapp/models/schemas.py: Pydantic schemas for validation
app/services/twilio_service.py: Twilio API integrationapp/services/ml_service.py: Machine learning and analyticsapp/services/voice_ai.py: AI voice service integration (Vapi.ai - optional)
templates/dashboard.html: Main analytics dashboardtemplates/leads.html: Leads management interface
- Modern Architecture: FastAPI + SQLAlchemy + ML
- Real-time Processing: Live updates and analytics
- Scalable Design: Ready for enterprise deployment
- Comprehensive Testing: High code quality and reliability
- Immediate ROI: Quick implementation and results
- Cost Effective: Reduces manual calling costs
- Data Driven: ML-powered insights and optimization
- User Friendly: Intuitive dashboard and management
- AI Integration: Advanced lead scoring algorithms
- Real-time Analytics: Live performance monitoring
- Automated Workflows: End-to-end process automation
- Market Intelligence: Predictive analytics and insights