DEV Community

Dhyanesh Mahendiran
Dhyanesh Mahendiran

Posted on

Building FraudSight: A Local GraphRAG Agent for TigerGraph using Mistral-Nemo

Fraud investigation in banking is traditionally a manual, fragmented process. Analysts have to trace money movement, connect shared device profiles, and consult complex policy documents to figure out if a transaction is legitimate or part of a coordinated attack.

For the TigerGraph Agentic Fraud Investigation Hackathon, I built FraudSight: a privacy-first, fully autonomous AI agent that investigates fraud cases, queries a TigerGraph database, and drafts regulatory Suspicious Activity Reports (SARs) without relying on expensive cloud APIs.

Here is a breakdown of what I built, the architecture, and the engineering hurdles I overcame to make local models behave predictably.

The Architecture & TigerGraph Integration

The core of the dataset consists of 6 months of Vesta transaction data, anonymized customer records, and identity profiles. I hosted the graph on TigerGraph Cloud (Savanna), mapping out a schema connecting Customer, Card, Transaction, DeviceProfile, and FraudCase vertices.

To bridge the gap between the LLM and the database, I integrated the TigerGraph Model Context Protocol (MCP). Instead of writing hardcoded API wrappers, the MCP exposes the graph database directly to the agent as a suite of executable tools (e.g., get_nodes, run_query).

Agentic Capabilities: Taming Local Models

A major requirement for my project was running the LLM locally on an RTX 5070 GPU to ensure customer financial data remained private. I used Mistral-Nemo via LangChain.

However, small local models are notorious for failing at generic ReAct (Reasoning + Acting) loops and hallucinating JSON schemas. If the agent fabricated a Case ID, the hackathon rules dictated an automatic zero score.

To give the agent deterministic guardrails, I:

  1. Explicitly Bound Tools: Bypassed generic agent executors in favor of explicit Ollama tool-binding.
  2. Enforced Pydantic Schemas: Used strict Python Enum and Literal validation for the final output. The agent physically cannot output a verdict other than fraud, legitimate, or uncertain, and it is forced to cite exact policy rules (R1-R10) when recommending the next best action.

The GraphRAG Innovation & What I Learned

The hardest challenge arose when integrating GraphRAG to allow the agent to semantically search the bank's unstructured fraud policies.

During development, the cloud vector search endpoint threw a 404 error, breaking the semantic search. Instead of abandoning the feature, I engineered a local Python cosine-similarity fallback. I modified the MCP tool so the agent uses tigergraph__get_nodes to pull the raw PolicyChunk embeddings directly from the graph into memory. The application then performs the mathematical cosine similarity comparison locally in Python against the user's query, seamlessly sorting and returning the top policy documents.

This taught me a vital lesson in building resilient agentic systems: always have local fallbacks for cloud dependencies, and understand the underlying vector math instead of relying purely on abstracted APIs.

What I Would Improve

With more time, I would transition this to a Multi-Agent Architecture using LangGraph. I would deploy one lightweight "Investigator Agent" dedicated purely to routing and executing TigerGraph MCP queries, and a larger "Policy Judge Agent" responsible for evaluating the retrieved evidence against the regulatory SAR framework.

Conclusion

FraudSight demonstrates that secure, local agentic workflows can successfully orchestrate complex graph database investigations while adhering to strict banking policies.

Watch the Demo:
Google Drive Demo Link

View the Code:

πŸ” FraudSight: Agentic Investigation Engine

Python TigerGraph LangGraph Streamlit Ollama

An autonomous, graph-native fraud investigation agent that traverses the TigerGraph knowledge graph via the Model Context Protocol (MCP), applies bank policy rules through GraphRAG, and produces fully structured, hackathon-compliant JSON case reports β€” all on local GPU compute with zero data leaving the machine.



πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      FraudSight Pipeline                            β”‚
β”‚                                                                     β”‚
β”‚  case_pack.csv ──▢ fraud_agent.py                                   β”‚
β”‚                        β”‚                                            β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚              β”‚  mistral-nemo LLM  β”‚  ← Local GPU (RTX 5070)         β”‚
β”‚              β”‚  (Ollama, 12B)     β”‚                                 β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β”‚                        β”‚  ReAct Loop                                β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚              β”‚  TigerGraph MCP    │────▢│  FraudCaseGraph      β”‚   β”‚
β”‚              β”‚  (48 tools)        β”‚     β”‚  (TigerGraph Savanna) β”‚   β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                        β”‚                                            β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚              β”‚  GraphRAG          β”‚  ← Policy chunk lookup          β”‚
β”‚              β”‚  (cosine-sim)      β”‚  ← nomic-embed-text (local)     β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β”‚                        β”‚                                            β”‚
…











Top comments (0)