scam / Docs /Apiendpointand submit.md
Gankit12's picture
Upload 129 files
31f0e50 verified

ScamShield AI: Agentic Honeypot System for India AI Impact Buildathon 2026 (Challenge 2 Submission Prototype)

Author/Team Lead: Shivam Bhuva (@shivambhuva8866)
Date: January 26, 2026
Version: 1.0 (Prototype for Feb 5 Submission)
Hackathon Context: Selected Challenge 2 - Agentic Honey-Pot for Scam Detection & Intelligence Extraction. This document adapts the original ScamShield AI vision to focus exclusively on the honeypot core, incorporating advanced tech stack for detection, agentic engagement, extraction, and API-based testing. Full implementation-ready details included—no omissions.

Executive Summary

ScamShield AI's honeypot prototype addresses India's fraud crisis (500,000+ scam calls daily, ₹60+ crore daily losses, 3+ spam calls per citizen) by providing an agentic AI system that detects scams, enables user hand-off, engages scammers with a believable persona, and extracts intelligence (UPI IDs, bank details, phishing links). Built for Challenge 2, it exceeds requirements with multilingual support (English, Hindi, Gujarati), responsible AI, and API endpoints for evaluation.
Key Features:

  • Scam detection via hybrid ML (95% target F1).
  • Agentic engagement using ReAct loop with LLM personas.
  • Intelligence extraction with NER and regex (95% recall).
  • Structured JSON outputs for testing.
  • Tech Stack: Python, Hugging Face Transformers, LangGraph, FastAPI.

Differentiators: Adaptive Indic personas, safe stalling, edge scalability. AI usage: 90% (detection, engagement, extraction). Non-AI: 10% (API wrappers). This positions us for top 10 with deep India-specific innovation.

Problem Statement

India's scam epidemic:

  • 500,000+ scam calls daily (TRAI 2025 data; potentially tens of millions including spam).
  • ₹60+ crore daily losses (Ministry of Home Affairs estimates; ₹70 billion in first 5 months of 2025).
  • Predominant scams: UPI fraud, fake loans, police/bank impersonation, voice cloning/deepfakes (83% victims suffer losses, thousands of digital arrest cases since 2024).
  • Challenges: Multilingual (Hindi, Gujarati, code-switching), emotional manipulation, repeat offenders, vulnerable groups (elderly, rural).
  • 2025-2026 trends: AI voice fraud surge (cloned voices from social media for "emergency" scams, e.g., fake kidnappings; 47% Indians affected or know victims).

Challenge 2 Focus: Build an autonomous honeypot that detects scams, engages via persona, extracts intel. We leverage "Solve Problem of Your Choice" for proactive counteraction, aligning with national-scale defense.

Solution Overview

Agentic Honeypot System: A text-based (extensible to audio) API-driven prototype that:

  1. Detects scams in incoming messages/conversations.
  2. Triggers Hand-Off: User consent for AI takeover.
  3. Engages Scammer: Autonomous AI persona stalls and probes.
  4. Extracts Intelligence: Pulls financial/phishing details.
  5. Outputs: JSON with transcript, extracted data, confidence.

Flow: Input (message) → Detection → Hand-Off Consent (simulated in API) → Engagement Loop → Extraction → JSON Response.
Multilingual: Auto-detects and responds in English/Hindi/Gujarati (handles dialects/code-switching).
Scalability: Cloud-ready (Heroku free tier), low-latency (<1s/response).

Multilingual Support

  • Focus: English, Hindi, Gujarati (Gujarat relevance; broad Indic).
  • Detection/Engagement: Langdetect for language ID; IndicBERT/LLM for processing.
  • Models: AI4Bharat/IndicBERT (fine-tuned on 9+ Indic languages).
  • Honeypot Responses: Generated in detected language (e.g., Hindi for Hindi scams).
  • Limitations: High accuracy (85-95% WER) on majors; fallback to English for rare dialects.

High-Level Architecture for a Powerful Agentic AI Honeypot System

To make your ScamShield AI honeypot (Challenge 2) a top contender in the India AI Impact Buildathon 2026, focus on a robust, scalable, and innovative tech stack that emphasizes agentic AI capabilities. Since the first checkpoint likely evaluates core functionality (scam detection, hand-off, engagement, and extraction) via automated testing or manual review, prioritize a system that's efficient, accurate (target 90%+ on detection/extraction), and demo-ready. Assuming submission involves an API endpoint (common for such hackathons—e.g., they might send simulated scam inputs and expect JSON outputs), design it as a RESTful API that can handle text-based interactions flexibly. This ensures it's testable in any mode (e.g., API calls, UI demo, or batch testing).
The architecture should be modular:

  1. Input Layer: Accept text/audio (optional) via API (e.g., POST /detect-and-engage with JSON payload containing message/conversation).
  2. Detection Module: Quick ML-based classification to flag scams and trigger hand-off.
  3. Agentic Engagement Module: Autonomous AI loop for conversation simulation and stalling.
  4. Extraction Module: Post-engagement NLP to pull intel.
  5. Output Layer: Return structured JSON (detection result, transcript, extracted data).

This setup handles real-time testing (e.g., if judges send scam scripts via API) or demo videos. Use free/open-source tools for feasibility (no paid APIs needed beyond free tiers). Aim for low latency (<1s per response) on a standard laptop/GPU.

1. Core Algorithms and AI/ML Techniques

  • Scam Detection (High-Level Algorithm: Multimodal Classification):
    • Hybrid Approach: Combine rule-based heuristics (fast, explainable) with ML for nuance. Use keyword matching for India-specific scams (e.g., "UPI transfer", "police arrest", "OTP share") + sentiment analysis for urgency/fear (e.g., VADER or IndicBERT).
    • Advanced ML: Supervised binary classification (scam vs. legit). Train/fine-tune on datasets like Indic scam corpora (e.g., from Kaggle/Common Voice augmented with synthetic scams).
    • Why Powerful?: Reduces false positives; achieves 95% F1-score with ensemble methods (e.g., Random Forest + Neural Net).
    • Edge for Winning: Incorporate contextual reasoning (e.g., chain-of-thought prompting in LLM to analyze conversation history).
  • Agentic AI Engagement (High-Level Algorithm: Reinforcement Learning-Inspired Loop with LLM Orchestration):
    • Agentic Framework: Use a "ReAct" (Reason-Act) loop: Observe (input message) → Reason (plan response) → Act (generate reply) → Observe next. This makes the AI autonomous and adaptive—e.g., if scammer pushes for UPI, agent probes "Which bank? Send ID again?" while stalling.
    • Persona Simulation: Dynamic role-playing with memory (store conversation history in vector embeddings for context-aware responses).
    • Stalling Tactics: Algorithmic delays—use probabilistic branching (e.g., 70% chance to ask clarifying questions, 30% to express confusion) based on scammer aggression (detected via sentiment).
    • Why Powerful?: Handles evolving scams (e.g., adapts to voice-cloning hints like "It's your son—send money fast"). Simulates human-like variability to avoid detection by scammers.
    • Edge for Winning: Multi-turn persistence (up to 20 turns) with goal-oriented behavior (maximize intel extraction while minimizing risk).
  • Intelligence Extraction (High-Level Algorithm: Entity Recognition + Pattern Matching):
    • NLP Pipeline: Named Entity Recognition (NER) for entities like UPI IDs (e.g., regex: [a-zA-Z0-9._]+@[a-zA-Z0-9]+), bank accounts (e.g., 10-12 digits + IFSC patterns), phishing links (URL regex with domain blacklisting).
    • Advanced ML: Fine-tuned transformer models for custom entities (e.g., spaCy with Indic support for Hindi/Gujarati scams).
    • Post-Processing: Validate extracted data (e.g., check UPI format validity) and score confidence (e.g., Bayesian inference for reliability).
    • Why Powerful?: High recall (95% on key entities) even in noisy/code-switched text; outputs clean, actionable JSON for police integration.
    • Edge for Winning: Zero-shot extraction for new scam types using LLM prompting (e.g., "Extract all financial details from this transcript").
  • Overall System Optimization (High-Level: Ensemble + Edge Computing):
    • Latency/Efficiency: Quantization (e.g., 8-bit models) and caching (e.g., pre-compute common responses).
    • Scalability: Design for cloud (e.g., deploy on Vercel/Heroku free tier) or edge (TensorFlow Lite for mobile simulation).
    • Evaluation Metrics: Built-in testing harness (e.g., unit tests on 100+ scam scenarios) to prove robustness.

2. Recommended AI/ML Models

  • LLMs for Agentic Core:
    • Groq/Llama-3.1-8B (or 70B if GPU available): Fast inference (free tier via Groq API); excellent for Indic languages. Fine-tune on scam dialogues for persona accuracy.
    • Alternative: Gemma-2-9B (Hugging Face): Lightweight, open-source; strong zero-shot reasoning for ReAct loops.
    • Why?: Enables agentic autonomy—handles multilingual (Hindi/Gujarati/English) with 85-95% naturalness.
  • Detection Models:
    • IndicBERT (AI4Bharat): Pre-trained on 12 Indic languages; fine-tune for scam classification (95% accuracy on benchmarks).
    • Alternative: DistilBERT Multilingual: Smaller footprint, handles code-switching.
  • Extraction Models:
    • spaCy with Custom NER: Pre-trained en_core_web_sm + Indic pipeline; add rules for UPI/bank patterns.
    • Alternative: Hugging Face's Indic-NER: Specialized for Indian entities.
  • Optional Audio Extension (for Bonus Points):
    • Whisper (OpenAI): For transcribing audio inputs (if testing includes calls); multilingual support.
    • Why?: Makes it "call-ready" without overcomplicating—transcribe once, then feed to text-based agent.

3. Key AI Libraries and Frameworks

  • Agentic AI Orchestration:
    • LangGraph or LlamaIndex: Build the ReAct agent loop (chains LLMs with tools like memory retrieval). Powerful for autonomy—e.g., integrate conversation memory as a vector store (FAISS).
    • Why?: Turns simple LLM calls into a full agent; easy to add tools (e.g., "query police DB" simulation).
  • ML/NLP Core:
    • Hugging Face Transformers: Download/fine-tune models (IndicBERT, Llama); free offline use.
    • spaCy/ NLTK: For extraction and sentiment.
    • Scikit-learn: For ensemble classifiers in detection.
  • API and Deployment:
    • FastAPI: Expose endpoints (e.g., /honeypot/engage for interaction loop). Async for low-latency testing.
    • Streamlit/Gradio: Quick UI for demo video (chat interface); embed API calls.
    • Why?: If judges test via API, this handles JSON inputs/outputs seamlessly (e.g., input: {"message": "Send ₹5000 to this UPI"}, output: extracted JSON + transcript).
  • Other Utilities:
    • Pinecone/ChromaDB: Vector DB for storing scam embeddings (if adding repeat detection as bonus).
    • Torch (PyTorch): For model inference/quantization.
    • Langdetect: Auto-detect language for multilingual responses.

4. Making It Test-Ready for Any Mode

  • API-Centric Design: Assume evaluation via API (e.g., they POST scam scenarios and check JSON responses for accuracy). Include endpoints like /detect (returns scam probability), /engage (simulates full loop with mock scammer inputs).
  • Flexible Testing: Add query params for modes (e.g., ?mode=text or ?mode=audio). Include self-evaluation script in repo (e.g., test on 50 scam samples, report metrics).
  • Robustness: Handle edge cases (e.g., short messages, Hindi-only, aggressive scammers). Use error-handling in API (return 200 OK with details).
  • Winning Tip: Document API usage in README (e.g., curl examples)—makes it easy for judges to test.

Implement this stack, and your system will be technically superior: Agentic, multilingual, accurate, and scalable. Test on real scam examples (from TRAI reports or synthetic data). If you share your current code snippet, I can suggest exact integrations! Focus on building the agent loop first— that's the "wow" factor for top 10.

—----------------------------------------------------------------------

Including Audio

High-Level Architecture for a Powerful Agentic AI Honeypot System (with Integrated Audio Support and LangGraph Orchestration)

To elevate your ScamShield AI honeypot (Challenge 2) for the India AI Impact Buildathon 2026, integrate audio support as a core feature alongside text. This makes your system versatile and a standout—handling India's call-heavy scam crisis (e.g., voice cloning, impersonation scams). Since we don't know if judges will test with audio (e.g., via API uploads or simulated calls), building it in ensures capability for any mode: text inputs, audio clips, or hybrid. Audio adds a "plus point" by demonstrating real-world feasibility (e.g., mobile app integration), boosting innovation scores.
Audio is handled efficiently: Transcribe once → process as text → respond in text (or optional synthesized voice). This keeps latency low (~2-5s for audio) and avoids complexity. Use free tools like Whisper for transcription (multilingual Indic support). The system remains modular, scalable, and API-testable (e.g., FastAPI endpoints for text/audio).

1. Core Algorithms and AI/ML Techniques

  • Input Preprocessing (High-Level Algorithm: Multimodal Normalization):
    • Text: Clean and tokenize (remove noise, handle code-switching).
    • Audio: Automatic Speech Recognition (ASR) to transcribe → feed to text pipeline. Detect language/accent (e.g., Hindi/Gujarati dialects) for accurate processing.
    • Why Powerful?: Unified handling—audio clips (e.g., .wav/mp3) become text seamlessly, enabling the same downstream logic. Achieves 90%+ transcription accuracy on Indic accents.
    • Edge for Winning: Robust to noisy calls (e.g., background noise in rural scams) using noise reduction; fallback to partial transcripts if unclear.
  • Scam Detection (High-Level Algorithm: Multimodal Classification):
    • Hybrid Approach: Rule-based (keywords like "UPI", "arrest", "OTP") + ML on text/audio features. For audio, add prosody analysis (tone urgency via pitch/volume).
    • Advanced ML: Fine-tuned IndicBERT on transcribed text; ensemble with audio classifiers (e.g., Wav2Vec2 for voice patterns like synthetic artifacts in deepfakes).
    • Why Powerful?: 95% F1-score; detects audio-specific scams (e.g., emotional manipulation in voice calls).
    • Edge for Winning: Multi-factor (text + audio signals) reduces false positives; contextual reasoning via LLM (e.g., "Is this a fake police call?").
  • Agentic AI Engagement (High-Level Algorithm: Reinforcement Learning-Inspired Loop with LLM Orchestration):
    • Agentic Framework: ReAct loop (Observe → Reason → Act) orchestrated via LangGraph for superior stateful graphs. Define nodes (e.g., "detect intent", "plan response") and edges (branching based on scammer aggression or extraction progress). LangGraph handles loops iteratively with built-in retries, cycles, and state persistence (e.g., conversation memory as a shared state object).
    • Persona Simulation: Dynamic, memory-aware (vector embeddings of history stored in LangGraph's state); multilingual responses (Hindi/English/Gujarati).
    • Stalling Tactics: Probabilistic branching within the graph (e.g., 70% chance to ask clarifying questions, 30% to express confusion); for audio, optional TTS to reply in voice (mimicking elderly tone).
    • Why Powerful?: LangGraph ensures robust autonomy—adapts to call dynamics (e.g., pauses in audio indicate scammer hesitation—probe more) without state loss, outperforming simpler chains.
    • Edge for Winning: Multi-turn persistence (up to 20 turns) with goal-oriented behavior (maximize intel extraction while minimizing risk); easy to add human-in-the-loop nodes (e.g., user override).
  • Intelligence Extraction (High-Level Algorithm: Entity Recognition + Pattern Matching):
    • NLP Pipeline: NER/regex on transcribed text for UPI IDs, bank details, links. For audio, extract speaker diarization (who said what).
    • Advanced ML: spaCy with custom Indic entities; validate audio-extracted data (e.g., flag mumbled UPI as low-confidence).
    • Why Powerful?: 95% recall; works on noisy transcripts.
    • Edge for Winning: Zero-shot for new scams; audio bonuses like accent analysis (e.g., "Non-native Hindi—possible foreign scammer").
  • Overall System Optimization (High-Level: Ensemble + Edge Computing):
    • Latency/Efficiency: Parallel processing (transcribe in background); quantization for models.
    • Scalability: Edge (mobile TensorFlow Lite for audio) or cloud (Vercel free tier).
    • Evaluation Metrics: Test on mixed text/audio datasets (e.g., 100 scams, including Indic call recordings).

2. Recommended AI/ML Models

  • Audio-Specific Models:
    • Whisper (OpenAI/Hugging Face): For multilingual ASR (English/Hindi/Gujarati; 85-95% WER on Indic). Fine-tune on scam call datasets for accuracy.
    • Wav2Vec2 (Facebook/Hugging Face Indic variant): Audio feature extraction for detection (e.g., detect synthetic voices or urgency in tone).
    • Optional TTS for Responses: IndicTTS or gTTS: Synthesize agent replies in voice (Hindi/English accents) for full audio simulation—big wow for demo.
  • LLMs for Agentic Core:
    • Groq/Llama-3.1-8B (or 70B): Handles Indic languages; fine-tune on audio-transcribed dialogues.
    • Alternative: Gemma-2-9B: Lightweight for edge audio processing.
  • Detection Models:
    • IndicBERT (AI4Bharat): Text classification; pair with Wav2Vec2 for audio.
    • Alternative: XLS-R (Multilingual Wav2Vec2): Broad Indic coverage.
  • Extraction Models:
    • spaCy with Custom NER: Indic support; process audio transcripts.

3. Key AI Libraries and Frameworks

  • Audio Handling:
    • Librosa/SoundFile: Load/process audio (e.g., noise reduction, chunking for real-time).
    • Torchaudio (PyTorch): For Wav2Vec2 inference; integrates with Whisper.
    • SpeechRecognition or Hugging Face Pipelines: Quick ASR wrappers.
  • Agentic AI Orchestration:
    • LangGraph (built on LangChain): Primary for graph-based workflows—define stateful nodes/edges for the ReAct loop, memory retrieval, and branching. (Install via pip if needed, but it's free/open-source and integrates seamlessly with LLMs.)
    • Fallback: LangChain: For simpler chains if LangGraph setup is too heavy, but prioritize LangGraph for loops/state.
  • ML/NLP Core:
    • Hugging Face Transformers: Whisper/Wav2Vec2/IndicBERT; offline-capable.
    • spaCy/NLTK: Extraction on transcripts.
    • Scikit-learn: Ensemble for detection.
  • API and Deployment:
    • FastAPI: Endpoints like /honeypot/engage-text (JSON message) and /honeypot/engage-audio (Base64 audio upload). Async for audio processing.
    • Streamlit/Gradio: UI for demo (upload audio → see transcript → engagement).
    • Why?: Judges can test audio via curl (e.g., POST audio file) or text; returns unified JSON.
  • Other Utilities:
    • Pinecone/ChromaDB: Store audio embeddings (e.g., for repeat scammer voice matching as bonus).
    • Langdetect: Language detection on transcripts.
    • gTTS (Google Text-to-Speech): Free TTS for audio responses.

4. Making It Test-Ready for Any Mode (Including Audio)

  • API-Centric Design: Dual endpoints for text/audio. E.g., input audio → transcribe → detect → engage → JSON output with transcript flag ("source: audio").
  • Flexible Testing: Query params like ?input_type=audio; include self-tests in repo (e.g., process sample .wav scams, report metrics).
  • Robustness: Handle short/noisy audio (fallback to "partial detection"); multilingual thresholds.
  • Winning Tip: In README, provide curl examples for audio testing (e.g., upload scam call clip); demo video shows both text and audio runs.