DEV Community

Cover image for GraphGuard AI: Follow the Connections, Uncover the Fraud
Anshika Sahu
Anshika Sahu

Posted on

GraphGuard AI: Follow the Connections, Uncover the Fraud

GraphGuard AI: Follow the Connections, Uncover the Fraud

Don’t Just Detect the Anomaly. Follow the Connections.

How We Built a Graph-First Fraud Intelligence Platform Using FalkorDB, FastAPI, and React Flow


💡 The $85,000 Blind Spot

Picture this scenario at a modern neobank:

A customer initiates an outbound wire transfer of $85,000.00 USD at 2:14 AM.

The traditional fraud rule engine immediately kicks in:

  • Account balance? Sufficient ($120,000).
  • Account age? 3 years old.
  • Two-factor authentication? Passed.
  • Beneficiary bank code? Valid.

To an ordinary relational database or tabular fraud model, this transaction looks like a clean, authorized payment. Status: Approved.

Except it wasn't clean.

Three minutes earlier, an unauthorized session had taken over the account through a subtle SIM-swap. The wire was being routed into an offshore shell escrow company. And the physical laptop executing the payment had already been used across three other compromised accounts that drained over $140,000 in prior fraud.

Traditional anti-fraud systems failed to catch it because they evaluate transactions as isolated rows in a table.

Modern financial crime syndicates do not operate in silos. They operate in dense, distributed webs—reusing rooted devices, rotating through commercial VPNs and Tor exit nodes, and bouncing stolen funds across multi-hop mule networks.

To stop modern financial crime, you cannot just look at the transaction. You have to follow the connections.

That insight led to GraphGuard AI — built for GRAPH Hacks 2026 (Track 01: Agents That Act on Connected Data).


🧠 Why FalkorDB is the Core Engine (Not Just a Diagram)

When many developers build "graph applications," they often fall into a trap: they store everything in PostgreSQL or MongoDB, and then draw an SVG graph on the frontend as decoration.

In GraphGuard AI, we took the opposite approach: the graph does the heavy lifting, or the system does not run at all.

Why FalkorDB?

1. The Multi-Hop Reality

To uncover fraud rings, our agent needs to traverse:

Transaction ──> Account ──> Device ──> Mule Account ──> Prior Incident
Enter fullscreen mode Exit fullscreen mode

In relational SQL, querying 4 hops deep with arbitrary relationship types requires recursive CTEs or four nested JOIN statements. Under heavy concurrent transactional volume, database CPU spikes, connections pool, and query latency climbs to seconds.

FalkorDB—built on low-latency Redis architecture and sparse matrix mathematics (GraphBLAS)—treats relationships as native in-memory pointers. Our agent executes multi-hop traversals across thousands of nodes in under 4 milliseconds.

2. Grounding AI in Verified Graph Facts (Zero Hallucinations)

Large Language Models (LLMs) are notorious for hallucinating connections that don't exist. In financial crime and AML (Anti-Money Laundering), a hallucinated allegation can freeze innocent people’s life savings, while a missed connection leads to catastrophic losses.

In our architecture, the LLM is never allowed to guess.

  1. The autonomous agent queries FalkorDB using Cypher.
  2. FalkorDB returns the verified graph neighborhood and factual path evidence.
  3. Only this verified graph evidence is projected into the Groq LPU reasoning engine.
  4. The AI acts as an articulate investigative analyst, summarizing verified graph topology rather than inventing connections.

🏗️ The Graph Topology & Data Model

We modeled the connected financial universe across 7 distinct entity labels and 10 relationship types:

 (Customer) ──[:OWNS]──> (Account) ──[:MADE]──> (Transaction)
                            │                       │
                     [:SHARED_WITH]           [:USED_DEVICE]
                            │                       │
                            ▼                       ▼
                     (Mule Account)            (Device)
                            │
                     [:HAS_INCIDENT]
                            │
                            ▼
                        (Incident)
Enter fullscreen mode Exit fullscreen mode
  • Customer: KYC status, risk tier, registered identity.
  • Account: Checking/Savings, status (ACTIVE, FROZEN, COMPROMISED).
  • Transaction: Amount, execution timestamp, payment channel (WIRE_TRANSFER, ACH, POS).
  • Device: Hardware fingerprint, OS, browser, jailbreak/root status.
  • IP: IP address, ISP, commercial VPN flags, Tor exit node detection.
  • Location: City, country, geopolitical AML risk tier.
  • Incident: Confirmed past fraud cases, chargebacks, and SAR filings.

⚡ The Cypher Queries Powering the Agent

Here is a look at the parameterized Cypher queries running under the hood on FalkorDB Cloud:

1. The Multi-Hop Syndicate Traversal (1 to 4 Hops)

When an analyst requests an investigation into a suspicious transaction, FalkorDB searches outwards up to 4 degrees of separation for known bad actors:

MATCH path = (t:Transaction {id: $tx_id})-[*1..4]-(target)
WHERE target:Incident 
   OR (target:Account AND target.status CONTAINS 'FROZEN') 
   OR (target:Device AND target.is_rooted = true)
RETURN path
Enter fullscreen mode Exit fullscreen mode

2. Device Fingerprint Cross-Pollination

Fraud rings frequently recycle laptops or phones across fake accounts:

MATCH (t:Transaction {id: $tx_id})-[:USED_DEVICE]->(d:Device)
OPTIONAL MATCH (d)-[:SHARED_WITH|ASSOCIATED_WITH]-(other_a:Account)
RETURN d, collect(other_a) AS connected_accounts
Enter fullscreen mode Exit fullscreen mode

3. Tracing the Direct Path to Prior Financial Loss

MATCH path = (t:Transaction {id: $tx_id})-[:USED_DEVICE]->(d:Device)-[:SHARED_WITH|ASSOCIATED_WITH*1..2]-(a:Account)-[:HAS_INCIDENT]->(inc:Incident)
RETURN inc, a, path
Enter fullscreen mode Exit fullscreen mode

🔍 Case Study: Cracking TX-104 in Real Time

Let’s trace what happens when GraphGuard AI investigates transaction TX-104:

  1. Transaction Lookup: $85,000.00 USD wire to Swift Wire Escrow Express Corp from Account A501.
  2. Device Analysis: FalkorDB flags that Device D55 (MacBook running Headless Chrome) has is_rooted = true.
  3. Graph Traversal: Expanding relationships reveals Device D55 is shared with Account A887 (FROZEN_COMPROMISED).
  4. Incident Resolution: 4 hops away, Account A887 is tied to Incident F22—a confirmed $140,000 wire fraud cash-out.
  5. Network Telemetry: Origin IP 198.51.100.24 resolves to a Tor exit node in a high-risk jurisdiction.

Mathematical Risk Score Breakdown

Rather than outputting an opaque "black-box" probability, GraphGuard AI computes a transparent, auditable score where every factor is accounted for:

$$\text{Risk Score} = 35 + 30 + 15 + 10 + 8 = \mathbf{98/100} \quad (\text{HIGH / CRITICAL})$$

  • +35 pts: Direct graph link to confirmed Incident F22 ($140K loss)
  • +30 pts: High-value rapid wire transfer ($85,000)
  • +15 pts: Rooted hardware D55 shared across multiple accounts
  • +10 pts: Commercial VPN / Tor exit node network origin
  • +8 pts: Velocity and mule account linkage

🛡️ Enterprise Safety: The 5-Stage Human Gate

Autonomous agents should recommend, but they should never unilaterally execute destructive actions in core financial infrastructure.

GraphGuard AI introduces a strict 5-Stage Human-in-the-Loop Gate:

[01: AI Recommendation] ➔ [02: Human Review Required] ➔ [03: Officer Decision] ➔ [04: Simulated Action] ➔ [05: Cryptographic Audit]
Enter fullscreen mode Exit fullscreen mode
  1. AI Recommendation: The agent flags the transaction and recommends FLAG_TRANSACTION or FREEZE_ACCOUNT.
  2. Mandatory Human Escalation: Autonomous execution is blocked. An authorized compliance reviewer must log in.
  3. Officer Decision: The reviewer inspects the live FalkorDB subgraph on the interactive canvas and clicks Approve or Reject.
  4. Execution: The decision is routed through a simulated enforcement layer.
  5. Cryptographic Sealing: The entire case docket is permanently signed into a SHA-256 hash-chained audit ledger:

$$\text{hash}n = \text{SHA-256}(\text{hash}{n-1} + \text{canonical_event_payload})$$

A 1-click verification engine verifies the chain from the genesis block, ensuring no compliance record can ever be modified or erased.

Finally, compliance officers can click one button to generate a regulatory-ready Suspicious Activity Report (SAR) PDF Dossier, formatted with case telemetry, graph evidence, and cryptographic audit proofs ready for legal submission.


💻 Tech Stack & Deployment Architecture

  • Context & Graph Engine: FalkorDB Cloud (AWS ap-south-1 live cluster)
  • Backend API: Python FastAPI with async SSE streaming and Argon2id / JWT RBAC
  • AI Reasoning: Groq LPU (Ultra-fast LLM inference grounded strictly in Cypher evidence)
  • Frontend Workspace: React 19, React Flow, TailwindCSS, and Lucide Icons
  • Audit Persistence: SQLite ledger with SHA-256 cryptographic hash-chaining
  • Deployment:
    • Frontend on Vercel (Live Demo)
    • Backend on Render (Live API)
    • Full Docker Compose environment for local reproduction
    • Comprehensive automated test suite (26/26 tests passing in CI)

🚀 Key Takeaways for Developers Building with Graphs

  1. Graphs turn hidden context into explicit edges. When you model real-world relationships—devices, accounts, locations—patterns of fraud that were invisible in tables become screamingly obvious.
  2. Speed matters for agentic loops. Agents that query their memory in an iterative loop need sub-10ms responses. FalkorDB’s in-memory Redis architecture makes multi-step agent reasoning feel immediate.
  3. AI needs graph guardrails. Giving an LLM raw documents leads to guesses. Giving an LLM a verified subgraph from FalkorDB leads to explainable, bulletproof decision-making.

🌐 Explore the Project

  • Live Interactive Demo: Open Demo
  • GitHub Repository: View Source Code
  • YouTube Explanation Video: Watch Demo Video
  • Hackathon: GRAH Hack 2026 by FalkorDB & WeMakeDevs
    • Track 01: Agents That Act on Connected Data

"Don't just detect the anomaly. Follow the connections with FalkorDB."

Top comments (0)