A complete FastAPI backend that integrates:
- ✅ Apify scraper for lead generation
- ✅ CrewAI 4-agent workflow for lead processing
- ✅ RESTful API endpoints
- ✅ Lead storage and retrieval
- ✅ Statistics and monitoring
api/main.py- Main FastAPI application with all endpointsapi/run_server.py- Server startup scriptapi/__init__.py- Package init filetest_api.py- API test suiteAPI_DOCUMENTATION.md- Complete API documentation
cd /Users/oabolade/agents_app_build/lead_sniper_ai
source venv/bin/activate
python api/run_server.pyServer will be available at: http://localhost:8000
Once running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
# In another terminal
python test_api.py| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/api/scrape |
POST | Scrape leads only |
/api/process |
POST | Process single lead |
/api/scrape-and-process |
POST | Complete pipeline |
/api/leads |
GET | Get all leads |
/api/leads/{id} |
GET | Get specific lead |
/api/leads/{id} |
DELETE | Delete lead |
/api/stats |
GET | Get statistics |
The main endpoint is /api/scrape-and-process which:
- Scrapes leads from Reddit and LinkedIn
- Processes top leads through 4-agent crew:
- Intent Data Analyst (Signal Scout)
- Business Intelligence Analyst (Researcher)
- Strategic Growth Copywriter (Pitch Architect)
- Quality Assurance & MCP Bridge (Auditor)
- Returns processed leads with buyability scores
curl -X POST http://localhost:8000/api/scrape-and-process \
-H "Content-Type: application/json" \
-d '{
"keywords": ["hiring", "looking for"],
"max_per_source": 5,
"process_limit": 2
}'FastAPI Backend: ✅ Complete and Ready
All endpoints are functional and ready to use!