Proposed Solution
Task 2: Solution Architecture and Tooling Choices
Solution Overview
The solution is a multi-agent financial analysis system built on LangGraph that connects to Google Sheets financial models via API. A supervisor/planner agent receives natural-language queries and routes them to specialist sub-agents — each with a dedicated playbook, tool set, and memory context. The user interacts through a React/Next.js chat interface that communicates with a FastAPI backend deployed on Vercel.
To the user, it feels like chatting with a senior FP&A analyst who has instant recall of every formula, can run hundreds of scenarios in seconds, and brings strategic industry knowledge from a curated knowledge base. The system combines Agentic RAG (retrieval-augmented generation over business strategy documents and Tavily web search) with tool-using agents that can read, write, and analyze live spreadsheet data.
Tooling Choices
Each choice is driven by the need for a production-grade, extensible stack that supports multi-agent orchestration with tool calling:
| Component | Choice | Rationale |
|---|---|---|
| LLM (Supervisor) | GPT-4o | Best reasoning for complex routing decisions and structured output. |
| LLM (Agents) | GPT-4o-mini | Cost-effective for tool-calling agents that follow structured playbooks. |
| Agent Orchestration | LangGraph | Native support for cyclic tool-calling loops, checkpointing, and memory stores. |
| Tools | Google Sheets API (gspread) | Direct programmatic access to read/write cells, formulas, and ranges. |
| Embedding Model | text-embedding-3-small | Production OpenAI embedding model; 1536 dims, good cost/quality tradeoff. |
| Vector Database | Qdrant (in-memory) | Lightweight, no infrastructure needed; easy to swap to hosted Qdrant later. |
| Monitoring | LangSmith | First-party LangGraph tracing; shows full agent execution traces and tool calls. |
| Evaluation | RAGAS | Standard framework for RAG evaluation with faithfulness, recall, and relevancy metrics. |
| User Interface | Next.js + MUI | React-based with server-side rendering; Material-UI for consistent component library. |
| Deployment | Vercel | Integrated Next.js hosting with Python serverless functions for the backend. |
| Web Search | Tavily | Purpose-built search API for AI agents; returns structured, citation-ready results. |
RAG and Agent Components
RAG components: The Strategic Guidance sub-agent uses a Qdrant vector store loaded with business knowledge documents (financial glossaries, Amazon/Shopify strategies, advertising playbooks, warehouse optimization guides). Documents are chunked with RecursiveCharacterTextSplitter (500 chars, 50 overlap) and embedded withtext-embedding-3-small. On query, the top 5 relevant chunks are retrieved and injected into the agent's system prompt as grounding context. An advanced hybrid retrieval mode (BM25 + dense with Reciprocal Rank Fusion) is available via the ADVANCED_RETRIEVAL flag.
Agent components: The supervisor routes to specialist agents (Recall, Goal Seek, Strategic, with Sensitivity, What-If, and Forecast planned for Demo Day) each backed by LangChain tools bound to the LLM. Tool-calling agents can read/write cells, trace formula chains, run sensitivity tables, and log to audit trails. Memory is managed across 5 types: short-term (conversation via LangGraph checkpointer), long-term (cross-session facts in InMemoryStore), semantic (embedding-indexed knowledge), episodic (timestamped past interactions), and procedural (agent playbooks).