<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Akhil Joshi</title>
    <description>The latest articles on DEV Community by Akhil Joshi (@akhil03).</description>
    <link>https://dev.to/akhil03</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4141789%2Fef01ca6a-e040-4c9f-a952-7e81a01b542f.png</url>
      <title>DEV Community: Akhil Joshi</title>
      <link>https://dev.to/akhil03</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akhil03"/>
    <language>en</language>
    <item>
      <title>Building an Agentic Fraud Investigator with TigerGraph, LangGraph and Gemini</title>
      <dc:creator>Akhil Joshi</dc:creator>
      <pubDate>Thu, 24 Sep 2026 18:55:49 +0000</pubDate>
      <link>https://dev.to/akhil03/building-an-agentic-fraud-investigator-with-tigergraph-langgraph-and-gemini-np1</link>
      <guid>https://dev.to/akhil03/building-an-agentic-fraud-investigator-with-tigergraph-langgraph-and-gemini-np1</guid>
      <description>&lt;p&gt;By Akhil, Om and Lovesh&lt;/p&gt;

&lt;h1&gt;
  
  
  Building an Agentic Fraud Investigator with TigerGraph, LangGraph, and Gemini
&lt;/h1&gt;

&lt;p&gt;Most fraud systems answer one question: is this transaction suspicious? A bank analyst needs three answers: what happened, how confident are we, and what should the bank do next?&lt;/p&gt;

&lt;p&gt;For the TigerGraph × Hacker House Goa challenge, we built an agent that answers all three. It takes a fraud alert, investigates it against a graph of transaction data, decides whether it's fraud, legitimate, or unclear, and recommends a next action under the bank's written policy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo:&lt;/strong&gt; &lt;a href="https://drive.google.com/drive/folders/1JQ2Rokt4nrLOKi20YA5Ro-9a9aopoS0u?usp=share_link&amp;amp;utm_source=gemini" rel="noopener noreferrer"&gt;Google Drive&lt;/a&gt;&lt;br&gt;
 &lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/OMIZOOMI/tigergraph-fraud-investigation?utm_source=gemini" rel="noopener noreferrer"&gt;OMIZOOMI/tigergraph-fraud-investigation&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;The challenge dataset is derived from IEEE-CIS: roughly 590,000 card transactions and 144,000 identity records, with the fraud label removed. Each transaction carries only a risk score from a detection model, and the agent had to investigate 20 benchmark cases.&lt;/p&gt;

&lt;p&gt;A high risk score is not proof of fraud. Plenty of legitimate activity looks odd on the surface, so the agent has to weigh evidence and know when it doesn't have enough to decide. That is a relationship problem: is this card tied to a device that many other cards use, do the regions make sense, and did similar past cases turn out to be fraud?&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;An agentic investigation pipeline that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compares a suspicious transaction against the cardholder's own history.&lt;/li&gt;
&lt;li&gt;Looks for related devices, regions, transactions, and closed cases.&lt;/li&gt;
&lt;li&gt;Classifies the case as fraud, legitimate, or uncertain, and flags &lt;code&gt;undocumented&lt;/code&gt; patterns that don't match known typologies.&lt;/li&gt;
&lt;li&gt;Requests additional (simulated) customer evidence and shows how the recommendation dynamically changes.&lt;/li&gt;
&lt;li&gt;Routes the decision for approval (&lt;code&gt;auto&lt;/code&gt;, &lt;code&gt;L1&lt;/code&gt;, or &lt;code&gt;L2&lt;/code&gt; analyst) based on exposure amounts and uncertainty policies.&lt;/li&gt;
&lt;li&gt;Writes the result back to TigerGraph and saves a readable JSON answer file for every case.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;case_pack.csv ──► run_investigation.py
                        │
                        ▼
              ┌───────────────────┐
              │ LangGraph         │
              │ Investigator node │◄──── TigerGraph MCP client ──► TigerGraph (FraudGraph)
              │        │          │◄──── local case memory (closed_cases_history.csv)
              │        ▼          │
              │ Decision node     │
              │        │          │
              │ Evidence needed?  │
              │   yes │     │ no  │
              │       ▼     ▼     │
              │ Simulate   Save &amp;amp; │
              │ evidence   close  │
              └───────────┬────────┘
                          ▼
                cases/&amp;lt;case_id&amp;gt;.json  +  write-back to TigerGraph

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Data loading:&lt;/strong&gt; Transactions and identity data are loaded into TigerGraph using a GSQL schema mapping vertices like &lt;code&gt;Customer&lt;/code&gt;, &lt;code&gt;Card&lt;/code&gt;, &lt;code&gt;Device&lt;/code&gt;, &lt;code&gt;Transaction&lt;/code&gt;, and &lt;code&gt;BillingRegion&lt;/code&gt;, connected by edges such as &lt;code&gt;HAS_CARD&lt;/code&gt;, &lt;code&gt;USED_DEVICE&lt;/code&gt;, and &lt;code&gt;TRANSACTED_IN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LangGraph orchestrator:&lt;/strong&gt; A state machine with an investigator node, a decision node, an evidence-simulation node, and a save-and-close node. The loop matters: the agent makes an initial recommendation, asks for more evidence if it isn't sure, then decides again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TigerGraph MCP client:&lt;/strong&gt; The agent doesn't write raw database calls. It retrieves transaction and relationship evidence through the official TigerGraph MCP server, meaning all graph access goes through standard, governed tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gemini:&lt;/strong&gt; &lt;code&gt;gemini-3.5-flash-lite&lt;/code&gt; executes the reasoning over the retrieved evidence and produces the strictly typed JSON verdicts and summaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  How We Used TigerGraph
&lt;/h2&gt;

&lt;p&gt;TigerGraph performed three critical jobs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Evidence retrieval:&lt;/strong&gt; Multi-hop questions such as "which other cards share this device?" or "does this billing region fit the customer's history?" are complex graph traversals, not simple table joins. Rather than hardcoding static GSQL, the MCP integration allowed Gemini to dynamically fetch subgraph transaction histories based on the active case context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grounding:&lt;/strong&gt; Every claim in the final output points back to specific node IDs in the graph, so a human reviewer can definitively trace a conclusion back to its source data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Case memory:&lt;/strong&gt; After each investigation, the agent writes the case back into the graph, ensuring future investigations can query that precedent and learn from it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Uncertainty and Next-Best Actions
&lt;/h2&gt;

&lt;p&gt;The agent doesn't force a yes-or-no answer. When evidence conflicts or the fraud probability falls between 0.30 and 0.70, it securely halts and returns an &lt;code&gt;uncertain&lt;/code&gt; verdict.&lt;/p&gt;

&lt;p&gt;Each case output records an &lt;code&gt;initial&lt;/code&gt; recommendation, a &lt;code&gt;final&lt;/code&gt; recommendation after evidence is considered, and a &lt;code&gt;what_changed&lt;/code&gt; field explaining why the action stayed the same or shifted. Based on strict organizational rules (Policy R8), high-exposure cases (over $500) or highly uncertain verdicts are immediately escalated to &lt;code&gt;L1&lt;/code&gt; or &lt;code&gt;L2&lt;/code&gt; analysts. The output also autonomously decides whether filing a Suspicious Activity Report (SAR) is legally appropriate based on the exposure threshold.&lt;/p&gt;

&lt;p&gt;We also designed the output for non-engineers. Each JSON file contains a plain-language summary, the supporting graph evidence, an array of &lt;code&gt;similar_prior_cases&lt;/code&gt;, and the exact recommended action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;100% Completion:&lt;/strong&gt; Investigated all 20 benchmark cases and successfully produced 20 schema-compliant answer files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Achieved an average investigation time of ~50 seconds per case (with full latency metrics recorded natively in the outputs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adaptive Routing:&lt;/strong&gt; Case &lt;code&gt;HHG-001&lt;/code&gt; successfully surfaced a historic out-of-region fraud pattern, recommending a &lt;code&gt;BLOCK_CARD&lt;/code&gt; action routed to &lt;code&gt;L1&lt;/code&gt; (due to low exposure of $77.07).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trap Handling:&lt;/strong&gt; Case &lt;code&gt;HHG-019&lt;/code&gt; triggered our uncertainty threshold, dynamically shifting the verdict to &lt;code&gt;uncertain&lt;/code&gt; and escalating to an analyst rather than making a reckless automated decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Challenges and Limitations
&lt;/h2&gt;

&lt;p&gt;During heavy multi-tool query loops, we experienced occasional HTTP 500 timeouts when the MCP attempted to pull massive historical precedents simultaneously. To ensure stability for the benchmark run, the current version utilizes a local pandas fallback parsing &lt;code&gt;closed_cases_history.csv&lt;/code&gt; for case memory. It keeps precedent retrieval highly reliable for the demo. In a production environment, we would move that memory into a dedicated historical-case vertex in TigerGraph and query it through the same governed MCP layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model the graph first:&lt;/strong&gt; Once the data was structured cleanly into nodes and edges, the complex analytical queries became remarkably simple.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncertainty is a feature:&lt;/strong&gt; Letting the agent say "I'm not sure, I need more evidence" and enforcing a probability trap (0.30–0.70) made the pipeline infinitely more trustworthy than an LLM hallucinating a forced verdict.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explainability is part of the product:&lt;/strong&gt; Fraud reviewers shouldn't have to read Python or interpret raw database dumps to understand a decision.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fault tolerance is engineering:&lt;/strong&gt; Building the exponential backoff logic and the local CSV fallback layer wasn't just a hackathon workaround—it was a masterclass in designing resilient microservices that degrade gracefully instead of crashing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/OMIZOOMI/tigergraph-fraud-investigation
&lt;span class="nb"&gt;cd &lt;/span&gt;tigergraph-fraud-investigation
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env   &lt;span class="c"&gt;# add TigerGraph + Gemini credentials&lt;/span&gt;
python run_investigation.py

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>tigergraph</category>
      <category>ai</category>
      <category>python</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
