Beyond the Chatbot: Building a Multi-Agent “Shared Brain” for Secure Financial Analytics
In the world of financial analytics, the stakes for accuracy and security are exceptionally high. While generic LLM chatbots are…
Beyond the Chatbot: Building a Multi-Agent “Shared Brain” for Secure Financial Analytics
In the world of financial analytics, the stakes for accuracy and security are exceptionally high. While generic LLM chatbots are impressive, they often act as “black boxes” — failing to provide transparency into their logic or, worse, hallucinating SQL that could compromise data integrity. For my capstone project, I built FinSight, an end-to-end agentic platform designed to bridge the gap between natural language business questions and governed, auditable financial insights.
Here is a look into the architecture, techniques, and security protocols that make this system a robust tool for modern analysts.

The Architecture: Multi-Agent Orchestration
Instead of relying on a single, long prompt chain, FinSight adopts a multi-agent orchestration landscape built on LangGraph. This approach uses specialized agents — functional “nodes” in a graph — that each handle a specific part of the analytical lifecycle.
- The Planner: Converts a user’s raw question into a structured JSON analysis intent, identifying the metrics and dimensions needed.
- The SQL Agent: Generates executable code grounded in specific metadata.
- The Validator: Checks the output for reliability and aggregation sanity.
- The Narrator: Translates raw data into an executive summary with actionable recommendations.
By using explicit graph nodes and conditional edges, the system gains deterministic control flow. If the SQL execution fails, for example, the graph can trigger a fallback or stop the process entirely, preventing the system from hallucinating a “narrative” based on non-existent data.
The “Shared Brain”: AnalysisState
The heart of this orchestration is the AnalysisState, a typed data contract that persists across all nodes in the workflow. In many multi-agent systems, agents “forget” context as they pass information. FinSight solves this by using a State Graph where every agent reads from and writes to a shared, persistent memory.

This state includes fields for the original question, the generated plan, the SQL query, and the final results. We also utilize Reducers like add_messages to ensure that conversation history is appended rather than overwritten, allowing the system to maintain a "Single Source of Truth" throughout the entire execution cycle.
Semantic Grounding: Solving the Hallucination Problem
One of the biggest hurdles in Text-to-SQL is ensuring the LLM understands the specific vocabulary of a company’s database. FinSight uses Semantic Grounding to solve this.
Before processing a query, the system generates a Metadata Catalog and a Business Glossary. By injecting this context directly into the SQL Agent’s prompts — a technique known as context packing — the AI understands that a user asking for “net margin” should look specifically at the gross_profit and operating_expenses columns in the DuckDB finance mart. This alignment between business terms and technical schemas is what makes the system's SQL generation reliable.
The Security Fortress: Model Context Protocol (MCP)
For financial data, security cannot be an afterthought. FinSight implements a “Defense in Depth” strategy for query execution.
The primary path for execution utilizes the Model Context Protocol (MCP). We spawn a Governed FastMCP Server as a separate stdio subprocess. This provides process isolation, physically separating the database execution logic from the main application.
Within this isolated layer, an Early Safety Guard (QueryGuard) enforces a strict whitelist, blocking any mutating commands like DROP, DELETE, or INSERT. Finally, the database itself, powered by DuckDB, is opened in read-only mode, ensuring that the underlying financial data remains untouched regardless of the query generated.
Trust through Transparency
A key goal for FinSight was to build user trust. The Streamlit-based UI reflects this by moving away from “black-box” responses. When a user receives an insight, they can click through multiple tabs to see:
- Insights: The AI-generated executive narrative.
- Charts: Heuristic-driven visualizations (often side-by-side bar and pie charts).
- Data: The raw tabular results from the database.
- SQL & Validation: The exact query that was run and its confidence score.
Conclusion
FinSight demonstrates that by combining agentic orchestration via LangGraph with isolated governance via MCP, we can create AI tools that are not only powerful but also safe and transparent. By grounding agents in metadata and enforcing strict execution guardrails, we move from “chatting with data” to building a professional-grade analytical engine.
Every query handled by FinSight is logged in a centralized audit.json file and monitored through an Observability Dashboard, ensuring that in the high-stakes world of finance, every insight is 100% auditable
메타데이터
- post_id
- 550c95c7df7c
- slug
- beyond-the-chatbot-building-a-multi-agent-shared-brain-for-secure-financial-analytics-550c95c7df7c
- url
- https://medium.com/@sms11487/beyond-the-chatbot-building-a-multi-agent-shared-brain-for-secure-financial-analytics-550c95c7df7c
- canonical_url
- https://medium.com/@sms11487/beyond-the-chatbot-building-a-multi-agent-shared-brain-for-secure-financial-analytics-550c95c7df7c
- author_url
- https://medium.com/@sms11487
- status
- ok
- fetched_at
- 2026-08-04 16:50:48