Project Documentation: Financial Report Generator MAS
Overview
The Financial Report Generator is a sophisticated Multi-Agent System (MAS) designed to automate the process of gathering raw financial data, performing key analytical calculations, and synthesizing the findings into a coherent, structured financial report. This project meets the core requirements of having a minimum of three agents, three distinct tool integrations, and utilizing a robust orchestration framework (LangGraph).
The system's goal is to transform a simple user query (e.g., "Tesla Q4 2025") into a complete, data-driven analysis, enabling analysts to focus on strategic insights rather than manual data compilation.
System Architecture and Orchestration
The system uses a sequential pipeline architecture managed by LangGraph. The workflow is structured around a shared state that is updated incrementally by each agent, ensuring data consistency and a clear flow of information.
Orchestration Flow
Input (User Request): The process begins with the user providing the company and reporting period.
Phase 1 (Data Fetcher): The agent gathers raw data and updates the shared state.
Phase 2 (Data Analyst): The agent performs computations on the raw data.
Phase 3 (Report Writer): The agent synthesizes all collected and processed data.
Output (END): The final, formatted financial report is returned.
Agent Roles and Responsibilities (3 Agents)
The system relies on three specialized agents, each focused on a distinct part of the analysis chain:
A. 🔎 Data Fetcher Agent
• Primary Role: Information Retrieval.
• Responsibility: Secure all necessary inputs, including structured numerical data and qualitative news commentary. This agent is responsible for making the initial tool calls.
• Output: The shared state is updated with a raw data package containing both financials and news summaries.
B. 🧮 Data Analyst Agent
• Primary Role: Calculation and Analysis.
• Responsibility: Take the raw data from the fetcher, execute complex mathematical formulas, and identify key financial trends. This agent ensures the report contains actionable, data-driven insights.
• Output: The shared state is updated with a concise analytical summary and the results of all calculations.
C. ✍️ Report Writer Agent
• Primary Role: Synthesis and Generation.
• Responsibility: Structure the final report. This agent consumes the analytical summary and the raw data to create a polished, coherent, and professional document in a readable format (e.g., Markdown).
• Output: The final output document.
Tool Integration (3 Tools)
The agents integrate three tools to extend capabilities beyond basic LLM reasoning:
Tool 1: 🌐 Google Search Tool
• User Agent: Data Fetcher.
• Functionality: Used to search for external, qualitative data such as recent press releases, CEO commentary, and market sentiment, providing context that numerical data alone cannot offer.
Tool 2: 📞 API Caller Tool (Simulated)
• User Agent: Data Fetcher.
• Functionality: Simulates a call to a financial data endpoint to retrieve structured, quantitative data like Income Statement line items (Revenue, COGS, Expenses).
Tool 3: 🐍 Python REPL Tool
• User Agent: Data Analyst.
• Functionality: Executes arbitrary Python code, primarily leveraging libraries like Pandas, to perform essential financial calculations (e.g., calculating Gross Margin, Year-over-Year growth, or deriving ratios like Debt-to-Equity). This ensures calculation accuracy.
Installation and Execution Guide
To run the multi-agent system, ensure you have Python 3.9+ and the required packages installed
Installation
Pip install langgraph langchain-core
Python financial_report_mas.py