<?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: Krapnshiii</title>
    <description>The latest articles on DEV Community by Krapnshiii (@krapnshiii16).</description>
    <link>https://dev.to/krapnshiii16</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%2F4142366%2Fae6e6c50-5955-4b2a-9eb6-2e4ee69494bb.png</url>
      <title>DEV Community: Krapnshiii</title>
      <link>https://dev.to/krapnshiii16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krapnshiii16"/>
    <language>en</language>
    <item>
      <title>Building TRACE: An Agentic Fraud Investigation System with TigerGraph and Gemini</title>
      <dc:creator>Krapnshiii</dc:creator>
      <pubDate>Fri, 25 Sep 2026 06:26:31 +0000</pubDate>
      <link>https://dev.to/krapnshiii16/building-trace-graph-based-fraud-investigation-with-tigergraph-and-gemini-4fnm</link>
      <guid>https://dev.to/krapnshiii16/building-trace-graph-based-fraud-investigation-with-tigergraph-and-gemini-4fnm</guid>
      <description>&lt;p&gt;A fraud alert tells you where to look. It does not tell you what happened.&lt;/p&gt;

&lt;p&gt;An unfamiliar device profile, an unusual transaction, or a high risk score can justify an investigation. But deciding what to do requires context: the customer’s history, connected activity, previous investigations, and the policy governing the next action.&lt;/p&gt;

&lt;p&gt;For the TigerGraph Agentic Fraud Investigation challenge, I built &lt;strong&gt;TRACE&lt;/strong&gt;, a prototype agentic fraud investigation system that brings those pieces together.&lt;/p&gt;

&lt;p&gt;TRACE produces an explainable investigation record: what evidence was considered, what remains uncertain, whether more information is needed, and which actions require human approval.&lt;/p&gt;

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

&lt;p&gt;TRACE combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TigerGraph&lt;/strong&gt; for transaction relationships, historical cases, investigation memory, and vector retrieval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The official TigerGraph MCP package&lt;/strong&gt; for exposing controlled graph queries to the investigation pipeline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 2.5 Flash&lt;/strong&gt; for evidence-grounded reasoning and structured assessments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local embeddings&lt;/strong&gt; using &lt;code&gt;sentence-transformers/all-MiniLM-L6-v2&lt;/code&gt; for semantic search without hosted embedding API quota issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Python policy engine&lt;/strong&gt; for action recommendations, SAR decisions, validation, and approval routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An analyst dashboard&lt;/strong&gt; for reviewing evidence, findings, decisions, and proposed actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benchmark contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;590,742 transactions&lt;/li&gt;
&lt;li&gt;5,565 closed investigations&lt;/li&gt;
&lt;li&gt;13,553 customers&lt;/li&gt;
&lt;li&gt;20 fraud alerts to investigate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system is a prototype. Customer responses can be explicitly simulated, and actions such as blocking a card or filing a report remain recommendations. TRACE does not execute banking actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;The investigation flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Benchmark CSVs
   ↓
Local preparation and reference checks
   ↓
TigerGraph entities, relationships, and vector indexes
   ↓
Evidence retrieval through official TigerGraph MCP
   ↓
Gemini initial assessment and simulated verification, when needed
   ↓
Deterministic policy recommendations and approval routes
   ↓
Output validation
   ↓
Investigation written to TigerGraph and read back
   ↓
Case JSON and analyst dashboard
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Local preparation creates an indexed staging database for loading and validation. The original source CSVs remain unchanged.&lt;/p&gt;

&lt;p&gt;TigerGraph supplies the relationship evidence. Semantic retrieval adds relevant historical narratives and policy material. Gemini interprets that context, while Python calculates exposure, validates grounding, applies policy, and determines approval routes.&lt;/p&gt;

&lt;p&gt;Before exporting an answer, the pipeline writes the investigation to TigerGraph and compares the stored answer with the generated record. That read-back check makes graph persistence a verified step rather than just a log message.&lt;/p&gt;

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

&lt;p&gt;The graph connects customers, cards, transactions, device profiles, email domains, billing regions, historical cases, investigations, and supporting documents.&lt;/p&gt;

&lt;p&gt;These relationships support questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What activity preceded the flagged transaction?&lt;/li&gt;
&lt;li&gt;Has this customer used the same billing region before?&lt;/li&gt;
&lt;li&gt;Which transactions share a device profile?&lt;/li&gt;
&lt;li&gt;What historical investigations are relevant?&lt;/li&gt;
&lt;li&gt;Does the surrounding activity support the suspected fraud pattern or a legitimate explanation?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Installed GSQL queries retrieve these relationships within defined time windows.&lt;/p&gt;

&lt;p&gt;Transaction evidence is bounded by the alert’s opening time. Historical case outcomes are eligible only after those cases have closed. This prevents the investigation from using future outcomes as if they were already known.&lt;/p&gt;

&lt;p&gt;TigerGraph also stores vectors used for semantic retrieval. The embedding model runs locally, but similarity search happens inside TigerGraph.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Difficult Modeling Decision: Card Identity
&lt;/h2&gt;

&lt;p&gt;The transaction file does not directly provide card IDs.&lt;br&gt;
Some card assignments are explicit in the supplied case references. Additional assignments are inferred by matching customer, card network, and card type against those references.&lt;/p&gt;

&lt;p&gt;TRACE preserves the distinction between explicit assignments and inferred relationships. Transactions that cannot be resolved remain connected to their customers without an invented card ID.&lt;/p&gt;

&lt;p&gt;This matters because a useful investigation graph should expose uncertainty rather than hide it behind apparently precise relationships.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Moved Embeddings Onto My Computer
&lt;/h2&gt;

&lt;p&gt;The initial implementation used Gemini’s embedding API. Indexing stopped when the free-tier daily quota was exhausted.&lt;br&gt;
Repeated cooldowns could not resolve a daily quota limit, so I moved semantic embeddings to a local model: sentence-transformers/all-MiniLM-L6-v2.&lt;/p&gt;

&lt;p&gt;It produces 384-dimensional vectors, which are stored in a separate TigerGraph vector attribute. Both documents and search queries use the same local model. The older Gemini vectors remain separate, because vectors from different models should not be mixed.&lt;/p&gt;

&lt;p&gt;Long text is processed in overlapping token windows and combined into a normalized document vector. This avoids silently discarding the end of a document, although combining windows can dilute very specific topics. That is a trade-off I would improve with more precise chunk-level retrieval.&lt;/p&gt;

&lt;p&gt;The local approach removed the embedding API quota bottleneck. Gemini still handles investigation reasoning and remains subject to generation limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agentic Capabilities
&lt;/h2&gt;

&lt;p&gt;TRACE produces an initial assessment and can identify when additional evidence is needed, such as customer validation or analyst follow-up.&lt;br&gt;
For this benchmark, a response can be simulated. That assumption is recorded explicitly, and the final assessment reflects it.&lt;/p&gt;

&lt;p&gt;Each output preserves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The initial recommendation before additional evidence is requested&lt;/li&gt;
&lt;li&gt;The assumed verification response, when used&lt;/li&gt;
&lt;li&gt;The final recommendation after that response&lt;/li&gt;
&lt;li&gt;An explanation of what changed&lt;/li&gt;
&lt;li&gt;The required approval route for each action&lt;/li&gt;
&lt;li&gt;SAR filing when required by policy&lt;/li&gt;
&lt;li&gt;A stopping reason&lt;/li&gt;
&lt;li&gt;A graph persistence receipt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The current retrieval sequence is selected by Python rules using the alert’s features. A future version would move more of this into adaptive LLM tool selection.&lt;br&gt;
Similarly, TRACE retrieves supplied historical investigations and writes new investigations into the graph. A future improvement would make newly generated investigations searchable as memory for later cases, while keeping simulated conclusions separate from confirmed outcomes.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;TRACE completed all 20 benchmark fraud investigations.&lt;/strong&gt;&lt;br&gt;
Each investigation produces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An internal case record&lt;/li&gt;
&lt;li&gt;Grounded graph and historical evidence&lt;/li&gt;
&lt;li&gt;Findings, risk indicators, and a final decision&lt;/li&gt;
&lt;li&gt;A fraud probability and estimated exposure&lt;/li&gt;
&lt;li&gt;The next best action and approval route before requesting evidence&lt;/li&gt;
&lt;li&gt;A final action and approval route after receiving additional evidence&lt;/li&gt;
&lt;li&gt;A suspicious activity report when required by policy&lt;/li&gt;
&lt;li&gt;A graph persistence receipt confirming that the investigation was written back to TigerGraph&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All 20 JSON answer files passed structural validation and live TigerGraph read-back verification.&lt;/p&gt;

&lt;p&gt;The final agent verdict distribution was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;17 fraud cases&lt;/li&gt;
&lt;li&gt;3 legitimate cases&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Verification Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Transaction count reconciled&lt;/td&gt;
&lt;td&gt;590,742&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Historical case count reconciled&lt;/td&gt;
&lt;td&gt;5,565&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customer count reconciled&lt;/td&gt;
&lt;td&gt;13,553&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flagged transaction attributes checked&lt;/td&gt;
&lt;td&gt;All 20 alerts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local vectors uploaded&lt;/td&gt;
&lt;td&gt;5,565 historical cases and 13 documents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Native TigerGraph vector retrieval&lt;/td&gt;
&lt;td&gt;Verified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Official TigerGraph MCP connection&lt;/td&gt;
&lt;td&gt;Verified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20 answer files generated&lt;/td&gt;
&lt;td&gt;Complete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Live graph read-back&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automated tests&lt;/td&gt;
&lt;td&gt;85 passing tests&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;A shared device profile is a lead, not proof. A browser and operating-system configuration can be common across many customers. Shared configurations or billing regions alone do not establish coordinated fraud.&lt;/p&gt;

&lt;p&gt;Identifiers need precise contracts. During testing, the model sometimes placed customer IDs in card-ID fields or used device descriptions where graph IDs were required. Explicit validation and exact-match conversion helped catch those errors.&lt;/p&gt;

&lt;p&gt;Structured output still needs validation. Valid JSON does not guarantee valid evidence, correct policy application, or a supported conclusion.&lt;/p&gt;

&lt;p&gt;Integration details matter. The official MCP server returned responses in a format that required careful parsing. Testing against the actual server response helped uncover those mismatches.&lt;/p&gt;

&lt;p&gt;Persistence should be checked. Recording that a case was “written to the graph” is meaningful only when the write is verified through read-back.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Would Improve Next
&lt;/h2&gt;

&lt;p&gt;With more time, I would add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adaptive tool selection so the agent chooses the next graph query based on remaining uncertainty&lt;/li&gt;
&lt;li&gt;Stronger TigerGraph-native pattern detection for transaction sequences, fraud rings, and community structures&lt;/li&gt;
&lt;li&gt;Provenance-aware case memory so new investigation records can be retrieved later without treating simulated outcomes as confirmed facts&lt;/li&gt;
&lt;li&gt;More precise document retrieval by indexing policy and narrative chunks separately&lt;/li&gt;
&lt;li&gt;Analyst feedback loops for improving recommendations over time&lt;/li&gt;
&lt;li&gt;Benchmark evaluation when labelled answers become available&lt;/li&gt;
&lt;li&gt;A richer dashboard with visual evidence paths and clearer before/after recommendation changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most valuable part of this project was learning to distinguish a plausible explanation from a defensible investigation.&lt;/p&gt;

&lt;p&gt;TRACE is built around that distinction: evidence first, explicit uncertainty, and actions governed by policy.&lt;/p&gt;

&lt;p&gt;Built for the TigerGraph Agentic Fraud Investigation challenge with @TigerGraphDB and @247pmstudio.&lt;/p&gt;

&lt;p&gt;Code:&lt;a href="https://github.com/krapanshi/Tigergraph-agentic-fraud-investigation" rel="noopener noreferrer"&gt;Github Repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>database</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
