A smart system for detecting and reporting fraudulent phone numbers using LangChain and FastAPI.
Our system uses a multi-agent architecture powered by LangGraph:
- Supervisor Agent: Routes user messages to specialized agents
- Greeter Agent: Handles introductions and general queries
- Checker Agent: Verifies phone numbers against fraud database
- Reporter Agent: Processes fraud reports and updates database
- Install uv:
pip install uv
- Create and activate virtual environment:
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies:
uv lock
uv sync --frozen
-
Set up MySQL:
- Install MySQL Server
- Create database:
noob_busts_scams
- Configure
.env
with your database credentials
-
Run the application:
uvicorn main:app --reload
- Build and run with Docker Compose:
docker-compose up --build
- Stop containers:
docker-compose down
- Clean up volumes (if needed):
docker-compose down -v
POST /api/v1/chat
: Send messages to the fraud detection systemGET /api/v1/health
: Check system health
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=noob_busts_scams
DB_HOST=db
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=noob_busts_scams
.
βββ controller/ # API controllers
β βββ routers/ # API route definitions
β βββ service/ # Service layer
βββ src/
β βββ components/ # Agent components
β βββ core/ # Core configurations
β βββ database/ # Database connections
β βββ models/ # Data models
β βββ prompts/ # LLM prompts
β βββ services/ # Business logic
β βββ tools/ # LangChain tools
β βββ utils/ # Utilities
βββ docker/
β βββ Dockerfile # Docker configuration
βββ docker-compose.yaml # Docker services definition
βββ main.py # Application entry point
βββ pyproject.toml # Project dependencies
βββ README.md # Documentation
- Phone number fraud checking
- Fraud reporting system
- Conversation history
- Smart agent routing
- Database persistence
- Add to
pyproject.toml
:
[project]
dependencies = [
"new-package~=1.0.0",
]
- Update dependencies:
uv lock
uv sync --frozen
- Install test dependencies:
uv pip install -e ".[test]"
- Run all tests:
pytest
- Run specific test categories:
pytest tests/unit/ # Unit tests only
pytest tests/integration/ # Integration tests only
pytest tests/e2e/ # End-to-end tests only
- Generate coverage report:
pytest --cov=src --cov-report=html
-
Database Connection:
- Check if MySQL is running
- Verify credentials in
.env
or.env.docker
- For Docker: ensure port 3308 is free
-
Docker Issues:
- Port conflicts: modify ports in
docker-compose.yaml
- Clean rebuild:
docker-compose down -v && docker-compose up --build
- Port conflicts: modify ports in
- Docker logs:
docker-compose logs -f
- Application logs: Check
logs/
directory
MIT License - see LICENSE file for details