Prerequisites
Before installing Sonore Phone Agent, ensure you have the following:- Python 3.12 or higher - The application requires Python 3.12+
- uv - Fast Python package installer and resolver (installation guide)
- MongoDB - Database for storing call transcripts and metadata
- OpenAI API Key - For AI-powered call handling
Installation Steps
Install dependencies
Use the This command runs
uv package manager to install all dependencies:uv sync --dev, which installs both production and development dependencies defined in pyproject.toml.Core dependencies installed:fastapi- Web framework for building APIsuvicorn- ASGI server for running the applicationpydantic- Data validation and settings managementpymongo- MongoDB driver for Pythonopenai- OpenAI Python SDKhttpx- HTTP client for async requestsphonenumbers- Phone number parsing and validation
Configure environment variables
Create a
.env file in the project root with your configuration:The application validates that
OPENAI_API_KEY, OPENAI_PROJECT_ID, and OPENAI_WS_URL are set when APP_ENV is not test. Missing required variables will cause a startup error.Running the Application
Development Mode
For local development with auto-reload:start.sh script launches both services:
- Calls service on port
8000(or$PORT) - Public-facing API for handling inbound calls - Post-call service on port
8001(or$POSTCALL_PORT) - Internal service for post-call processing
Production Mode
For production deployments, use the individual startup scripts:Service Endpoints
Once running, the services are available at:- Calls API:
http://localhost:8000 - Health check:
http://localhost:8000/health - API documentation:
http://localhost:8000/docs - Post-call API:
http://localhost:8001
Development Tools
Code Quality
The project includes several make targets for code quality:Testing
Exposing Local Development
To expose your local development server for testing with external services:Troubleshooting
Common Issues
MongoDB connection failed
MongoDB connection failed
Ensure MongoDB is running and accessible at the URI specified in
MONGODB_URI. Check that:- MongoDB service is running:
systemctl status mongodorbrew services list - The connection string is correct
- Network/firewall allows the connection
OpenAI API authentication failed
OpenAI API authentication failed
Verify that:
OPENAI_API_KEYis set and validOPENAI_PROJECT_IDis correct for your organization- Your API key has access to the specified models
Port already in use
Port already in use
If ports 8000 or 8001 are already in use, set custom ports:
Module not found errors
Module not found errors
Ensure dependencies are installed:If issues persist, try removing the virtual environment and reinstalling:
Next Steps
Docker Deployment
Deploy with Docker and Docker Compose
Monitoring
Set up logging and metrics