Spaces:
Runtime error
Runtime error
Customer Agent - Free Tier Deployment Guide
π Quick Start (Free Tier)
Local Development
# 1. Install dependencies
python3 install_deps.py
# 2. Set environment variables
export SECRET_KEY="your-secret-key-here"
export DATABASE_URL="sqlite:///./customeragent.db"
# 3. Run the server
python3 run_tests.py
Render Deployment
Connect Repository
- Link your GitHub repo to Render
- Select "Web Service"
Environment Variables
SECRET_KEY=your-secret-key-here DATABASE_URL=postgresql://... ALLOWED_ORIGINS=https://yourdomain.comBuild Settings
- Build Command:
./render-build.sh - Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
- Build Command:
Database
- Add PostgreSQL database
- Copy connection URL to DATABASE_URL
π§ͺ Testing
Manual Testing
# Test health endpoint
curl http://localhost:8000/health
# Test API docs
open http://localhost:8000/docs
QA Test Suite
python3 test_api.py
π Features Included (Free Tier)
β Core Features:
- AI-powered chat responses
- Website content scraping
- Real-time WebSocket chat
- Industry-specific tones
- Analytics dashboard
- Security middleware
- Caching system
β Security:
- Rate limiting
- XSS protection
- SQL injection prevention
- Secure headers
- Adult content filtering
- Abusive language blocking
β Monitoring:
- Health checks
- Performance metrics
- Error tracking
- Response time monitoring
β Removed for Free Tier:
- Subscription system
- Usage limits
- Payment integration
- Premium features
π§ Configuration
Required Environment Variables
SECRET_KEY: JWT secret keyDATABASE_URL: Database connection string
Optional Environment Variables
REDIS_URL: Redis for caching (optional)OPENAI_API_KEY: For AI responsesSENTRY_DSN: Error monitoringALLOWED_ORIGINS: CORS origins
π Scaling
The free tier is designed to handle:
- 1000+ concurrent users
- 10,000+ messages per day
- Multiple websites per user
- Real-time chat sessions
π Troubleshooting
Common Issues
- Import Errors: Run
python3 install_deps.py - Database Errors: Check DATABASE_URL
- CORS Issues: Set ALLOWED_ORIGINS
- Rate Limiting: Redis optional for free tier
- Content Filtering: Test with
python3 test_content_filter.py
Logs
- Check Render logs for deployment issues
- Use
/healthendpoint for status - Use
/metricsendpoint for performance
π Production Checklist
- Set strong SECRET_KEY
- Configure DATABASE_URL
- Set ALLOWED_ORIGINS
- Enable HTTPS
- Monitor
/healthendpoint - Set up error tracking
- Test all API endpoints
- Verify WebSocket connections