This project is a multi-agent hierarchical financial analysis research tool built using LangGraph. It demonstrates how hierarchical multi-agent frameworks can be implemented for financial data analysis, research, and prediction.
The system consists of two primary nodes:
- Data Fetch & Store Node
- Q&A Node
Each of these nodes contains specialized sub-nodes to handle different types of financial data.
This node is responsible for fetching financial data from different sources and storing them efficiently.
It consists of two sub-nodes:
- Fetches financial data such as stock prices, earnings reports, and historical trends using the YFinance API.
- Stores the structured financial data in a PostgreSQL database.
- Accepts financial documents like balance sheets, income statements, and cash flow statements in PDF format.
- Extracts relevant data and stores it in a vector database (FAISS) for efficient retrieval.
This node processes user queries by searching financial data across different sources.
It consists of three sub-nodes:
- Searches the vector database for relevant information from ingested financial PDFs.
- Uses FAISS to perform fast and efficient retrieval of stored document embeddings.
- Fetches financial data for a given company from the PostgreSQL database.
- Calls the Pandas Agent to analyze the retrieved data and generate responses.
- Performs a real-time web search for additional financial data.
- Uses scraping APIs to extract relevant financial insights from the internet.
Each time a user asks a financial question, all three sub-nodes (Vector Search, PostgreSQL Query, Web Scraper) are executed, and the system returns results from each source.
- Python (Main backend development)
- LangGraph (Hierarchical multi-agent framework)
- YFinance API (Stock market data retrieval)
- FAISS (Vector store for efficient document retrieval)
- PostgreSQL (Relational database for structured financial data)
- Web Scraping APIs (For real-time financial data extraction)
- User requests financial data → The system fetches data from YFinance and PostgreSQL.
- User uploads financial documents → The system processes and stores them in a vector database.
- User asks a financial question → The system retrieves relevant answers from:
- Vector DB (PDFs)
- PostgreSQL DB (Structured data + Pandas analysis)
- Web Search (Real-time financial insights)
All three answers are returned, providing a comprehensive financial analysis.
This setup ensures that financial insights are data-driven, sourced from multiple locations, and cross-verified for accuracy. 🚀
- Clone the repository:
git clone https://github.com/your-repo-name.git cd your-repo-name - Create a virtual environment and install the requirements:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
- Set up environment variables using the .env.sample as a reference.
- To start the API, use the following command:
uvicorn app.api.api:app --host 0.0.0.0 --port 8001
- Once the server is running, you can make a request using:
curl -X POST "http://localhost:8001/query/" -H "Content-Type: application/json" -d '{"query": "Fetch the data for Apple"}'

