<?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: Parth Khare</title>
    <description>The latest articles on DEV Community by Parth Khare (@khare69).</description>
    <link>https://dev.to/khare69</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%2F4245324%2F359829b2-3a01-48b6-81b9-070dcd9d9aa6.png</url>
      <title>DEV Community: Parth Khare</title>
      <link>https://dev.to/khare69</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khare69"/>
    <language>en</language>
    <item>
      <title>Beyond Black-Box Prompts: Building an Explainable Multi-Agent Financial Intelligence Platform with FastAPI &amp; React</title>
      <dc:creator>Parth Khare</dc:creator>
      <pubDate>Sun, 15 Nov 2026 03:49:17 +0000</pubDate>
      <link>https://dev.to/khare69/beyond-black-box-prompts-building-an-explainable-multi-agent-financial-intelligence-platform-with-4o03</link>
      <guid>https://dev.to/khare69/beyond-black-box-prompts-building-an-explainable-multi-agent-financial-intelligence-platform-with-4o03</guid>
      <description>&lt;p&gt;In quantitative finance and retail investing, treating Large Language Models as a single "oracle" prompt is dangerous. When you ask a single LLM whether a stock is a buy, it frequently exhibits confirmation bias, hallucinations with financial figures, and a total lack of calibrated risk management.&lt;/p&gt;

&lt;p&gt;Real-world institutional investment committees don't rely on a single analyst. They rely on &lt;strong&gt;specialized, competing personas&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;Quantitative Analyst&lt;/strong&gt; focused strictly on mathematical momentum and price action.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Fundamental Researcher&lt;/strong&gt; verifying facts from SEC disclosures and regulatory filings.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Risk Manager&lt;/strong&gt; whose sole job is to protect capital, cap drawdowns, and challenge aggressive assumptions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To solve this problem, I built &lt;strong&gt;&lt;a href="https://github.com/Khare69/Vibe-Finance" rel="noopener noreferrer"&gt;Vibe-Finance&lt;/a&gt;&lt;/strong&gt;: an end-to-end multi-agent financial intelligence and explainability platform built with a &lt;strong&gt;Python/FastAPI&lt;/strong&gt; backend, vector RAG over corporate filings, and a modern &lt;strong&gt;React/Vite/Tailwind&lt;/strong&gt; client.&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how the architecture works, how the adversarial debate engine resolves conflict, and the engineering trade-offs made along the way.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏛️ System Architecture
&lt;/h2&gt;

&lt;p&gt;Instead of feeding everything into one monolithic prompt, Vibe-Finance separates data ingestion, analysis, adversarial cross-examination, and synthesis into dedicated layers:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    UI[Frontend: React 18 + Vite + Tailwind + TradingView Charts] --&amp;gt;|REST / JSON| API[Backend: FastAPI]

    subgraph MultiAgentEngine [Multi-Agent Intelligence Layer]
        QA[Quant Agent\nWilder RSI-14, 50-EMA, 200-SMA, MACD]
        FA[Fundamental RAG Agent\nSEC 10-K Filings &amp;amp; Polarity Extraction]
        BM[Behavioral Risk Manager\nDrawdown Caps &amp;amp; Beta Exposure Limits]
        DEB[Adversarial Debate Engine\nCross-Examination &amp;amp; Calibration]
        SYN[Synthesis Agent\nHybrid Gemini 1.5 Flash + Deterministic Fallback]
    end

    API --&amp;gt; MultiAgentEngine
    QA --&amp;gt; DEB
    FA --&amp;gt; DEB
    BM --&amp;gt; DEB
    DEB --&amp;gt; SYN
    SYN --&amp;gt; API

    subgraph Storage [Persistence &amp;amp; Ingestion Layer]
        SQLITE[(SQLite: Profiles, Holdings, Decision Memos)]
        CACHE[(Market Cache: Live Feed + Offline Snapshot Fallback)]
    end
    API --- Storage&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  🤖 The Multi-Agent Trinity
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The Quantitative Agent
&lt;/h3&gt;

&lt;p&gt;The Quant Agent operates purely on hard mathematical indicators. It executes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Wilder's RSI-14&lt;/strong&gt; for overbought/oversold boundaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Moving Average Convergence/Divergence (MACD)&lt;/strong&gt; tracking signal and histogram shifts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;50-day EMA &amp;amp; 200-day SMA&lt;/strong&gt; to identify Golden Crosses or Death Crosses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Volume Anomaly Ratios&lt;/strong&gt; evaluating institutional accumulation or distribution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The Fundamental RAG Agent
&lt;/h3&gt;

&lt;p&gt;This agent parses regulatory corporate filings (SEC 10-Ks, 10-Qs, earnings conference transcripts) using vector embeddings. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Corpus Isolation:&lt;/strong&gt; Each ticker's vector index is isolated to guarantee &lt;strong&gt;zero cross-contamination&lt;/strong&gt; between unrelated equities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual Grounding:&lt;/strong&gt; Extracts polarities and specific financial disclosures, attaching exact citations so users can audit the evidence behind every claim.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. The Behavioral Risk Manager
&lt;/h3&gt;

&lt;p&gt;The Risk Manager protects the investor against behavioral pitfalls. It evaluates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user's risk profile (&lt;code&gt;Conservative&lt;/code&gt;, &lt;code&gt;Moderate&lt;/code&gt;, or &lt;code&gt;Aggressive&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Maximum historical drawdown caps.&lt;/li&gt;
&lt;li&gt;High-beta concentration limits, injecting pre-trade "What-If" nudges if an order threatens portfolio balance.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚔️ The Heart of the System: Adversarial Debate
&lt;/h2&gt;

&lt;p&gt;The most critical component of the platform is the &lt;strong&gt;Debate Engine&lt;/strong&gt;. When the Quant Agent sees a strong breakout signal (Bullish) but the Fundamental RAG Agent detects margin compression in recent filings (Bearish), the system detects &lt;strong&gt;agent friction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Rather than averaging their scores, the engine runs a structured adversarial exchange:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AdversarialDebateEngine&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""Detects agent friction and calibrates overall decision confidence."""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;evaluate_consensus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quant_signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rag_signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;risk_profile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;friction_detected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;quant_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;polarity&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;rag_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;polarity&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;friction_detected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# Cross-examine: Penalize overall confidence and challenge bull bias&lt;/span&gt;
            &lt;span class="n"&gt;calibrated_confidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quant_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rag_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.85&lt;/span&gt;
            &lt;span class="n"&gt;debate_summary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Friction Detected: Technical momentum is {quant_signal.polarity}, "&lt;/span&gt;
                &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"but corporate disclosures indicate {rag_signal.polarity} risks."&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;calibrated_confidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quant_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rag_signal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;2.0&lt;/span&gt;
            &lt;span class="n"&gt;debate_summary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Agents aligned on directional momentum."&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"friction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;friction_detected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"calibrated_confidence"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;calibrated_confidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"debate_summary"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;debate_summary&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting debate log is passed to a hybrid &lt;strong&gt;Gemini 1.5 Flash&lt;/strong&gt; synthesis engine that returns structured JSON. If the LLM provider experiences network latency or rate-limiting, the system automatically falls back to an &lt;strong&gt;algorithmic deterministic engine&lt;/strong&gt;—ensuring 100% operational uptime.&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Interactive TradingView Visualization &amp;amp; Telemetry
&lt;/h2&gt;

&lt;p&gt;On the client side (React 18 + Vite + Tailwind CSS), technical analysis is visualized using &lt;strong&gt;TradingView Lightweight Charts&lt;/strong&gt; (&lt;code&gt;lightweight-charts&lt;/code&gt; v5.2.1):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interactive 30-day candlestick bars with dynamic timeframes (1M, 3M, 14D).&lt;/li&gt;
&lt;li&gt;Real-time volume histograms and volatility simulations.&lt;/li&gt;
&lt;li&gt;An interactive &lt;strong&gt;Telemetry Audit Drawer&lt;/strong&gt; displaying model latency, scanned regulatory chunk counts, and token consumption for complete transparency.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛡️ Reliability &amp;amp; 21 Verified Test Scenarios
&lt;/h2&gt;

&lt;p&gt;Building autonomous agents in finance demands strict testing. The repository includes an end-to-end automated test suite verifying &lt;strong&gt;21 critical scenarios&lt;/strong&gt; (&lt;code&gt;python -u backend/test_suite.py&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Uncataloged Ticker Isolation:&lt;/strong&gt; Mathematical proof that searching Ticker A never extracts citations from Ticker B.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graceful Degradation:&lt;/strong&gt; Automatic 25-point confidence penalty when live price feeds go stale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG Timeout Fallbacks:&lt;/strong&gt; Seamless fallback to technical momentum and risk constraints if regulatory vector stores time out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pydantic Boundary Validation:&lt;/strong&gt; Strict rejection of negative trade sizes, zero-cost assets, or invalid dates.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Orchestration Beats Monoliths:&lt;/strong&gt; Dividing tasks across specialized agents produces far more nuanced, explainable results than an exhaustive mega-prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic Fallbacks are Essential:&lt;/strong&gt; In production, AI APIs will experience timeouts. Having an algorithmic fallback ensures user workflows never crash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparency Builds Trust:&lt;/strong&gt; Surfacing the debate between opposing agents makes AI recommendations actionable rather than mysterious.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💻 Try It Out &amp;amp; Contribute
&lt;/h2&gt;

&lt;p&gt;The entire codebase is open-source under the &lt;strong&gt;Apache 2.0 License&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/Khare69/Vibe-Finance" rel="noopener noreferrer"&gt;Khare69/Vibe-Finance&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quickstart with Docker:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  git clone https://github.com/Khare69/Vibe-Finance.git
  &lt;span class="nb"&gt;cd&lt;/span&gt; Vibe-Finance
  docker compose up --build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’d love to hear your thoughts, feedback, and architectural questions in the comments below! If you find the project interesting, feel free to drop a ⭐ on the repository!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>fastapi</category>
      <category>showdev</category>
      <category>aie</category>
    </item>
  </channel>
</rss>
