Skip to content

A smart system for detecting and reporting fraudulent phone numbers using LangChain and FastAPI.

License

Notifications You must be signed in to change notification settings

SuyodhanJ6/langGraph-agent-noob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0f77f03 Β· Feb 9, 2025

History

9 Commits
Feb 8, 2025
Feb 9, 2025
Feb 2, 2025
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Feb 8, 2025
Feb 8, 2025
Feb 8, 2025
Feb 9, 2025
Feb 2, 2025
Feb 9, 2025
Feb 2, 2025
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Feb 9, 2025
Feb 8, 2025
Feb 9, 2025

Repository files navigation

Phone Fraud Detection System

A smart system for detecting and reporting fraudulent phone numbers using LangChain and FastAPI.

πŸ€– Agent Architecture

Fraud Detection Agent Architecture

πŸ“Š System Architecture

Phone Fraud Detection System Architecture

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

πŸš€ Quick Start

πŸ”§ Local Development Setup

  1. Install uv:
pip install uv
  1. Create and activate virtual environment:
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
uv lock
uv sync --frozen
  1. Set up MySQL:

    • Install MySQL Server
    • Create database: noob_busts_scams
    • Configure .env with your database credentials
  2. Run the application:

uvicorn main:app --reload

🐳 Docker Setup

  1. Build and run with Docker Compose:
docker-compose up --build
  1. Stop containers:
docker-compose down
  1. Clean up volumes (if needed):
docker-compose down -v

🌐 API Endpoints

  • POST /api/v1/chat: Send messages to the fraud detection system
  • GET /api/v1/health: Check system health

πŸ› οΈ Configuration

Local Environment (.env)

DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=noob_busts_scams

Docker Environment (.env.docker)

DB_HOST=db
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=noob_busts_scams

πŸ“ Project Structure

.
β”œβ”€β”€ 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

πŸ” Features

  • Phone number fraud checking
  • Fraud reporting system
  • Conversation history
  • Smart agent routing
  • Database persistence

πŸš€ Development

Adding New Dependencies

  1. Add to pyproject.toml:
[project]
dependencies = [
    "new-package~=1.0.0",
]
  1. Update dependencies:
uv lock
uv sync --frozen

Running Tests

  1. Install test dependencies:
uv pip install -e ".[test]"
  1. Run all tests:
pytest
  1. Run specific test categories:
pytest tests/unit/  # Unit tests only
pytest tests/integration/  # Integration tests only
pytest tests/e2e/  # End-to-end tests only
  1. Generate coverage report:
pytest --cov=src --cov-report=html

πŸ› Troubleshooting

Common Issues

  1. Database Connection:

    • Check if MySQL is running
    • Verify credentials in .env or .env.docker
    • For Docker: ensure port 3308 is free
  2. Docker Issues:

    • Port conflicts: modify ports in docker-compose.yaml
    • Clean rebuild: docker-compose down -v && docker-compose up --build

Logs

  • Docker logs: docker-compose logs -f
  • Application logs: Check logs/ directory

πŸ“ License

MIT License - see LICENSE file for details

About

A smart system for detecting and reporting fraudulent phone numbers using LangChain and FastAPI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published