A comprehensive, enterprise-grade AI phone assistant platform that transforms customer interactions through intelligent voice automation.
π Quick Start β’ π Documentation β’ π οΈ Features β’ ποΈ Architecture β’ π§ Configuration
The Phone AI Assistant is a cutting-edge, production-ready platform that revolutionizes phone-based customer interactions. Built with modern technologies and AI-first principles, it provides businesses with 24/7 intelligent phone support capabilities through natural language conversations.
The Phone AI Assistant follows a modern, microservices-oriented architecture designed for scalability, maintainability, and production deployment.
phone_ai_assistant/
βββ π app/ # Backend API server
β βββ π __init__.py
β βββ π main.py # FastAPI application entry point
β βββ π config.py # Environment configuration management
β βββ π telephony/
β β βββ π twilio_stream.py # Twilio WebSocket & Media Streams
β βββ π speech/
β β βββ π asr.py # Multi-engine speech recognition
β β βββ π tts.py # Multi-engine text-to-speech
β βββ π agents/
β βββ π dialogue.py # LangChain conversation agent
β βββ π tasks.py # CrewAI multi-agent orchestration
βββ π frontend/ # React dashboard application
β βββ π src/
β β βββ π components/ # Reusable UI components
β β βββ π pages/ # Main application pages
β β βββ π hooks/ # Custom React hooks
β β βββ π types/ # TypeScript definitions
β β βββ π utils/ # Utility functions and API client
β βββ π package.json # Frontend dependencies
β βββ π vite.config.ts # Vite build configuration
β βββ π tailwind.config.js # Tailwind CSS configuration
βββ π tests/ # Comprehensive test suite
βββ π requirements.txt # Production Python dependencies
βββ π requirements-dev.txt # Development Python dependencies
βββ π .env.example # Environment variables template
βββ π Makefile # Build automation and task management
βββ π architectural_document.md # Detailed system architecture
βββ π product_requirements_document.md # Product specifications
βββ π README.md # This comprehensive guide
graph LR
A[π Incoming Call] --> B[π Twilio]
B --> C[β‘ FastAPI Backend]
C --> D[π€ Speech Recognition]
D --> E[π€ AI Agent]
E --> F[π£οΈ Text-to-Speech]
F --> C
C --> B
B --> A
C --> G[π React Dashboard]
C --> H[πΎ Supabase Database]
Before getting started, ensure you have:
Get up and running in minutes:
# Clone the repository
git clone <repository-url>
cd phone_ai_assistant
# Automated setup and start
./start.sh # Linux/macOS
# OR
start.bat # Windows
For more control over the setup process:
Backend Setup:
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env with your API keys
Frontend Setup:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
Start Backend:
# From project root
uvicorn app.main:app --reload --port 8001
Copy .env.example to .env and configure the following settings. All API keys and sensitive information should be kept secure and never committed to version control.
# Server Configuration
HOST=0.0.0.0
PORT=8001
DEBUG=true
LOG_LEVEL=INFO
# Twilio Account Settings
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890
TWILIO_WEBHOOK_URL=https://your-domain.com
# OpenAI Configuration
OPENAI_API_KEY=your_openai_key
# Azure Speech Services
AZURE_SPEECH_KEY=your_azure_key
AZURE_SPEECH_REGION=eastus
# ElevenLabs (Optional)
ELEVENLABS_API_KEY=your_elevenlabs_key
ELEVENLABS_VOICE_ID=your_voice_id
# Supabase Database
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key
The project uses a comprehensive Makefile for automation. Here are the available commands:
make setup - Install production dependencies and create virtual environmentmake setup-dev - Install development dependencies including testing toolsmake frontend-setup - Install frontend dependencies via npmmake install-deps - Display system dependency requirementsmake run - Start production server (port 8001)make run-dev - Start development server with auto-reloadmake frontend-dev - Start frontend development server (port 3000)make start-full-dev - Start both backend and frontend concurrentlymake start - Complete setup and production startmake test - Run comprehensive test suite with coverage reportingmake lint - Execute code linting (flake8) and type checking (mypy)make format - Format code using Black code formattermake env-check - Validate environment configurationmake clean - Remove cache files, virtual environment, and build artifactsmake full-build - Build frontend for production deploymentmake help - Display all available commands with descriptionsGET /api/health - Basic health checkGET /api/status - Comprehensive system status with service connectivityGET /api/calls - Retrieve call history with pagination supportGET /api/calls/metrics - Get aggregate call metrics and KPIsGET /api/calls/{id} - Fetch detailed call informationGET /api/agents - List all configured AI agentsPUT /api/agents/{id} - Update agent configuration and settingsGET /api/agents/{id}/performance - Get agent performance metricsGET /api/analytics - Retrieve analytics data with customizable time rangesGET /api/analytics/sentiment - Get sentiment analysis trendsGET /api/analytics/performance - System performance metricsWS /media-stream - Real-time audio streaming for Twilio Media StreamsPOST /voice - Handle incoming voice calls (returns TwiML)POST /status - Receive call status updates and eventsThe system supports multiple ASR backends with intelligent fallback:
Multiple TTS engines provide flexibility for different use cases:
The primary conversational AI powered by LangChain framework:
# Agent configuration example
agent_config = {
"model": "gpt-4",
"temperature": 0.7,
"max_tokens": 1000,
"system_prompt": "You are a helpful customer service assistant...",
"tools": ["weather", "calculator", "knowledge_base"]
}
Specialized agents for different conversation scenarios:
Run the comprehensive test suite with coverage reporting:
make test
The test suite includes:
tests/test_config.py - Configuration and environment testingtests/test_telephony.py - Twilio integration and WebSocket teststests/test_speech.py - ASR and TTS engine testingtests/test_agents.py - AI agent functionality teststests/test_api.py - REST API endpoint testsTest coverage reports are automatically generated in htmlcov/index.html and provide detailed insights into code coverage across all modules.
Start the development environment with hot reloading:
make start-dev
This command will:
For enterprise-grade deployment, see our comprehensive Production Deployment Guide.
Production Environment Configuration
cp .env.example .env.production
# Edit .env.production with production settings
Deploy with Docker Compose
docker-compose --env-file .env.production up -d
Verify Deployment
curl https://yourdomain.com/api/health
For detailed production setup, security configuration, and troubleshooting, refer to DEPLOYMENT.md.
# Clean environment and reinstall
make clean
make setup
# Validate configuration
make env-check
# Check specific variables
python -c "from app.config import get_settings; print(get_settings())"
Logs are output to the console by default. For production deployments:
# Structured logging to file
uvicorn app.main:app --log-config logging.yaml
# JSON formatted logs for log aggregation
export LOG_FORMAT=json
Monitor system health using built-in endpoints:
GET /api/healthGET /api/statusGET /api/metrics (if implemented)Key metrics to monitor:
We welcome contributions to the Phone AI Assistant project! Here's how to get started:
Fork the Repository
git fork <repository-url>
git clone <your-fork-url>
cd phone_ai_assistant
Create Feature Branch
git checkout -b feature/your-feature-name
Make Changes with Tests
# Make your changes
# Add comprehensive tests
make test
Quality Checks
make lint # Code linting
make format # Code formatting
make test # Run tests
Submit Pull Request
When reporting bugs, please include:
For new features, please:
This project is licensed under the MIT License - see the LICENSE file for complete details.
For enterprise deployments and professional support:
β Star this repository if you find it helpful!
Built with β€οΈ by the Phone AI Assistant Team
A comprehensive, enterprise-grade AI phone assistant platform that transforms customer interactions through intelligent voice automation.
π Quick Start β’ π Documentation β’ π οΈ Features β’ ποΈ Architecture β’ π§ Configuration
The Phone AI Assistant is a cutting-edge, production-ready platform that revolutionizes phone-based customer interactions. Built with modern technologies and AI-first principles, it provides businesses with 24/7 intelligent phone support capabilities through natural language conversations.
The Phone AI Assistant follows a modern, microservices-oriented architecture designed for scalability, maintainability, and production deployment.
phone_ai_assistant/
βββ π app/ # Backend API server
β βββ π __init__.py
β βββ π main.py # FastAPI application entry point
β βββ π config.py # Environment configuration management
β βββ π telephony/
β β βββ π twilio_stream.py # Twilio WebSocket & Media Streams
β βββ π speech/
β β βββ π asr.py # Multi-engine speech recognition
β β βββ π tts.py # Multi-engine text-to-speech
β βββ π agents/
β βββ π dialogue.py # LangChain conversation agent
β βββ π tasks.py # CrewAI multi-agent orchestration
βββ π frontend/ # React dashboard application
β βββ π src/
β β βββ π components/ # Reusable UI components
β β βββ π pages/ # Main application pages
β β βββ π hooks/ # Custom React hooks
β β βββ π types/ # TypeScript definitions
β β βββ π utils/ # Utility functions and API client
β βββ π package.json # Frontend dependencies
β βββ π vite.config.ts # Vite build configuration
β βββ π tailwind.config.js # Tailwind CSS configuration
βββ π tests/ # Comprehensive test suite
βββ π requirements.txt # Production Python dependencies
βββ π requirements-dev.txt # Development Python dependencies
βββ π .env.example # Environment variables template
βββ π Makefile # Build automation and task management
βββ π architectural_document.md # Detailed system architecture
βββ π product_requirements_document.md # Product specifications
βββ π README.md # This comprehensive guide
graph LR
A[π Incoming Call] --> B[π Twilio]
B --> C[β‘ FastAPI Backend]
C --> D[π€ Speech Recognition]
D --> E[π€ AI Agent]
E --> F[π£οΈ Text-to-Speech]
F --> C
C --> B
B --> A
C --> G[π React Dashboard]
C --> H[πΎ Supabase Database]
Before getting started, ensure you have:
Get up and running in minutes:
# Clone the repository
git clone <repository-url>
cd phone_ai_assistant
# Automated setup and start
./start.sh # Linux/macOS
# OR
start.bat # Windows
For more control over the setup process:
Backend Setup:
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env with your API keys
Frontend Setup:
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
Start Backend:
# From project root
uvicorn app.main:app --reload --port 8001
Copy .env.example to .env and configure the following settings. All API keys and sensitive information should be kept secure and never committed to version control.
# Server Configuration
HOST=0.0.0.0
PORT=8001
DEBUG=true
LOG_LEVEL=INFO
# Twilio Account Settings
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_PHONE_NUMBER=+1234567890
TWILIO_WEBHOOK_URL=https://your-domain.com
# OpenAI Configuration
OPENAI_API_KEY=your_openai_key
# Azure Speech Services
AZURE_SPEECH_KEY=your_azure_key
AZURE_SPEECH_REGION=eastus
# ElevenLabs (Optional)
ELEVENLABS_API_KEY=your_elevenlabs_key
ELEVENLABS_VOICE_ID=your_voice_id
# Supabase Database
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key
The project uses a comprehensive Makefile for automation. Here are the available commands:
make setup - Install production dependencies and create virtual environmentmake setup-dev - Install development dependencies including testing toolsmake frontend-setup - Install frontend dependencies via npmmake install-deps - Display system dependency requirementsmake run - Start production server (port 8001)make run-dev - Start development server with auto-reloadmake frontend-dev - Start frontend development server (port 3000)make start-full-dev - Start both backend and frontend concurrentlymake start - Complete setup and production startmake test - Run comprehensive test suite with coverage reportingmake lint - Execute code linting (flake8) and type checking (mypy)make format - Format code using Black code formattermake env-check - Validate environment configurationmake clean - Remove cache files, virtual environment, and build artifactsmake full-build - Build frontend for production deploymentmake help - Display all available commands with descriptionsGET /api/health - Basic health checkGET /api/status - Comprehensive system status with service connectivityGET /api/calls - Retrieve call history with pagination supportGET /api/calls/metrics - Get aggregate call metrics and KPIsGET /api/calls/{id} - Fetch detailed call informationGET /api/agents - List all configured AI agentsPUT /api/agents/{id} - Update agent configuration and settingsGET /api/agents/{id}/performance - Get agent performance metricsGET /api/analytics - Retrieve analytics data with customizable time rangesGET /api/analytics/sentiment - Get sentiment analysis trendsGET /api/analytics/performance - System performance metricsWS /media-stream - Real-time audio streaming for Twilio Media StreamsPOST /voice - Handle incoming voice calls (returns TwiML)POST /status - Receive call status updates and eventsThe system supports multiple ASR backends with intelligent fallback:
Multiple TTS engines provide flexibility for different use cases:
The primary conversational AI powered by LangChain framework:
# Agent configuration example
agent_config = {
"model": "gpt-4",
"temperature": 0.7,
"max_tokens": 1000,
"system_prompt": "You are a helpful customer service assistant...",
"tools": ["weather", "calculator", "knowledge_base"]
}
Specialized agents for different conversation scenarios:
Run the comprehensive test suite with coverage reporting:
make test
The test suite includes:
tests/test_config.py - Configuration and environment testingtests/test_telephony.py - Twilio integration and WebSocket teststests/test_speech.py - ASR and TTS engine testingtests/test_agents.py - AI agent functionality teststests/test_api.py - REST API endpoint testsTest coverage reports are automatically generated in htmlcov/index.html and provide detailed insights into code coverage across all modules.
Start the development environment with hot reloading:
make start-dev
This command will:
For enterprise-grade deployment, see our comprehensive Production Deployment Guide.
Production Environment Configuration
cp .env.example .env.production
# Edit .env.production with production settings
Deploy with Docker Compose
docker-compose --env-file .env.production up -d
Verify Deployment
curl https://yourdomain.com/api/health
For detailed production setup, security configuration, and troubleshooting, refer to DEPLOYMENT.md.
# Clean environment and reinstall
make clean
make setup
# Validate configuration
make env-check
# Check specific variables
python -c "from app.config import get_settings; print(get_settings())"
Logs are output to the console by default. For production deployments:
# Structured logging to file
uvicorn app.main:app --log-config logging.yaml
# JSON formatted logs for log aggregation
export LOG_FORMAT=json
Monitor system health using built-in endpoints:
GET /api/healthGET /api/statusGET /api/metrics (if implemented)Key metrics to monitor:
We welcome contributions to the Phone AI Assistant project! Here's how to get started:
Fork the Repository
git fork <repository-url>
git clone <your-fork-url>
cd phone_ai_assistant
Create Feature Branch
git checkout -b feature/your-feature-name
Make Changes with Tests
# Make your changes
# Add comprehensive tests
make test
Quality Checks
make lint # Code linting
make format # Code formatting
make test # Run tests
Submit Pull Request
When reporting bugs, please include:
For new features, please:
This project is licensed under the MIT License - see the LICENSE file for complete details.
For enterprise deployments and professional support:
β Star this repository if you find it helpful!
Built with β€οΈ by the Phone AI Assistant Team